← ClaudeAtlas

optimizelisted

Diagnose and reduce Claude Code token usage for a project or session using context hygiene, model and effort routing, MCP minimization, output trimming/sanitizing, subagent discipline, and measurement. Use when the user asks to lower Claude Code token usage, cost, context bloat, or usage-limit burn.
ictechgy/context-guard · ★ 2 · AI & Automation · score 72
Install: claude install-skill ictechgy/context-guard
# ContextGuard Goal: reduce Claude Code token usage without lowering task success quality. Use this order: 1. Measure before changing behavior. - Ask the user to run `/usage` and `/context` if inside Claude Code. - For first-time setup, run `context-guard-setup --plan` and offer `context-guard-setup --yes` for recommended project-local settings. - If transcript files are available, run `context-guard-audit ~/.claude/projects --top 20 --recommend`. - For project configuration/context bloat, run `context-guard-diet scan .`. - For structural waste such as duplicate rules, stale import candidates, oversized tool schemas, or repeated reads in local logs, run `context-guard-diet structural-waste . --json`. 2. Identify the largest bucket: - stale conversation history -> recommend `/clear` between unrelated tasks and focused `/compact` for long tasks. - startup context -> prune `CLAUDE.md`, move long workflows to skills, disable unused MCP servers. - large file reads -> use `context-guard-read-symbol` and the example Read guard before whole-file context. - very large logs that may need later exact slices -> store sanitized output with `context-guard-artifact store` and query only needed lines/patterns. - noisy command output -> use `context-guard-trim-output` wrappers or the example PreToolUse hook; use `context-guard-filter` only with an explicit user-owned config for stable successful command shapes. - grep/diff output with possible secrets -> us