optimizing-context
Audits and optimizes context, memory, and skill use for projects. Reviews CLAUDE.md files, .claude/rules/, and skill configurations for efficiency. Use when context feels bloated, skills aren't triggering correctly, or memory needs organization.
When & Why to Use This Skill
The Optimizing Context skill is a specialized utility designed to audit and refine an agent's project memory, context window usage, and skill configurations. It systematically reviews CLAUDE.md files, project rules, and skill definitions to eliminate redundancy, reduce token consumption, and ensure that skills trigger reliably, leading to more efficient and accurate AI interactions.
Use Cases
- Context Window Optimization: Use this skill when the conversation context feels bloated or inefficient, helping to prune unnecessary data and prioritize essential information for better performance.
- Skill Trigger Troubleshooting: Resolve issues where specific skills aren't activating as expected by auditing and improving their descriptions and trigger conditions for maximum clarity.
- Project Initialization: Streamline the setup of new coding projects by establishing a clean, organized, and high-performance memory structure from the outset.
- Rule Maintenance: Periodically review and consolidate .claude/rules and CLAUDE.md files to prevent instruction overlap and maintain a concise set of project guidelines.
- Memory Consolidation: Audit local and global memory files to ensure project-specific information is correctly categorized, reducing noise in the agent's working memory.
| name | optimizing-context |
|---|---|
| description | Audits and optimizes context, memory, and skill use for projects. Reviews CLAUDE.md files, .claude/rules/, and skill configurations for efficiency. Use when context feels bloated, skills aren't triggering correctly, or memory needs organization. |
| allowed-tools | Read, Glob, WebFetch, Write |
Optimizing Context
Audit and optimize how context, memory, and skills are configured.
When to Use
- Context window feels cluttered or inefficient
- Skills aren't triggering as expected
- CLAUDE.md or rules need review
- Starting a new project and setting up memory
- Periodic maintenance of existing configurations
Audit Process
- Inventory - List all memory files and skills
- Review - Check each for conciseness and relevance
- Identify - Find redundancy, verbosity, or gaps
- Recommend - Suggest specific optimizations
- Implement - Apply changes with user approval
What to Check
| Component | Location | Look For |
|---|---|---|
| Project memory | CLAUDE.md |
Verbosity, outdated info, missing essentials |
| Local memory | CLAUDE.local.md |
Personal prefs that should be global |
| Rules | .claude/rules/*.md |
Overlap, poor organization, missing globs |
| Skills | .claude/skills/*/SKILL.md |
Unclear descriptions, excessive content |
| User memory | ~/.claude/CLAUDE.md |
Project-specific content that doesn't belong |
Key Principles
- Concise is key - Every token competes for context space
- Progressive disclosure - Link to details, don't inline everything
- One level deep - Avoid nested file references
- Specific descriptions - Skills need clear triggers in descriptions
Reference Documentation
For detailed guidance, visit these pages:
- Memory management: https://code.claude.com/docs/en/memory
- Skill authoring: https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices
- Claude Code best practices: https://www.anthropic.com/engineering/claude-code-best-practices
Audit Report Format
Context Audit: [project name]
Date: [date]
Memory Files:
- [file]: [status] - [notes]
Skills:
- [skill]: [status] - [notes]
Issues Found:
1. [issue] → [recommendation]
Optimizations Applied:
- [change made]