From plugin-creator
Optimizes CLAUDE.md, SKILL.md, agents, and plugin files for Claude comprehension and token economy using metrics, specialist agent delegation, verification, and before/after reports.
npx claudepluginhub jamie-bitflight/claude_skills --plugin plugin-creatorThis skill uses the workspace's default tool permissions.
Orchestrate multi-phase optimization of AI-facing documentation with measurement, delegation, verification, and comprehensive reporting.
Transform documentation into AI-optimized format for Claude Code. Use when user says "update doc", "optimize doc", "rewrite for claude", or "AI optimize". Shows recently modified .md files for selection, verifies accuracy against codebase, generates optimized version, compares for completeness, then replaces with approval.
Optimizes CLAUDE.md files and Skills for Claude Code CLI by applying Anthropic's prompt best practices like positive framing, specificity, context provision, and markdown structure. Use for reviewing or improving system prompts.
Optimizes CLAUDE.md hierarchies, .claude/rules, ecosystem files, and docs/ folders per Anthropic best practices. Detects redundancies, conflicts, and suggests improvements.
Share bugs, ideas, or general feedback.
Orchestrate multi-phase optimization of AI-facing documentation with measurement, delegation, verification, and comprehensive reporting.
/optimize-claude-md <path>
Where <path> is one of:
./CLAUDE.md, .claude/skills/my-skill/SKILL.md, .claude/agents/my-agent.md).claude/skills/my-skill/) — optimizes SKILL.md and all reference filesplugins/my-plugin/) — optimizes CLAUDE.md, all skills, and all agents<user_provided_target>$ARGUMENTS</user_provided_target>
!pwd
If <user_provided_target> is empty, ask the user for a target path before proceeding.
If <user_provided_target> is not an absolute path, prepend the value of <PWD> to produce the absolute path. Use that absolute path for all subsequent operations.
Verify the resolved absolute path exists. Determine scope (single file, skill directory, or plugin directory).
For all files:
uvx skilllint@latest check --check <file>For SKILL.md files only:
Record metrics for reporting.
Spawn the optimization agent via Agent tool with enhanced delegation template (see below). Pass file-type-specific context, baseline metrics, and constraints.
<delegation_template>
TARGET: {resolved path(s)}
FILE TYPE: {CLAUDE.md | SKILL.md | agent definition | reference file}
BASELINE TOKEN COUNT: {N tokens}
BASELINE COMPLETENESS SCORE: {X/24} (SKILL.md only)
TASK:
1. Run RT-ICA pre-check — verify file type, intent, audience, constraints
2. Enable the prompt-optimization skill
3. Read the complete target file(s)
4. Analyze against the 8 optimization principles:
- Positive framing (replace prohibitions with directives)
- Motivation (explain why rules exist)
- Concrete examples (show correct and incorrect patterns)
- Front-loaded priorities (critical info first)
- Concise language (economy without ambiguity)
- Explicit format control (structure instructions clearly)
- Strategic XML tagging (semantic boundaries for complex prompts)
- Structural enforcement (decision flows, tables, checklists for determinism)
5. Apply transformations — preserve original intent, improve execution economy
6. Run CoVe post-check — generate falsifiable verification questions, answer independently
7. Report token impact for each transformation
8. Signal completion status: DONE or BLOCKED
CONSTRAINTS:
- Preserve all original intent and functional behavior
- Maintain file structure conventions (frontmatter format, heading hierarchy)
- Apply compression only where it improves clarity — brevity is not the sole goal
- Verify technical terms are exact (tool names, file paths, command syntax)
- Report token impact for each transformation
- For SKILL.md: evaluate against 8 completeness categories, keep description <1024 chars, no YAML multiline indicators
- For agent files: preserve required frontmatter fields (name, description)
- For CLAUDE.md: front-load critical instructions, use decision flow diagrams for complex logic
- For CLAUDE.md: read `.claude/skills/optimize-claude-md/references/claude-rules-extraction.md` before analyzing; perform rules extraction phase after optimization analysis, before CoVe
- Signal DONE when optimization complete, BLOCKED when missing required inputs
OUTPUT STRUCTURE:
- RT-ICA Pre-Check Results
- Analysis of Optimization Opportunities
- Optimized Content (complete file)
- Changes Applied with Principle Citations
- Token Impact Per Transformation
- CoVe Verification Results
- Status: DONE or BLOCKED (with blocking reason if BLOCKED)
</delegation_template>
If agent signals BLOCKED:
If agent signals DONE:
Spawn a SECOND agent (general-purpose, NOT the same agent that optimized) to verify optimization quality.
Verification Template:
ORIGINAL FILE: {path to original}
OPTIMIZED FILE: {path to optimized version}
TASK:
Compare the original and optimized files. Verify:
1. Original intent preserved — no functional behaviors lost
2. Technical terms exact — tool names, file paths, command syntax unchanged
3. Structural conventions maintained — frontmatter format, heading hierarchy intact
4. No regressions introduced — edge cases still handled, constraints still enforced
CONSTRAINTS:
- You have NO context from the optimization process
- Base verification ONLY on comparing the two files
- Report any regressions, ambiguities, or losses of specificity
- Signal PASS if optimization preserves all original intent
- Signal REGRESSION if any functional behavior was lost or technical terms changed incorrectly
OUTPUT:
- Verification Status: PASS or REGRESSION
- Regressions Found (if any) with line number references
- Preserved Behaviors (summary)
Handle verification result:
For all files:
(post - baseline) / baseline * 100For SKILL.md files only:
post - baseline (absolute change)Record metrics for reporting.
Report to user with structure:
## Optimization Report: {filename}
### Baseline Metrics
- Token Count: {N tokens}
- Completeness Score: {X/24} (SKILL.md only)
### Post-Optimization Metrics
- Token Count: {M tokens} ({+/-Y%})
- Completeness Score: {Z/24} (delta: {+/-D}) (SKILL.md only)
### Changes Applied
{List of transformations with principle citations from agent report}
### CoVe Verification Results
{Agent's falsifiable verification questions and answers}
### Independent Verification
- Status: {PASS | REGRESSION}
- {Regression details if any}
### Structural Upgrade Candidates
{Sections that could benefit from decision flows, tables, checklists}
### Before/After Diff
{Diff output showing exact changes}
### Recommendation
{Proceed with optimization | Revise based on regressions | Keep original}
Write optimized content ONLY after user confirms. Do not auto-apply.
For files exceeding TOKEN_WARNING_THRESHOLD (defined in skilllint) or plugin directories, offer iterative optimization:
Pass 1: Structural Changes
Pass 2: Content Optimization
Pass 3: Polish
Convergence: Terminate when completeness score stops improving between passes (delta <1 point) or token reduction plateaus (delta <2%).
When target is a skill directory:
references/ (secondary)When target is a plugin directory:
TOKEN_WARNING_THRESHOLD): Offer iterative mode with multi-pass optimization