con un clic
strategic-compact
// Suggests manual context compaction at logical intervals to preserve context through task phases rather than arbitrary auto-compaction.
// Suggests manual context compaction at logical intervals to preserve context through task phases rather than arbitrary auto-compaction.
Automatically extract reusable patterns from Claude Code sessions and save them as learned skills for future use.
Patterns for providing structured feedback that closes the loop between implementation and requirements. Use when closing issues, documenting implementation decisions, or updating specs with learnings.
Patterns for breaking specs into atomic issues with proper dependency graphs and execution ordering. Use when planning implementation of a spec or organizing complex work.
Patterns for writing effective specs that capture user intent, design decisions, and requirements clearly. Use when creating or updating specs to ensure quality and completeness.
Use when starting implementation tasks, planning features, or managing multi-session work. Enforces spec-first development with proper issue tracking and feedback loops. Integrates sudocode specs/issues with Claude Code's native task system.
Use this skill when writing new features, fixing bugs, or refactoring code. Enforces test-driven development with 80%+ coverage including unit, integration, and E2E tests. Integrates with sudocode for issue tracking and feedback.
| name | strategic-compact |
| description | Suggests manual context compaction at logical intervals to preserve context through task phases rather than arbitrary auto-compaction. |
Suggests manual /compact at strategic points in your workflow rather than relying on arbitrary auto-compaction.
Auto-compaction triggers at arbitrary points:
Strategic compaction at logical boundaries:
The suggest-compact.sh script runs on PreToolUse (Edit/Write) and:
Add to your ~/.claude/settings.json:
{
"hooks": {
"PreToolUse": [{
"matcher": "tool == \"Edit\" || tool == \"Write\"",
"hooks": [{
"type": "command",
"command": "~/.claude/skills/strategic-compact/suggest-compact.sh"
}]
}]
}
}
Environment variables:
COMPACT_THRESHOLD - Tool calls before first suggestion (default: 50)The sudocode workflow has natural compaction boundaries:
Phase 1: Capture (Spec) ← Compact AFTER creating spec
Phase 2: Plan (Issue) ← Compact AFTER planning issues
Phase 3: Execute (Tasks) ← DON'T compact mid-implementation
Phase 4: Close (Feedback) ← Compact AFTER closing issue
Good times to compact:
After spec creation
.sudocode/specs/show_specAfter issue planning
ready will show what to work onAfter closing an issue
Bad times to compact:
Mid-implementation
Before providing feedback
While debugging
Update the compaction suggestion to check sudocode state:
# In suggest-compact.sh, add check:
CURRENT_ISSUE=$(sudocode issue list --status=in_progress --format=count 2>/dev/null)
if [ "$CURRENT_ISSUE" -gt 0 ]; then
echo "⚠️ Issue in progress - consider completing before compact"
else
echo "✓ No issue in progress - safe to compact"
fi
Since sudocode persists context, after compaction you can restore:
1. /compact
2. ready # See available work
3. show_issue <id> # Reload issue context
4. show_spec <linked-spec> # Reload requirements
5. Continue implementation
Key context survives in:
.sudocode/specs/ - All spec content.sudocode/issues/ - Issue state and relationships