claude/skills/refactor-workflow/SKILL.md
End-to-end refactoring: justify -> scope -> branch -> plan (optional) -> execute -> cleanup -> review -> ship. Use when the user invokes /refactor-workflow or asks to run the full refactoring pipeline.
npx skillsauth add dragonkid/dotfiles refactor-workflowInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are orchestrating a complete refactoring pipeline. The core constraint: behavior must not change — only structure improves. This file is the control flow — each phase's detailed instructions live in references/. You MUST execute phases in order and MUST NOT silently skip any phase.
Refactoring goal: $ARGUMENTS
Read references/phase-0-justify.md and follow it completely.
GATE 0 — Phase 0 produces a GO / NO-GO / DEFER verdict:
| Verdict | Action | |---------|--------| | GO | Proceed to Phase 1. | | NO-GO | End workflow. | | DEFER | End workflow (decision recorded with trigger conditions). |
Update TodoWrite: phase=0-complete, verdict=<GO/NO-GO/DEFER>.
Read references/phase-1-scope.md and follow it completely.
GATE 1 — When Phase 1 completes, use AskUserQuestion:
| Choice | Action |
|--------|--------|
| Simple refactor | Record refactor_mode=simple. Skip Phase 3. Proceed to Phase 2, then Phase 4. |
| Complex refactor | Record refactor_mode=complex. Proceed to Phase 2, then Phase 3, then Phase 4. |
| Brainstorm | Invoke Skill superpowers:brainstorming with scope context. Return to this gate (excluding brainstorm option). |
| Stop workflow | End. |
Update TodoWrite: phase=1-complete, refactor_mode=<simple/complex>, test_baseline=<pass count, coverage %>.
Smart skip analysis: Check if the user is already on a refactor branch or worktree. If so, recommend skipping.
refactor/ branch, or in a worktree? -> Recommend: "You're already on branch X. Skip branch setup?"If proceeding: Read references/phase-2-branch.md and follow it completely.
Update TodoWrite: phase=2-complete, branch_mode=<worktree|branch|skipped>, base_branch=<name>.
If refactor_mode=simple: Skip this phase entirely. Announce: "Phase 3 skipped — simple refactor. Moving to Phase 4."
If refactor_mode=complex: Read references/phase-3-plan.md and follow it completely.
GATE 3 — Use AskUserQuestion:
| Choice | Action | |--------|--------| | Start implementation | Record execution mode in TodoWrite. Proceed to Phase 4. | | Revise plan | Re-invoke writing-plans skill, then return to this gate. | | Stop workflow | End. |
Update TodoWrite: phase=3-complete, execution_mode=<choice from plan phase>.
Read references/phase-4-execute.md and follow it completely.
GATE 4 — Use AskUserQuestion:
| Choice | Action | |--------|--------| | Proceed to cleanup | Proceed to Phase 5. | | Continue refactoring | Stay in Phase 4, continue work, then return to this gate. | | Stop workflow | End. |
Update TodoWrite: phase=4-complete.
Smart skip analysis: Assess whether cleanup is needed.
If proceeding: Read references/phase-5-cleanup.md and follow it completely.
Update TodoWrite: phase=5-complete.
ENTRY GATE — Before doing anything, use AskUserQuestion to let the user choose the review level. Provide change scope context (files changed, lines added) to help them decide:
| Choice | Action |
|--------|--------|
| Full review | MANDATORY: Read references/phase-6-review.md FIRST, then follow all 4 steps exactly. The reference file contains the agent matrix table — you MUST use it to determine which agents to launch. Do NOT improvise the agent list from memory. The matrix includes always-on agents (verification, security, code review, simplify) plus conditional agents (language-specific, architecture, test coverage, codex). |
| Lightweight | Run only the verification loop (build, types, lint, tests) and skip the multi-agent dispatch. |
| Skip review | Proceed directly to Gate 6. |
GATE 6 CHECKPOINT — Before presenting the Gate 6 question, verify:
If any item is unchecked, go back and complete it before proceeding.
GATE 6 — Use AskUserQuestion:
| Choice | Action | |--------|--------| | Continue to ship | Proceed to Phase 7. | | Fix issues first | Address issues, re-run affected agents, then return to GATE 6 CHECKPOINT (not Gate 6 directly — the checkpoint re-verifies all steps including docs updates). | | Stop workflow | End. |
Update TodoWrite: phase=6-complete.
Read references/phase-7-ship.md and follow it completely.
Announce: "Refactor workflow complete."
tools
Use when user wants to manage TODO items - adding tasks, listing pending items, marking done, removing, or searching. Triggers on /todo command or TODO-related requests.
tools
Use when creating a new skill, updating an existing skill, or troubleshooting skill frontmatter, gating, or slash command registration issues in OpenClaw.
tools
手动触发自我改进与记忆维护。分析近期 memory 文件,维护工作区文件,提出改进提案。触发方式:/self_improve 或用户说"自我改进"、"self improve"。
testing
测试 OpenClaw 配置中 LLM provider 的可用性。触发方式:/provider_check 或用户问"测试 provider 可用性"、"检查 provider 状态"、"provider 健康检查"。