slice-refactor

Installation
SKILL.md

Summary

Triggered after slice-impl leaves the slice green. This skill is optional: if the implementation already reads cleanly, skip it. When it runs, it eagerly loads anti-pattern entries scoped to the slice's touched_paths before reading anything else. Reads the slice definition (including out_of_scope) and the test files in full. Refactors the implementation for clarity, DRY, and pattern alignment without changing observable behavior. Tests must be green before any change is made, and must remain green after every change. If a refactor step breaks a test, the skill aborts immediately and reverts the change — it does not modify the test to restore green. Stops as soon as no obvious cleanup remains; it does not invent refactors to fill time.

Procedure

Step 1 — Decide whether to run

Before doing anything else, answer: does the implementation obviously benefit from cleanup? Signals that warrant running:

  • Duplicated logic that could be extracted into a shared function or constant
  • Inline magic values that would read more clearly as named constants
  • Nested conditionals that could be flattened or guard-claused
  • Variable or function names that obscure intent
  • Structural mismatch with patterns already established in the project (visible from the implementation files themselves or from loaded anti-patterns)

If none of these signals are present — the implementation is short, direct, and already idiomatic — stop and output:

Installs
1
First Seen
Jun 22, 2026
slice-refactor — jdforsythe/groove