Files
claude_mac/skills/refactor/SKILL.md
T
bastien d82c06f572 refactor(doctrine): C2 coherence — 30 doctrine/skill tensions resolved, doctrine wins (BDR-099)
One ask policy; mandated executors exempt from the delegation rule; skill plan satisfies the planning rule; journal line exempt from the approval gate; chore = maintenance without new behaviour; small fix on develop = bugfix; BDR-068 written as the one auto-finish exception; deploy routes to /deploy. Skills and agents follow: hotfix types by base + skips the design gate on trivial; capitalize/close create missing registries; commit-change asks the branch type; doc/seo/web-validate/refactor branch through the aiguillage; tour reports BREAKING fixes as needs-decision and runs doc-syncer two-mode; client-handover applies audit bundles from its main loop behind one gate; init-project/onboard use the 200-file graphify signal and bootstrap memory; release-candidate gates the tag push only; push wording aligned with the BDR-095 hooks; stale pointers fixed (§ Language, .gsd/ROADMAP.md, handover script path, design-gate lists).
2026-09-24 20:25:40 +02:00

1.6 KiB

name, description, argument-hint, allowed-tools
name description argument-hint allowed-tools
refactor Improve code quality without changing behavior — strict norm enforcement, targeted scope (file/module). Full-codebase audit+cleanup → /code-clean. Triggers: "refactor", "clean up code", "normaliser". <file, function, or module to refactor> Read, Write, Edit, Grep, Glob, Bash, Agent

Dispatch the refactorer executor — behavior-preserving norm application is closed execution, so it runs pinned on sonnet (not the big session model). The scope you name is the only reflection; the agent applies norms.

Gitflow aiguillage first (the refactorer edits code): follow $HOME/.claude/lib/gitflow-aiguillage.md, this skill's TYPE = chore. On main/develop run bash ~/.claude/lib/gitflow.sh start chore refactor-<slug> and dispatch on the new branch; on a working branch dispatch in place. Never gitflow finish — integration is human-gated.

Agent(subagent_type="refactorer")
prompt: "Refactor to strict project norms, preserving external behavior
exactly (zero behavioral regression, existing tests must pass). Target:
$ARGUMENTS"

If the refactorer agent is unavailable, emit Refactorer agent missing. and STOP — never improvise, silent behavior change is unsafe.

🔴 No-tests gate: when the agent returns TESTS PRESENT: no and stopped (its contract on a test-less target), do NOT re-dispatch on your own. Surface its PRE-REPORT and ask the user: add tests first / proceed anyway / abort. Only an explicit "proceed" re-dispatches with the GO-WITHOUT-TESTS token — behavior preservation is unverifiable on that path and the user owns that risk.