用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/arbazkhan971/godmode --skill refactor命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | refactor |
| description | Large-scale code refactoring and transformation. |
/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 |