templates/skills/strategic-compact/SKILL.md
Suggest manual /compact at logical workflow boundaries instead of relying on arbitrary auto-compaction. Use when the session approaches context limits, after completing a major milestone, when switching between unrelated tasks, or when responses become less coherent due to context pressure. Pairs with the suggest-compact.sh hook for automated threshold detection.
npx skillsauth add samwang0723/claudecode-setup strategic-compactInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Suggest manual /compact at logical workflow boundaries to preserve important context through task phases, rather than relying on auto-compaction that triggers at arbitrary points mid-task.
Check these indicators:
| Indicator | Action | |-----------|--------| | 50+ tool calls in session (hook fires) | Evaluate current phase before compacting | | Transitioning from research → implementation | Compact — research context is bulky, plan is the distilled output | | Just finished debugging a complex issue | Compact — debug traces pollute context for next task | | Mid-implementation with active changes | Do NOT compact — losing file paths, variable names, and partial state is costly | | Switching to an unrelated task | Compact — clear stale context before new focus |
| Phase Transition | Compact? | Reason | |-----------------|----------|--------| | Research → Planning | Yes | Research context is bulky; plan is the distilled output | | Planning → Implementation | Yes | Plan is in TodoWrite or a file; free up context for code | | Implementation → Testing | Maybe | Keep if tests reference recent code; compact if switching focus | | Debugging → Next feature | Yes | Debug traces pollute context for unrelated work | | Mid-implementation | No | Losing variable names, file paths, and partial state is costly | | After a failed approach | Yes | Clear the dead-end reasoning before trying a new approach |
Before running /compact, save critical context:
~/.claude/memory//compact Focus on implementing auth middleware next| Persists | Lost |
|----------|------|
| CLAUDE.md instructions | Intermediate reasoning and analysis |
| TodoWrite task list | File contents previously read |
| Memory files (~/.claude/memory/) | Multi-step conversation context |
| Git state (commits, branches) | Tool call history and counts |
| Files on disk | Nuanced user preferences stated verbally |
The suggest-compact.sh script (bundled with this skill) tracks tool calls and suggests compaction at configurable thresholds. Add to ~/.claude/settings.json:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Edit|Write",
"hooks": [{ "type": "command", "command": "~/.claude/skills/strategic-compact/suggest-compact.sh" }]
}
]
}
}
Configure via environment variable: COMPACT_THRESHOLD (default: 50 tool calls before first suggestion, then every 25 calls after).
~/.claude/rules/ and project .claude/rules/development
Generate a technical specification document using the DDD template in template.md. Use when the user says 'write tech spec', 'create tech spec', 'technical specification', or needs a structured design document for a new feature or major change covering architecture, domain models, APIs, data design, security, and operations.
testing
Write a Product Requirements Document (PRD) using the standard TMAB template with stakeholders, user stories (Given-When-Then), success metrics, and A/B testing plans. Use when the user asks to write a PRD, create product requirements, document a feature spec, or plan a new product feature.
data-ai
Clean up an agent team. Removes team resources, optionally cleans worktrees and branches. Use after team work is complete and merged. Use when told to "stop team", "cleanup team", "disband team".
testing
Check progress of an active agent team. Shows member status, completed tasks, pending work, and any messages. Use when asked "team status", "how's the team", "check team progress", "team update".