context-management
Manage Claude Code sessions effectively. Use during long sessions, multi-step tasks, or when responses start degrading. Covers /clear, checklists, and subagents.
What this skill does
# Context Management Skill ## Trigger Use during long sessions, multi-step tasks, or when Claude's responses start degrading in quality. ## The Insight From Anthropic's Claude Code best practices: "Regularly reset context between tasks to prevent irrelevant conversation and file contents from degrading performance." ## Why Context Matters - Claude has limited context window - Old, irrelevant content crowds out useful information - Accumulated context from failed approaches confuses new attempts - Fresh context = better responses ## Techniques ### 1. Use `/clear` Between Tasks After completing a task, before starting a new one: ``` /clear ``` This resets the conversation while keeping: - CLAUDE.md instructions - Project context - Tool permissions **When to clear:** - Switching to unrelated task - After a complex debugging session - When responses feel "confused" - Before important implementations ### 2. Checklists for Large Tasks For migrations, bulk fixes, or multi-file changes: ```markdown ## Migration Checklist ### Completed - [x] Update User model - [x] Update User service - [x] Update User controller ### In Progress - [ ] Update User tests ← CURRENT ### Remaining - [ ] Update API documentation - [ ] Update client SDK - [ ] Run full test suite ``` Have Claude maintain this checklist: - Update after each step - Verify completion before proceeding - Track what's done vs remaining ### 3. Course Correction Tools **Escape to interrupt:** - Press `Escape` once to stop current generation - Useful when Claude is going down wrong path **Double-tap Escape to edit:** - Press `Escape` twice to edit your previous prompt - Explore alternate directions without losing context **Request undo:** ``` Undo the last change to user-service.ts ``` ### 4. Subagents for Investigation Early in complex tasks, use subagents to investigate details: ``` Use a subagent to research how error handling is done in this codebase. Report back the patterns found. ``` Benefits: - Preserves main conversation context - Subagent does deep investigation - Main context gets summarized findings ### 5. Explicit Context Boundaries Tell Claude what's relevant and what isn't: ``` Forget about the authentication changes we discussed earlier. Focus only on the new payment integration. The relevant files are: - src/payments/ - src/api/checkout.ts ``` ## Signs You Need to Manage Context | Symptom | Solution | |---------|----------| | Claude references old, abandoned approaches | `/clear` | | Responses getting slower | `/clear` or reduce file reads | | Claude confused about current state | Summarize current state explicitly | | Repeating the same mistakes | Clear and re-explain requirements | | Losing track of multi-step task | Use checklist | ## Checklist Template for Large Tasks ```markdown ## Task: [Migration/Refactor/Bulk Fix Name] ### Overview [Brief description of the full task] ### Progress Tracking #### Phase 1: [Name] - [ ] Step 1.1 - [ ] Step 1.2 - [ ] Step 1.3 #### Phase 2: [Name] - [ ] Step 2.1 - [ ] Step 2.2 #### Phase 3: [Name] - [ ] Step 3.1 - [ ] Step 3.2 ### Current Focus [Which item is being worked on NOW] ### Blocked Items [Items waiting on something] ### Verification - [ ] All tests pass - [ ] Manual verification complete - [ ] Ready for review ``` ## Anti-Patterns **Don't:** - Keep adding to context indefinitely - Assume Claude remembers everything from 50 messages ago - Debug the same issue repeatedly without clearing - Mix multiple unrelated tasks in one session **Do:** - Clear between distinct tasks - Summarize context when resuming - Use checklists for tracking - Interrupt early when going off track
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.