From claude-agent-dev
Diagnoses conversation bloat and prunes active context using token diagnostics, rolling summaries, and script-based compaction. Generates a flat key-value state summary file before executing the `/clear` command to reduce active token usage. Trigger on: 'optimize context', 'compress context', 'prune memory', 'reduce tokens', 'context size too large', 'out of tokens', 'compact context', 'clear history', 'cleanup context'. Also triggers when managing long development sessions, handling large file modifications, or resolving memory drift in nested subagent workflows. Always prefer this optimizer over running `/clear` directly when critical task progress and decisions need to be preserved.
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-agent-dev:context-optimizerThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Optimize and prune active conversation context to prevent token limits and context drift. This skill provides systematic diagnostics to sniff context bloat (unignored directories, lockfiles, large source files) and pruning strategies (JSON compaction, traceback log filtering, and rolling summaries) to preserve agent reasoning efficiency in long developer sessions.
Optimize and prune active conversation context to prevent token limits and context drift. This skill provides systematic diagnostics to sniff context bloat (unignored directories, lockfiles, large source files) and pruning strategies (JSON compaction, traceback log filtering, and rolling summaries) to preserve agent reasoning efficiency in long developer sessions.
Phase 1: Diagnose (Run scripts/diagnose_context_bloat.py and /context)
-> Phase 2: Select Strategy (Choose KV compaction, log filtering, or rolling summary)
-> Phase 3: Action (Run scripts/prune_context.py or specify StartLine/EndLine slices)
-> Phase 4: Reset & Reload (Save summary, run /clear, reload summary)
python skills/context-optimizer/scripts/diagnose_context_bloat.py (Use $CLAUDE_PLUGIN_ROOT/ prefix if required)./context to inspect token usage.CLAUDE.md and GEMINI.md link to AGENTS.md instead of full rules text.MANDATORY PREREQUISITE: Before executing Strategy A, B, or Step 3, read references/context-pruning-guidelines.md completely from start to finish (it is under 100 lines, so the global 300-line range-limit rule below does not apply to it).
Select ONE strategy based on diagnostics:
python skills/context-optimizer/scripts/prune_context.py --to-kv < data.jsonpython skills/context-optimizer/scripts/prune_context.py --logs < test_output.loggrep_search, then read ONLY the required lines using StartLine and EndLine.python skills/context-optimizer/scripts/prune_context.py --summary --timestamp "$(date -Iseconds)" --current-skill "<skill-name or gate>" --done "completed items" --blocking "blockers" --next-step "next actions" --decisions "key decisions"/clear..claude/rolling_summary.md and resume the current_skill recorded there directly — do not re-enter using-agent-dev-skills from Gate 0.StartLine and EndLine. Run grep_search first./clear without writing .claude/rolling_summary.md first. Progress will be lost.Next Skills:
planning: Trigger if context reveals major specification gaps.current_skill in the rolling summary: resume it directly.using-agent-dev-skills: Only if no current_skill was recorded (e.g. optimizing before any route was chosen).npx claudepluginhub j0hanz/claude-agent-dev-plugin --plugin claude-agent-devProvides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.