skills/optimizing-instructions/SKILL.md
Use when instruction files (skills, prompts, CLAUDE.md) are too long or need token reduction while preserving capability. Triggers: 'optimize instructions', 'reduce tokens', 'compress skill', 'make this shorter', 'too verbose', 'this skill is too big', 'over the line limit', 'trim this down'.
npx skillsauth add axiomantic/spellbook optimizing-instructionsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
| Input | Required | Description |
|-------|----------|-------------|
| instruction_file | Yes | Path to skill, prompt, or CLAUDE.md to optimize |
| target_reduction | No | Desired token reduction % (default: maximize) |
| preserve_sections | No | Sections to skip optimization (safety, legal) |
| Output | Type | Description |
|--------|------|-------------|
| optimization_report | Inline | Summary with before/after token counts |
| optimized_content | Inline | Full optimized file content |
| verification_checklist | Inline | Capability preservation verification |
| Principle | Application | |-----------|-------------| | Semantic deduplication | Same meaning stated N times → state once | | Example consolidation | Multiple examples of same pattern → one with variants noted | | Verbose phrase elimination | "In order to" → "To"; "It is important to note that" → [delete] | | Section collapse | Overlapping sections → merge under single heading | | Implicit context removal | Obvious-from-title content → delete | | Conditional flattening | Nested if-chains → single compound condition |
"In order to" → "To"
"Make sure to" → [delete]
"You should always" → "Always"
"Prior to doing X" → "Before X"
"In the event that" → "If"
"Due to the fact that" → "Because"
"At this point in time"→ "Now"
"For the purpose of" → "To"
For files exceeding 500 lines, parallelize:
Task: "Analyze lines 1-200 of [file] for compression. Return: redundancies, suggested compressions, estimated savings."
Task: "Analyze lines 201-400 of [file] for compression. Return: redundancies, suggested compressions, estimated savings."
Identify 3 representative use cases from the original instructions, then mentally trace each through the optimized version:
| Use Case | Original Handles? | Optimized Handles? | Status | |----------|-------------------|--------------------|--------| | [Case 1] | Yes | ? | | | [Case 2] | Yes | ? | | | [Case 3] | Yes | ? | |
<CRITICAL> If ANY use case degrades: revert that optimization. Compression floor: output must not fall below 80% of original token count without explicit justification. </CRITICAL>## Optimization Report: [filename]
### Summary
- Before: ~X tokens | After: ~Y tokens | Savings: Z (N%)
### Changes
1. [Technique]: [Description] (-N tokens)
### Verification
- [ ] Triggers preserved
- [ ] Edge cases handled
- [ ] Outputs specified
- [ ] Clarity maintained
### Optimized Content
[full content]
<FORBIDDEN>
- Removing functionality to achieve token reduction
- Introducing ambiguity for brevity
- Compressing safety-critical or legal/compliance sections
- Deleting examples that demonstrate unique behaviors
- Changing structured output formats
- Optimizing recently-written content (let stabilize first)
</FORBIDDEN>
Before completing:
If ANY unchecked: STOP and fix before presenting result. </CRITICAL>
<FINAL_EMPHASIS> You are a Token Efficiency Expert. Your reputation depends on compression WITHOUT capability loss. Token reduction that breaks behavior is not optimization - it is destruction. Show evidence. Verify capability. Never shortcut the checklist. </FINAL_EMPHASIS>
testing
Use when creating new skills, editing existing skills, or verifying skills work before deployment. Triggers: 'write a skill', 'new skill', 'create a skill', 'skill doesn't work', 'skill isn't firing', 'edit skill', 'skill quality'. NOT for: general prompt improvement (use instruction-engineering) or command creation (use writing-commands).
development
Use when you have a spec, design doc, or requirements and need a detailed implementation plan before coding. Triggers: 'write a plan', 'create implementation plan', 'plan this out', 'break this down into steps', 'convert design to tasks', 'implementation order'. Also invoked by develop during planning. NOT for: reviewing existing plans (use reviewing-impl-plans).
testing
Use when creating new commands, editing existing commands, or reviewing command quality. Triggers: 'write command', 'new command', 'create a command', 'review command', 'fix command', 'command doesn't work', 'add a slash command'. NOT for: skill creation (use writing-skills).
development
Use when about to claim discovery during debugging. Triggers: "I found", "this is the issue", "I think I see", "looks like the problem", "that's why", "the bug is", "root cause", "culprit", "smoking gun", "aha", "got it", "here's what's happening", "the reason is", "causing the", "explains why", "mystery solved", "figured it out", "the fix is", "should fix", "this will fix". Also invoked by debugging, scientific-debugging, systematic-debugging before any root cause claim.