From skill-profiler
Analyse and optimise Claude skills and agent configurations for token efficiency, model routing, and context management. Use when user says "profile this skill", "optimise this agent", "audit token usage", "check model routing", "reduce context pollution", "analyse skill efficiency", or "run profiler". Also use when user uploads or references a SKILL.md file and asks about its efficiency, token usage, or structure. Do NOT use for general code profiling, application performance, or non-skill optimisation tasks.
How this skill is triggered — by the user, by Claude, or both
Slash command
/skill-profiler:skill-profilerThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Analyse, profile, and optimise Claude Code skills and agent configurations. Produces structured profiling reports with token savings estimates, model routing recommendations, and context pollution fixes. Can auto-refactor skills with user approval.
assets/report-template.mdreferences/anti-patterns.mdreferences/cache-strategies.mdreferences/delegation-patterns.mdreferences/model-routing-guide.mdreferences/optimisation-catalog.mdreferences/progressive-disclosure-guide.mdreferences/validation-rubric.mdscripts/_common.pyscripts/analyze_structure.pyscripts/audit_cache_hygiene.pyscripts/audit_delegation_patterns.pyscripts/audit_model_routing.pyscripts/estimate_tokens.pyscripts/generate_report.pyscripts/scan_context_pollution.pyscripts/score_trigger_description.pyAnalyse, profile, and optimise Claude Code skills and agent configurations. Produces structured profiling reports with token savings estimates, model routing recommendations, and context pollution fixes. Can auto-refactor skills with user approval.
| Mode | Trigger | What it does |
|---|---|---|
| Static Analysis (default) | "profile this skill", "analyse structure" | Structure, tokens, description quality, anti-patterns |
| Model Routing Audit | "check model routing", "audit agents" | All of Static + subagent model classification, mismatch detection, delegation pattern audit |
| Context Pollution Scan | "reduce context pollution", "check context waste" | All of Static + read-heavy pattern detection, delegation recommendations, cache hygiene audit |
| Cache Hygiene | "check caching", "audit cache patterns" | All of Static + cache-busting pattern detection |
| Delegation Audit | "check delegation", "audit delegation patterns" | All of Static + agent delegation template compliance |
| Full Profile | "full profile", "run profiler" | All modes combined, deduplicated, priority-ranked |
| Auto-Refactor | "optimise this skill", "auto-refactor" | Full Profile + generates optimised files with user approval |
When the user's intent is ambiguous, default to Full Profile.
This skill's Python scripts are in the scripts/ subdirectory relative to this SKILL.md file. Resolve the absolute path from this file's location. All script invocations below use <profiler-scripts> to refer to that directory. This is distinct from <target-skill-dir>, which is the skill being profiled.
Gather the target skill/agent files:
~/.claude/skills/<name>/SKILL.md.claude/skills/<name>/SKILL.md~/.claude/agents/ directory.claude/agents/ directoryAsk the user which surface they're targeting if model routing or delegation recommendations are needed:
Run the structural analysis script:
python3 <profiler-scripts>/analyze_structure.py <target-skill-dir>
This checks:
Also run token estimation:
python3 <profiler-scripts>/estimate_tokens.py <target-skill-dir>
And score the description:
python3 <profiler-scripts>/score_trigger_description.py --description "<description text>"
For collision detection, pass other skill descriptions:
python3 <profiler-scripts>/score_trigger_description.py --description "<desc>" --others "<desc2>" "<desc3>"
Agentic Validation (rubric sections 2, 3, 5 — see validation-rubric.md):
After the scripts return, read the target SKILL.md body and the script output, then validate:
Model Routing, Delegation, and Full Profile modes only. Skip for Static Analysis and Context Pollution modes.
Run the model routing audit:
python3 <profiler-scripts>/audit_model_routing.py <agents-dir>
This classifies each agent by tool permissions and recommends the appropriate model tier:
Also scan the SKILL.md body for operations that imply model needs but happen in the main thread instead of being delegated. Cross-reference with Step 4 findings.
For detailed tier classification, see model-routing-guide.md.
Also run the delegation patterns audit:
python3 <profiler-scripts>/audit_delegation_patterns.py <target-skill-dir> [--agents-dir <agents-dir>]
This checks agent files against the delegation templates in delegation-patterns.md:
Agentic Validation (rubric section 4 — see validation-rubric.md):
After the scripts return, read each agent's actual instructions (not just frontmatter) and validate:
grep → Haiku is fine)Context Pollution, Cache Hygiene, and Full Profile modes only. Skip for Static Analysis and Model Routing modes.
Run the context pollution scanner:
python3 <profiler-scripts>/scan_context_pollution.py <target-skill-md-path>
This detects:
Apply the break-even rule: only recommend delegation when expected tool output exceeds 1,500 tokens or when more than 3 sequential tool calls would occur. Below this threshold, subagent spawn overhead (~500-1,000 tokens) exceeds the savings.
For delegation templates, see delegation-patterns.md.
Also run the cache hygiene audit:
python3 <profiler-scripts>/audit_cache_hygiene.py <target-skill-dir>
This detects cache-busting patterns from cache-strategies.md:
Agentic Validation (rubric section 1 — see validation-rubric.md):
After the scripts return, read the SKILL.md body and validate:
Aggregate findings from all completed steps, including agentic validation corrections:
model: inherit and read-only tools is both a routing and pollution issue)(token_savings × frequency) / effortEach recommendation must include:
Consolidate all agentic validation findings into a single "Agentic Review" section for the report. Present findings as a numbered list with severity, finding, and recommendation — same format as Anti-Patterns. Replace the ## Agentic Review placeholder in the report with the findings.
Auto-Refactor mode only. Skip for all other modes.
Present the full report from Step 5 and ask the user which recommendations to apply. Do NOT auto-apply without explicit confirmation.
For each approved recommendation:
references/ files.md files with correct model fields using templates from delegation-patterns.md.md files for read-heavy operationsOutput all generated files for the user to review before writing to disk.
Generate the final report:
python3 <profiler-scripts>/generate_report.py <target-skill-dir> [--agents-dir <path>] [--mode full]
For Auto-Refactor mode, run the full pipeline again on the optimised version and present a before/after comparison showing:
Quality gate for auto-refactored output:
The profiler produces a structured markdown report. See report-template.md for the full template.
Key sections: Summary (score + savings), Structural Analysis (metrics table), Model Routing Audit (agent table), Context Pollution Scan (pattern table), Cache Hygiene Audit (cache-busting findings), Delegation Patterns Audit (agent compliance table), Anti-Patterns Detected (severity-ranked list), Recommendations (impact-ranked table), Agentic Review (consolidated validation findings), Generated Artefacts (if auto-refactor).
| Feature | Claude Code | Agent SDK | Claude.ai | API |
|---|---|---|---|---|
| Structural analysis | Yes | Yes | Yes | Yes |
| Description tuning | Yes | Yes | Yes | Yes |
| Progressive disclosure | Yes | Yes | Yes | Yes |
| Model routing audit | Yes | Yes | No | Yes |
| Subagent delegation | Yes | Yes | No | Yes |
| Script execution | Yes | Yes | No | Yes |
| Auto-refactor | Yes | Yes | Partial | Yes |
Adjust recommendations based on the user's target surface. Never recommend subagent model routing for Claude.ai users.
npx claudepluginhub callumthomas/claude-tools --plugin skill-profilerDiagnoses and optimizes Agent Skills (SKILL.md) by scanning session transcripts for underused skills, wasted context, and CSO issues, then outputting a prioritized report.
Creates, evaluates, and reviews Claude Code skills and agent definition files. Covers skill-vs-hook decisions, SKILL.md authoring, frontmatter optimization, baseline-first evals with MCP tooling, validation, and packaging.
Refines and validates existing Claude Code skills for clarity, efficiency, and production readiness. Use for improving structure, best practices, token reduction, and production checks.