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...
Rule-section guard. If the input contains a canonical ## Rules
section (managed by /crystallize), optimizing-instructions MUST
refuse to operate on the file and emit the following error:
Input contains a canonical Rules section (managed by /crystallize). Use /crystallize for rule-aware compression.
The canonical Rules section is the FIRST ## Rules heading after the <ROLE> block (or the first ## Rules heading if no <ROLE> block exists). Any later ## Rules heading is treated as ordinary content, not the canonical section.
Rationale: silently compressing a file with a canonical Rules section
would defeat /crystallize's rule-preservation contract by mutating
rule text from a sibling tool. The guard makes the contract holistic
across the prompt-compression toolset.
| 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 | ? |
## 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]
Before completing:
If ANY unchecked: STOP and fix before presenting result.