Systematic methodology to reduce skill file size through externalization, consolidation, and progressive loading patterns. Triggers: large skill, skill optimization, skill size, 300 lines, inline code, skill refactoring, skill context reduction, skill modularization Use when: skills exceed 300 lines, multiple code blocks (10+) with similar functionality, heavy Python inline with markdown, functions >20 lines embedded DO NOT use when: skill is under 300 lines and well-organized. DO NOT use when: creating new skills - use modular-skills instead. Consult this skill when skills-eval shows "Large skill file" warnings.
/plugin marketplace add athola/claude-night-market/plugin install conservation@claude-night-marketThis skill inherits all available tools. When active, it can use any tool Claude has access to.
tools/optimization-patterns.pySystematic methodology for reducing skill file size while preserving functionality through separation of concerns and strategic code organization.
Symptoms that trigger this skill:
Quick Analysis:
# Analyze any skill file for optimization opportunities
python skills/optimizing-large-skills/tools/optimization-patterns.py \
skills/path/SKILL.md --verbose --generate-plan
Before: 654-line skill with heavy inline Python implementations After: ~150-line skill with external tools and references
Key Changes:
Use analysis tool: python tools/optimization-patterns.py SKILL.md --generate-plan
| Strategy | Impact | When to Use |
|---|---|---|
| Externalize Python modules | 60-70% reduction | Heavy implementations (>20 lines) |
| Consolidate similar functions | 15-20% reduction | Repeated patterns with minor variations |
| Replace code with structured data | 10-15% reduction | Configuration-driven logic |
| Progressive loading patterns | 5-10% reduction | Multi-stage workflows |
skill-name/
SKILL.md # Core documentation (~150-200 lines)
tools/
analyzer.py # Heavy implementations
controller.py # Control logic
config.yaml # Structured data
examples/
basic-usage.py # Minimal working example
# Generate comprehensive optimization plan
python skills/optimizing-large-skills/tools/optimization-patterns.py \
your-skill.md --verbose --generate-plan
# JSON output for automation
python skills/optimizing-large-skills/tools/optimization-patterns.py your-skill.md --output-json
Move heavy implementations to tools with CLI interfaces:
argparse CLI interfaceif __name__ == "__main__" execution blockMerge similar functions with parameterization:
Use frontmatter for focused context loading:
token_budget: 25 for optimized skillsprogressive_loading: true for conditional content<!-- progressive: feature --> blocks for optional sections| Mistake | Why Bad | Fix |
|---|---|---|
| Externalizing without CLI | Hard to use and test | Always include command-line interface |
| Too many small files | Increases complexity | Consolidate related functionality |
| Removing essential docs | Reduces discoverability | Keep core concepts inline |
| Complex dependencies | Hard to maintain | Simple, explicit imports only |
| No usage examples | Unclear how to use tools | Always include working examples |
Violating the letter of the rules is violating the spirit of the rules.
| Excuse | Reality |
|---|---|
| "I'm already halfway through manual editing" | Incomplete work wastes time. |
| Use hybrid approach combining your progress with systematic patterns. | |
| "Deadline is too tight for systematic approach" | Fast, messy work creates more problems. |
| Systematic approach is faster overall when done right. | |
| "Just extract code, keep same structure" | Externalizing without optimization |
| = same problems in different files. Apply full methodology. | |
| "I'll do it properly later" | "Later" never comes. Technical debt accumulates. Do it right now. |
| "This skill is different, needs special handling" | All skills follow same |
| context optimization principles. No exceptions. | |
| "The team lead wants a quick fix" | Quick fixes create long-term problems. |
| Educate with concrete examples of systematic benefits. | |
| "I don't have time to create CLI tools" | CLI tools take 15 minutes, |
| save hours of manual work. Always invest in automation. | |
| "The existing code is already optimized" | If skills-eval flags it as large, |
| it needs optimization regardless of perceived quality. |
All of these mean: Stop. Re-read the skill. Apply the full methodology.
Phase 1: Analysis
Phase 2: Externalization
Phase 3: Consolidation
Phase 4: Validation
Before optimization:
After optimization:
Result: 73% size reduction while preserving all functionality through external tools and progressive loading patterns.
"During the session on 2025-11-27, we discovered that context growth was problematic..."
Don't create fill-in-the-blank templates in the skill itself - put them in examples/
One excellent Python example beats mediocre JavaScript and Go examples.
"For advanced pattern analysis, use tools/analyzer.py with appropriate context data."
Each tool should do one thing well with clear parameters and outputs.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.