refactor-plan
PRODUCES a refactoring plan ONLY -- impact analysis, step ordering, risk, rollback -- NO code changes. NOT for executing refactors (use functional-design) or dependency upgrades (use deps-check).
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-11
- Stars
- ★ 8
- Forks
- 5
01 前言 Front Matter
- docs
- { "status": "reviewed", "updated": 1785974400000, "source_sha": "5d88f40704d6" }
- name
- refactor-plan
- owner
- swarmery-core
- version
- 1.0.0
- description
- PRODUCES a refactoring plan ONLY -- impact analysis, step ordering, risk, rollback -- NO code changes. NOT for executing refactors (use functional-design) or dependency upgrades (use deps-check).
- allowed-tools
- Read, Grep, Glob
- disable-model-invocation
- true
02 资源文件 2
- 参考文档resources/plan-template.md3.8 KB
- 参考文档resources/planning-procedure.md7.2 KB
03 SKILL.md 正文
Purpose
Generate a structured refactoring plan for a proposed code change: current state, cross-repo impact, step-by-step migration order, risks, and rollback. The output is a markdown document reviewed before execution — this skill plans only, never edits code. Success: every cited file was found via Grep/Glob, all affected repos in every stack language are covered, and the rollback is executable without interpretation.
Rules (never violate)
- Read-only: Read/Grep/Glob only — no file is ever modified.
- Every file cited in the plan is a real Grep/Glob result, never a guess.
- Blast radius over 50 files → stop and escalate to the user before continuing.
- Save the plan to the workspace task dir (
.../plan/README.md), never inside a code repo. - Rollback must be specific — commit references, migration file names, revert order.
- Schema changes go through migrations (landing before dependent code), never manual DDL.
Resources
- Read
resources/planning-procedure.mdwhen building the plan: the 7-step procedure with checkpoints, self-check, mistakes, escalation triggers, and what to surface. - Read
resources/plan-template.mdwhen writing the output: the template, save-location contract, length budget, a full worked rename example, and failure modes.
How to use
What it does
Writes a refactoring plan for a change you are considering — and nothing else. It greps the codebase for every real reference, maps which repos and files are hit, orders steps so nothing lands before its dependency, names the risks, and spells out how to undo each step, all for review before anyone touches code.
When to use it
- Renaming a type, table, or module and needing to know how far the change reaches.
- Extracting shared logic or splitting a module across repo boundaries.
- Changing a streamed (WebSocket/SSE) message format between producer and consumer; migrating one pattern to another across many files.
Not for: executing refactors (functional-design), dependency bumps (deps-check), one-line fixes, or release/environment rollback (the project's infra pack skills).
How to invoke
Skill(skill: "core:refactor-plan")
State the refactoring goal, the repos in scope (defaults to all project.json → repos), and any constraints (freeze windows, untouchable areas).
Worked example
Skill(skill: "core:refactor-plan")
"Rename the legacy_entity table and every reference to device,
across apps/<mainApp> and the edge repo."
The skill greps both repos and finds 47 references in 23 files plus 8 in the edge service. The plan orders the migration first, then the ORM schema, the API route directory, imports and tests; flags that renaming the public route breaks external callers, proposes an alias, and names the exact revert migration in the rollback.
Related
monorepo-coordination (cross-repo merge ordering), functional-design (execute instead of plan), migration-check (verify an introduced migration), code-standards (conventions while executing).
04 同仓库更多 Skills
short-desc
Too short.
no-frontmatter
暂无简介
global-skill
Fixture global skill (minimal user-scope shape, format doc §2.3).
documented-skill
Fixture skill whose usage guide deliberately omits the Worked example subsection.
z
NOT auto-discovered — only skills/ is scanned for plugins (§2.2).
y
Plugin skill y from toolpack — stored as "toolpack:y".