A/B /reconcile headless — BEFORE requests=18 output=12374 thinking=3135 effort={'high'} duration_ms=96518 / AFTER requests=15 output=9038 thinking=2248 effort={'low'} duration_ms=78410
34 lines
1.6 KiB
Markdown
34 lines
1.6 KiB
Markdown
---
|
|
name: refactor
|
|
effort: high
|
|
description: '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".'
|
|
argument-hint: <file, function, or module to refactor>
|
|
allowed-tools: 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.
|