refactor
Code improvement workflow with polish and overhaul tracks. Triggers: 'refactor', 'clean up', 'restructure', 'reorganize', or /refactor. The skill explores…
от lvlup-sw★ 19 звёзд на GitHub
Установить refactor в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Refactor Workflow Skill
Overview
Two-track workflow for improving existing code. The polish track is for small, contained refactors. The overhaul track is for architectural changes and migrations. Both tracks explore before they commit, and both update the documentation.
The exploration, the track choice and the brief are harness work before the first Remit call. The brief is the design record, and its typed plan holds a workflow block with the track and the scope assessment. Then the workflow makes two Remit calls:
remit preparestarts the workflow from the approved plan. Its bootstrap recordsexploreandbrief, and the workflow starts atpolish-implementoroverhaul-delegate. On the overhaul track, the delegate skill makes this call.remit settlejudges the task claims, the documentation claim and, on the overhaul track, the critic claim. It walks the workflow tocompletedin one commit.
There is no phase verb.
Triggers
Activate this skill when:
- User runs
refactorcommand - User wants to improve existing code structure
- User mentions "refactor", "restructure", "clean up", "migrate"
- User asks to "move", "extract", "rename", or "reorganize" code
Disambiguation: use refactor when the code works but needs structural improvement. Use debug when something is broken (error, crash, wrong behavior).
| Signal | Use refactor | Use debug |
|---|---|---|
| Code works but is messy or complex | Yes | No |
| Something is broken or wrong | No | Yes |
| "This should be reorganized" | Yes | No |
| Users report a bug or regression | No | Yes |
| SOLID violations in working code | Yes | No |
Step 1: Explore and select the track
Use references/explore-checklist.md to list the files and modules that change, the test coverage of the affected area and the documentation to update. Then select the track with this rule:
| Measure | Polish | Overhaul |
|---|---|---|
| Files affected | 5 or fewer | More than 5 |
| Top-level modules affected | 1 | More than 1 |
Any overhaul measure selects overhaul. The user can force a track with --polish or --overhaul. Write the result as one sentence, the scope assessment, for example "Four files in src/auth, no public API change."
| Aspect | Polish | Overhaul |
|---|---|---|
| Scope | 5 files or fewer, one concern | No limit |
| Tasks | One task, done in the session | A task graph, dispatched to workers |
| Review | Integration suite only | Integration suite and one critic review |
| Documentation | Documentation claim | Documentation claim |
| Synthesis | None: the workflow completes after the documentation | Synthesis boundary, then a PR |
Step 2: Write the brief and the typed plan
The brief is the design record at docs/specs/YYYY-MM-DD-refactor-<slug>.md. Structure its Design & Rationale with references/brief-template.md, and write its plan with @skills/plan/references/spec-template.md:
- Polish: one task, at
thindepth. - Overhaul: a task graph at
standarddepth. Load@skills/plan/SKILL.mdwith the refactor record path and depth.
Add the workflow block:
{ "track": "polish", "scopeAssessment": "Four files in src/auth, no public API change." }
Design-time constraints. Before you commit to an approach, surface a Constraints section anchored to the invariants that apply to the refactor. The selection rules are in @skills/ideate/references/constraint-anchoring.md. Load .remit/invariants.md (the cost-of-load: always-load entries). When no catalog is registered under .remit.yml: invariants.catalogs, surface no Constraints section.
Show the file to the user and ask for approval. Keep the bare lowercase SHA-256 hex digest of the approved bytes.
Step 3: Prepare
Polish: prepare the approved plan here:
Review the exact verification commands and options with the operator. If the profile still needs approval, omit verificationProfileDigest from the first request. VERIFICATION_APPROVAL_REQUIRED returns the resolved profile and its digest. Submit that digest after the operator approves the profile. If repository or task rules apply, review the effective policy with the operator. Include the approved digest as intent.approval.invariantPolicyDigest.
{
"featureId": "refactor-<slug>",
"repoRoot": "/project",
"intent": {
"mode": "bootstrap", "workflowType": "refactor", "baseRef": "main",
"designDepth": "thin", "designRef": "docs/specs/2026-11-27-refactor-<slug>.md",
"approval": { "decision": "approved", "designDigest": "<approved file sha256>", "verificationProfileDigest": "<approvedVerificationProfileSha256>" }
}
}
remit prepare --input prepare-request.json --json
The receipt holds the capsule. graph.stages lists the stage path of the track. The refusal table of @skills/delegate/SKILL.md applies.
Overhaul: do not prepare here. The delegate skill pr
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/brief-template.md
- references/doc-update-checklist.md
- references/explore-checklist.md
- references/overhaul-track.md
- references/polish-track.md
FAQ
Что делает скилл refactor?
Code improvement workflow with polish and overhaul tracks. Triggers: 'refactor', 'clean up', 'restructure', 'reorganize', or /refactor. The skill explores, selects the track and writes the brief and the typed plan, then makes two Remit calls: remit prepare and remit settle. Existing code only. Do NOT use for bug fixes (/debug) or new features (/ideate).
Как установить скилл refactor?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл refactor запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
AnthropicGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
academy-guide
AnthropicStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
internal-comms
AnthropicA set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
skill-development
AnthropicThis skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…