home / skills / bahayonghang / my-claude-code-settings / skill_optimizer
This skill analyzes Claude Code skills for compliance and token efficiency, guiding improvements and generating an optimized, ready-to-deploy SKILL.md.
npx playbooks add skill bahayonghang/my-claude-code-settings --skill skill_optimizerReview the files below or copy the command above to add this skill to your agents.
---
name: skill-optimizer
description: Analyze Claude Code skills for compliance and token efficiency. Use when reviewing skills.
category: skill-management
tags:
- optimization
- analysis
- skill-authoring
argument-hint: [skill-directory-path]
allowed-tools: Read, Glob, Grep, Bash(python *)
---
Optimize the Claude Code skill at `$ARGUMENTS`.
## Steps
1. If `$ARGUMENTS` is empty or the path does not contain SKILL.md, report: "Error: Provide a valid skill directory path containing SKILL.md."
2. Run: `python "$SKILL_DIR/scripts/analyze_skill.py" "$ARGUMENTS"`
3. Read `$SKILL_DIR/resources/CHECKLIST.md` and `$SKILL_DIR/resources/PATTERNS.md`.
4. Cross-reference JSON report with CHECKLIST and PATTERNS.
5. Present findings: **Critical → Recommended → Optional**, each with before/after fix.
6. Generate optimized SKILL.md resolving all Critical and Recommended issues.
## Output
Report issues by severity, then a token budget table (Before/After/Δ), then the full optimized SKILL.md.
## Rules
- Only official frontmatter fields: name, description, argument-hint, disable-model-invocation, user-invocable, allowed-tools, model, context, agent, hooks, category, tags.
- Optimized SKILL.md: < 300 tokens body, imperative voice, no educational content inline.
- Preserve original intent. Move reference content to resources/.
This skill analyzes Claude Code skills for compliance, structure, and token efficiency. It automates detection of critical, recommended, and optional fixes and produces an optimized skill manifest that preserves intent while reducing token cost. The skill also produces a token budget comparison showing before/after savings.
It runs a static analysis script against a skill directory, then reads canonical checklist and pattern resources to cross-reference findings. The tool classifies issues into Critical, Recommended, and Optional, and creates concrete before/after fixes for each finding. Finally, it generates an optimized skill manifest constrained to allowed frontmatter fields and a concise body under the specified token budget.
What does the optimizer require as input?
A valid skill directory containing the skill manifest and resource files.
Will the optimizer change behavior?
It preserves intent but trims and restructures content for compliance and token efficiency; all changes are presented as before/after fixes.