Agent Skills: Refactor Workflow

>-

UncategorizedID: pproenca/dot-claude/refactor-workflow

Install this agent skill to your local

pnpm dlx add-skill https://github.com/pproenca/dot-claude/tree/HEAD/plugins/cairn/skills/refactor-workflow

Skill Files

Browse the full folder contents for refactor-workflow.

Download Skill

Loading file tree…

plugins/cairn/skills/refactor-workflow/SKILL.md

Skill Metadata

Name
refactor-workflow
Description
>-

Refactor Workflow

Change structure; preserve behavior exactly. The existing behavior is the spec — but it is unknown until proven, because you believe it does X without having pinned it. So the parse is a characterization test net, captured GREEN before any edit. Refactoring without it is editing on unparsed input.

The loop (the feature-workflow spine, refactor instance)

  1. STEP 0 already classified this as a refactor. Scaffold the manifest: change_new.py --kind refactor --name "...".
  2. Parse the unknown (STAGE 0.5 equivalent): capture characterization tests that pin the current observable behavior and run them GREEN. If you cannot make them green first, you do not yet understand the behavior you are about to preserve — stop. (See references/characterize.md.)
  3. Gate: change_check.py --kind refactor <manifest> — blocks until the net is declared.
  4. Change under the net, one behavior-preserving move at a time. A boundary move → use boundary-discipline REFACTOR mode.
  5. Verify obligation: the same net is GREEN after, behavior identical, no new behavior added. verify.py gates ship.
  6. Record/ratchet: a refactor that paid down real coupling is shelf signal; a near-regression the net caught is a knowledge-ratchet observation.

The one law here

A refactor changes exactly one thing — structure — and holds behavior invariant. If behavior must change too, it is not a refactor: split it into a refactor (under the net) plus a feature or fix (its own loop).

Files

  • references/characterize.md — how to capture a behavior-pinning net cheaply.