com um clique
gum-optimize
Analyze agent context and optimize GUM modules for better compliance
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Menu
Analyze agent context and optimize GUM modules for better compliance
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Baseado na classificação ocupacional SOC
Create a new GUM module with rules and optional hooks
Edit an existing GUM module — update rules, hooks, or settings
GUM reference and usage guide
Sync GUM modules in the current session after toggle, create, edit, or remove
Show active GUM modules and their rules in the current session
| name | gum-optimize |
| description | Analyze agent context and optimize GUM modules for better compliance |
This skill performs a deep analysis of your ENTIRE agent context -- every GUM module, every CLAUDE.md, every rule file -- and finds problems: bloat, vagueness, conflicts, and missed automation opportunities. This is the LLM-powered audit. It reads everything, diagnoses everything, and offers to fix everything on the spot.
Announce at start: "I'm using the gum-optimize skill to audit your full agent context."
READ EVERYTHING BEFORE DIAGNOSING ANYTHING.
You MUST read ALL sources before presenting a single finding. Partial reads produce partial (wrong) diagnoses. No shortcuts.
Use this ESPECIALLY when:
Don't skip when:
You MUST read every single one of these. Skipping any source means missed findings.
npx get-gum list --gum-dir ~/.gum via Bash — get all modules and their statusnpx get-gum doctor --gum-dir ~/.gum via Bash — get context budget and integrity report~/.claude/rules/gum/*.md — these are the active module rules (auto-loaded, no permission needed)./CLAUDE.md (if exists) — rules that should be GUM modules~/.claude/CLAUDE.md (if exists) — global rules that should be GUM modules.claude/rules/*.md (if any) — additional rule filesRead ALL of them. Then proceed.
Count total lines across ALL rules sources (rules.md files + CLAUDE.md files + .claude/rules/*.md).
| Lines | Status | Action |
|---|---|---|
| < 100 | Healthy | No action needed |
| 100-150 | Warning | Suggest trimming vague or redundant rules |
| > 150 | Over budget | MUST reduce. Agent compliance drops sharply above 150 lines |
"Your total context is 187 lines across 6 sources. This is over budget -- agent compliance drops significantly above 150 lines. Here are the largest contributors..."
Flag rules that are too vague to be actionable. The agent cannot reliably follow what it cannot concretely interpret.
Red flags:
For each vague rule, suggest a specific replacement:
| Vague Rule | Specific Replacement |
|---|---|
| "Write clean code" | "Functions MUST be under 30 lines. Extract helper functions when exceeding this limit." |
| "Follow best practices" | DELETE -- means nothing. Replace with the specific practices you want. |
| "Be careful with error handling" | "All async functions MUST have try/catch. Use custom error classes, never throw raw strings." |
| "Use good naming" | "Variables describe their content (e.g., userCount not n). Functions describe their action (e.g., fetchUserProfile not getData)." |
Detect contradictions between enabled modules. These cause unpredictable agent behavior -- the agent picks one arbitrarily or tries to satisfy both and fails at both.
Common conflict patterns:
For each conflict:
"CONFLICT:
testing-standardssays 'use jest' butmodern-toolingsays 'use vitest'. These cannot both be followed. Options:
- Disable one module
- Merge into a single module with a clear decision
- Scope them to different projects via .gum.json overrides"
Scan all rules.md files for mechanical rules that should be hooks.
Indicators a rule should be a hook:
For each candidate:
"PROMOTION CANDIDATE:
team-standardshas rule 'Always run prettier after editing files'. This is mechanical -- converting to a PostToolUse hook gives 100% enforcement (currently ~70% as a rule). Want me to promote it?"
Scan CLAUDE.md files for rules that are better as GUM modules.
Why migrate:
Migration candidates:
"Your project CLAUDE.md has 12 lines about testing standards. These are portable -- they'd work in any project. Want me to create a
testing-standardsGUM module from them and remove them from CLAUDE.md?"
Group findings by severity:
=== CRITICAL (breaks compliance) ===
1. Context over budget: 187/150 lines
2. CONFLICT: jest vs vitest in two modules
=== RECOMMENDED (improves compliance) ===
3. 3 mechanical rules should be hooks
4. 8 lines in CLAUDE.md are portable → GUM module candidates
=== ADVISORY (nice to have) ===
5. 2 vague rules could be more specific
6. 1 disabled module can be removed from registry
For EVERY finding, offer to execute the fix immediately:
"Want me to fix any of these? I can handle them one at a time, or all at once."
After any changes to module files, run npx get-gum sync via Bash to apply them.
npx get-gum list and npx get-gum doctor via Bash for module infonpx get-gum sync after any module file changes~/.gum/registry.json -- use CLI commands| Anti-Pattern | Why It's Wrong | Do This Instead |
|---|---|---|
| Reading only GUM modules, skipping CLAUDE.md | Misses half the context and all migration opportunities | Read ALL sources listed in Phase 1 |
| Estimating line counts | "About 120 lines" might actually be 160 (over budget) | Count precisely |
| Listing problems without fixes | User knows something is wrong but not how to fix it | Every finding MUST have an actionable suggestion |
| Fixing without asking | User may disagree with the suggestion | Present findings, offer to execute, wait for approval |
| Checking one module at a time | Misses cross-module conflicts entirely | Read all modules, then analyze holistically |
| Ignoring disabled modules | They still consume registry space; may conflict if re-enabled | Note disabled modules, suggest cleanup |
Example: Full audit flow
User: "Optimize my GUM setup"
Agent: "I'm using the gum-optimize skill to audit your full agent context."
Agent: *reads registry (5 modules), reads all rules.md files, reads hooks.json
files, reads ./CLAUDE.md, reads ~/.claude/CLAUDE.md, reads .claude/rules/*
— total: 8 sources read*
Agent: "Audit complete. Here are my findings:
=== CRITICAL ===
1. Context over budget: 163/150 lines across 5 modules + CLAUDE.md
2. CONFLICT: `code-style` says 'use tabs' but `team-v2` says 'use 2-space indent'
=== RECOMMENDED ===
3. PROMOTION: `code-style` has 'run prettier after edits' — should be a hook
4. MIGRATION: ./CLAUDE.md has 15 lines about testing that match your
`enforce-tdd` module — redundant duplication
5. PROMOTION: `deploy-checks` has 'always run build before push' — should be a hook
=== ADVISORY ===
6. VAGUE: `code-style` has 'write clean code' — not actionable
7. DISABLED: `old-linting` is disabled and can be removed from registry
Fixing #1-5 would bring you to ~115 lines (well within budget) and add
2 hooks for 100% enforcement. Want me to start fixing these?"