401 Cleanup
What this skill is for
Section titled “What this skill is for”401-cleanup performs a deliberate cleanup pass on an already-changed scope. It reduces duplication, improves naming and structure, and fixes obvious in-scope robustness issues — without turning the work into a broad rewrite. For test cleanup, this is still cleanup-only: no net-new coverage.
Output: Cleaner source files or cleaner test files. Validation proving the cleanup stayed safe.
When to use it
Section titled “When to use it”- After
301-spec-implementation, when the changed code warrants an additional cleanup pass - When a change set exists and needs to be cleaned up before review
- When you want cleanup to be a distinct, reviewable operation rather than mixed into implementation
When NOT to use it
Section titled “When NOT to use it”- Before implementation — cleanup has no meaning before code exists
- When the changed set has not been identified —
401requires a scoped anchor (staged changes, a file set, or a diff range) - To add new behavior or new test coverage — that work belongs in
301or302
What it produces
Section titled “What it produces”- Cleaner source files (when source is the target type) or cleaner test files (when tests are the target type)
- Validation output — tests, lint, build — proving the cleanup did not break anything
- A summary of out-of-scope cleanup opportunities that were identified but not acted on
Required inputs
Section titled “Required inputs”- A cleanup scope anchor: staged changes, a file set, or a diff range
- Exactly one cleanup target type: source code or test code
Common prompts
Section titled “Common prompts”Prompt
Run 401-cleanup on the changed source files. Prompt
Run 401-cleanup on the changed test files. What usually comes next
Section titled “What usually comes next”If you cleaned source code first and still want test cleanup, run 401-cleanup again as a separate pass with the test target type.
Practical guidance
Section titled “Practical guidance”- Treat the user-defined changed set as the default boundary. Ask for explicit approval before expanding scope beyond that boundary.
- Fix obvious in-scope risks when intent is clear — but do not disguise feature additions or architectural changes as cleanup.
- Out-of-scope cleanup opportunities should be surfaced and noted, not acted on automatically.
- Test cleanup is strictly cleanup-only. It must not add new coverage, new scenarios, or new test files.
Common mistakes
Section titled “Common mistakes”- Trying to clean up both source and test files in one pass
- Pointing
401at a mixed changed set without choosing source or test first - Using
401to deliver new feature work instead of post-change cleanup - Treating out-of-scope duplication as automatic permission to refactor broadly
- Skipping validation — a cleanup that breaks something is not a cleanup