tidy
Tidy
The cleanup walk runs in a fresh host-provided reviewer per iteration when reviewer dispatch is available; Edit application stays in the main thread to keep the reviewer bias-free. The skill loops the dispatch + apply cycle until the reviewer returns no more mechanical_edits, max iterations is reached, or a safety rail trips. Designed to be called from non-interactive routines; it never prompts the user.
Scope: invocation targets are arbitrary source files (application code, config, SKILL.md, any text). The skill does not restrict the changed-file set to a fixed directory prefix — any path in the diff is reviewed unless caught by the exclusion list (Step 1 step 3).
Invocation contract
The caller passes these fields in natural language (the skill extracts them from the invocation text):
-
Base ref(optional, default<working-tree-vs-HEAD>) — git ref to diff against. When omitted, the skill looks at the working tree's uncommitted + staged + untracked changes (the default scope for a post-implementation cleanup pass). When specified (e.g.Base ref: main), the skill switches togit diff <Base ref>semantics — useful for callers that want to review a stack of already-committed changes between a base branch and HEAD.Untracked-file scope asymmetry: the default mode includes untracked new files (collected via
git status --porcelain=v1 --untracked-files=all -z), but the explicitBase refmode reads committed history only and excludes untracked files. A caller passingBase ref: HEAD~5expecting "everything since base" will silently miss new files added sinceHEAD~5that were never committed. If you need untracked files in scope, omitBase refand rely on the working-tree default. -
Max iterations(optional, default3) — upper bound on the refinement loop. Cleanup polish typically converges in 1–2 iterations. -
Custom instructions(optional) — free-form text injected into the dispatch payload as additional constraints alongside the cleanup checklist. Orchestrators that carry their owncustom_instructionsconfig (e.g. workflow steps that pass project-wide constraints) route that text through this field. -
Model(optional) — model id (sonnet/opus/haiku) applied as themodelparameter on the reviewerAgentdispatch in Step 3 (a). An independent optional field (not part of a fixed-arity mode gate); a caller such asdev-workflowpasses it to run the cleanup reviewer on a specific model. Because this skill runs a per-iteration dispatch loop, the same value is applied to every iteration's reviewer dispatch. Effective only on the Claude CodeAgent-dispatch path; on the reviewer-dispatch-unavailable inline fallback (Step 3 (a)) noAgentis spawned, so the value is moot (the executing agent's own model governs). Validity predicate: a value is valid only if it is exactly one of the closed set{sonnet, opus, haiku}(the ids theAgentmodelparameter accepts); an absent field or any value outside that set (including a fullclaude-*id) is invalid → no override; the reviewerAgentinherits the session model (backward-compatible default).