Loading...
Loading...
Set up and optimize context management for any project. Use this skill when the user says "set up context management", "optimize my CLAUDE.md", "context setup", "configure compact instructions", "set up rules", or when starting a new project and wanting best practices for long sessions, memory, compaction, and subagent delegation. Also trigger when the user mentions problems with context loss, compaction losing info, or sessions getting slow.
npx skill4agent add aguirrerjg/skills context-managementpackage.jsonCargo.tomlpyproject.tomlCLAUDE.md.claude/rules/src/tsconfig.json.eslintrcprettier.configREADME.md# [Project Name]
[1-2 sentence description from README/package.json]
## Stack
[Detected stack — language, framework, DB, key libs]
## Key Commands
[Detected from package.json scripts, Makefile, etc.]
- Dev: `[command]`
- Build: `[command]`
- Test: `[command]`
- Lint: `[command]`
## Architecture
[Brief description of src/ structure — max 5-8 lines]
- @[key-file-1] for [purpose]
- @[key-file-2] for [purpose]
## Conventions
[Detected from config files — indent, quotes, semicolons, naming]
## Context Management
### Compact Instructions
When compacting, always preserve:
- List of modified files and their purpose
- Failing tests with error messages
- Architectural decisions made this session
- Current task status and next steps
When compacting, safe to discard:
- File contents that were only read for exploration
- Search results that didn't lead anywhere
- Verbose command output already acted upon
### Subagent Guidelines
- Use Explore agent for codebase searches requiring > 3 queries
- Use background agents for running test suites
- Use Plan agent before refactors touching > 5 files
- Delegate file-heavy research to subagents to protect main context
### Rules
See .claude/rules/ for scoped coding rules..claude/rules/references/rule-templates.md| File | Scope | Creates when |
|---|---|---|
| | Always — general conventions |
| | API routes exist |
| | UI components exist |
| | Test files exist |
| | ORM/DB config exists |
~/.claude/projects/<project-hash>/memory/MEMORY.md# [Project Name] Memory
## Project
- Stack: [detected]
- Key paths: [detected]
## Patterns
[Leave empty — Claude fills as it learns]
## Debugging
[Leave empty — Claude fills as issues arise]Context Management Setup Complete
==================================
CLAUDE.md: [created/updated] (X lines)
Rules: [N] files in .claude/rules/
Memory: [initialized/already exists]
Files created:
- .claude/rules/code-style.md
- .claude/rules/[others...]
Recommendations:
- [Any project-specific suggestions]