token-optimization
Skill4 starsChanged 29 days agoMITView on GitHub
Token-aware patterns for efficient context usage. Activates when working on long sessions, large codebases, or when context pressure is detected. Provides strategies for reducing token consumption while maintaining quality.
10 other projects use a version of this.
Adopted by
Most recently taken up by
- QSOLKCB/CLAUDE-SKILLS-AGItheir own version, first seen Nov 8, 2026
- OpenxIntelligence/Coding-Agent-Skillsword for word, first seen Nov 1, 2026
- okfriansyah-moh/agentic-workflowtheir own version, first seen Oct 25, 2026
- andrewalhaj/custom-hermesagenttheir own version, first seen Oct 20, 2026
- bm629/agent-skillstheir own version, first seen Aug 21, 2026
- Hassaan146/claude-skillstheir own version, first seen Jul 25, 2026
Other versions10 projects use a version of this.
Word for word · 1
- OpenxIntelligence/Coding-Agent-Skills★ 4100% same
Edited · 0
None found.
Wrote their own version · 9
- cwinvestments/memstack★ 425same name
- Hassaan146/claude-skills★ 18same name
- bm629/agent-skills★ 2same name
- cheukswiss/etdxm★ 2same name
- QSOLKCB/CLAUDE-SKILLS-AGI★ 1same name
- andrewalhaj/custom-hermesagent★ 0same name
- ESUnternehmensberatung/ClaudeCode★ 0same name
- muxammadmamajonov/dot-claude★ 0same name
- okfriansyah-moh/agentic-workflow★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository169 other files it gives its agents.
- epub-skill/CLAUDE.mdCLAUDE.md
- linear-cli-skill/CLAUDE.mdCLAUDE.md
- AgentDB Advanced FeaturesSkill
- AgentDB Learning PluginsSkill
- AgentDB Memory PatternsSkill
- AgentDB Performance OptimizationSkill
- AgentDB Vector SearchSkill
- agent-evalSkill
- agentic-jujutsuSkill
- agile-product-ownerSkill
- ai-tool-pickerSkill
- algorithmic-artSkill
- api-connectorSkill
- api-design-patternsSkill
- architecture-diagram-creatorSkill
- article-extractorSkill
- aws-agentic-aiSkill
- aws-cdk-developmentSkill
- aws-cost-operationsSkill
- aws-serverless-edaSkill
- biogeobearsSkill
- brainstormingSkill
- brand-guidelinesSkill
- canvas-designSkill
- capa-officerSkill
- ceo-advisorSkill
- changelog-generatorSkill
- code-auditorSkill
- codebase-documenterSkill
- code-executionSkill
- code-explainerSkill
- code-refactorSkill
- code-reviewerSkill
- code-transferSkill
- content-creatorSkill
- content-research-writerSkill
- conversation-analyzerSkill
- csv-data-summarizerSkill
- cto-advisorSkill
- d3-vizSkill
- dashboard-creatorSkill
- defense-in-depthSkill
- deploy-itSkill
- developer-growth-analysisSkill
- dispatching-parallel-agentsSkill
- doc-coauthoringSkill
- docxSkill
- domain-name-brainstormerSkill
- dwa-councilSkill
- error-fixerSkill
- escalation-reasoningSkill
- evaluator-optimizerSkill
- executing-plansSkill
- extract-from-pdfsSkill
- fda-consultant-specialistSkill
- feature-planningSkill
- file-operationsSkill
- file-organizerSkill
- finishing-a-development-branchSkill
- firebase-buddySkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 6 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 7 edited versions we read keep these.
6
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 22
Avoid complex work at: >80% capacity
- Distinctive: line 36
Instead of loading everything upfront:
- Distinctive: line 43
Use efficient search patterns:
- Distinctive: line 76
Only enable needed MCP servers per session
- Very specific: line 78
Use claude mcp list to audit
- Distinctive: line 98
Check decision-audit.jsonl for context
- Distinctive: line 144
Work: Add context as needed
“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Token Optimization Skill
When This Skill Activates
This skill provides methodology for efficient token usage:
- Long-running sessions approaching context limits
- Large codebase exploration
- Multiple file modifications
- Complex multi-step tasks
Token Awareness
Context Budget
- Total context: ~200K tokens
- Practical limit: ~160K (leave buffer)
- Compact at: 70% capacity
- Avoid complex work at: >80% capacity
Token Costs (Approximate)
| Content | Tokens |
| 1 line code | ~10-20 |
| 1 page text | ~500 |
| Average file | ~500-2000 |
| CLAUDE.md | ~3000 |
| Full conversation | Grows rapidly |
Optimization Strategies
1. Progressive Disclosure
Instead of loading everything upfront:
Bad: Read all 50 files at once
Good: Read index → identify relevant → read specific2. Targeted Search
Use efficient search patterns:
Bad: Read entire directory tree
Good: Glob pattern → Grep specific → Read matches3. Minimal Context
Include only what's needed:
Bad: Include entire file for small change
Good: Include function + surrounding context4. Structured Summaries
For long outputs:
Bad: Full test output (10K tokens)
Good: Summary + key failures (500 tokens)5. Timely Compaction
Monitor and compact proactively:
Bad: Wait for "Context low" warning
Good: Compact at 70% after task completionMCP Token Management
Problem: MCP Server Token Drain
MCP tools can consume 30-60K tokens before conversation starts.
Solution: Selective Loading
- Only enable needed MCP servers per session
- Disable unused servers when not needed
- Use
claude mcp listto audit
Memory Server Strategy
| Server | When to Use |
| memory-keeper | Session continuity, compaction recovery |
| server-memory | Long-term key-value storage |
| Neither | Short, focused tasks |
Compaction Strategy
Pre-Compaction Checklist
- ✅ Critical context saved to memory MCP
- ✅ Important decisions documented
- ✅ Current task state captured
- ✅ Key file paths noted
Post-Compaction Recovery
- Load context from memory MCP
- Re-read critical files if needed
- Check decision-audit.jsonl for context
- Resume task from documented state
Code Patterns
Efficient File Operations
# Bad: Read all then filter
for f in all_files:
content = read(f)
if "pattern" in content:
process(f)
# Good: Search first then read
matches = grep("pattern", all_files)
for f in matches:
content = read(f)
process(f)Efficient Updates
# Bad: Full file replacement
content = read(file)
new_content = content.replace(old, new)
write(file, new_content)
# Good: Targeted edit
edit(file, old_string=old, new_string=new)Efficient Exploration
# Bad: Deep recursive exploration
explore_all_directories(root)
# Good: Breadth-first with limits
list_top_level(root)
identify_relevant_dirs()
explore_targeted(relevant_only)Session Management
Long Session Strategy
- Start: Load minimal context
- Work: Add context as needed
- Checkpoint: Save state periodically
- Compact: At 70% or task completion
- Recover: Restore from checkpoint
Task Batching
Bad: One massive continuous session
Good: Multiple focused sessions with clear handoffsIntegration with Hooks
Pre-Compact Hook
Automatically triggered when context low:
- Backs up transcript
- Creates recovery index
- Logs compaction event
Session Start Hook
Restores context efficiently:
- Loads minimal git status
- Checks for recovery context
- Provides continuation hints
Metrics to Monitor
Track these for optimization:
- Session length before compaction
- Files read per task
- Tool calls per operation
- Recovery success rate
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

