npx claudepluginhub arbazkhan971/godmodeThis skill uses the workspace's default tool permissions.
Designs and optimizes AI agent action spaces, tool definitions, observation formats, error recovery, and context for higher task completion rates.
Enables AI agents to execute x402 payments with per-task budgets, spending controls, and non-custodial wallets via MCP tools. Use when agents pay for APIs, services, or other agents.
Compares coding agents like Claude Code and Aider on custom YAML-defined codebase tasks using git worktrees, measuring pass rate, cost, time, and consistency.
/godmode:refactor, "refactor this", "clean up"find . -name "*.ts" -o -name "*.js" -o -name "*.py" \
| xargs wc -l | sort -rn | head -20
grep -rn "<pattern>" --include="*.ts" --include="*.js"
Target: <file or module>
Lines: <N> | Complexity: <cyclomatic> | Coverage: <N%>
Dependents: <N files> | Risk: LOW|MEDIUM|HIGH|CRITICAL
Risk levels:
IF coverage < 60%: write characterization tests first. IF dependents > 30: use strangler pattern migration.
Extract (Function, Class, Interface, Module, Variable, Parameter), Inline (Function, Variable), Move (Function, Field), Rename (Symbol, File), Simplify (Conditional, Loop, Guard Clause), Replace (Inheritance with Composition, Conditional with Polymorphism).
grep -rl "<symbol>" --include="*.ts" --include="*.js"
Map directly affected (modified), indirectly affected (imports changed), and not affected files.
npm test 2>&1 | tail -10
npx jest --testPathPattern="<target>" 2>&1
IF coverage < 60%: STOP, write characterization tests, commit them separately, then proceed.
One transformation per commit. For each step:
"refactor: <pattern> -- <desc>"IF tests fail after transformation: revert first, then diagnose. Never debug forward.
Strangler pattern: create new alongside old, migrate dependents one at a time, each migration = separate commit, remove old code only after zero references.
IF >5 dependents: phase the migration over multiple PRs.
npm test
Compare: test count same or higher, coverage same or higher, no behavior change. Report pattern used, commits, files modified/created/deleted.
Cyclomatic: <= 10/function (eslint, radon, gocyclo)
Cognitive: <= 15/function (SonarQube, eslint sonarjs)
LOC: <= 50/function (wc -l)
Append .godmode/refactor.tsv:
timestamp target pattern tests_before tests_after coverage_before coverage_after status
KEEP if: tests pass AND complexity reduced
AND coverage maintained or increased.
DISCARD if: tests fail OR complexity unchanged
OR coverage dropped.
STOP when FIRST of:
- All targets below thresholds
(cyclomatic <= 10, cognitive <= 15)
- Test count and coverage same or higher
- Zero dead code detected
On failure: git reset --hard HEAD~1. Never pause.
| Failure | Action |
|---|---|
| Tests fail after transform | Revert, plan smaller step |
| Coverage decreases | Write tests before continuing |
| Circular dependency | Extract shared into new module |