agentsclimarketplace

Agent refactoring workflow

Skill Amey-Thakur/AI-SKILLS/skills/ai-coding-tools/agent-refactoring-workflow

Direct an agent through a refactor in verifiable steps with tests as the safety net, rather than one large rewrite. Use when restructuring code with agent assistance.From its SKILL.md

Install
npx -y skills add Amey-Thakur/AI-SKILLS --skill agent-refactoring-workflow

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 5 stars5 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

1.8 KB, as published. Nobody here has run it

Agent refactoring workflow

Agents are effective at mechanical restructuring and prone to changing behaviour while doing it. Working in verified steps is what keeps a refactor a refactor rather than an unreviewable rewrite.

Method

  1. Establish test coverage first. Refactoring without tests is rewriting and hoping, and the agent should add characterisation tests before changing anything (see refactoring).
  2. State the target structure. What the code should look like afterwards, since an agent asked to improve it will change things you did not want changed.
  3. Work in small verified steps. One transformation, run the tests, commit. Large refactors in one turn are unreviewable and hard to bisect (see pull-request-size).
  4. Forbid behaviour changes explicitly. Say that the refactor must preserve behaviour exactly, and treat any behaviour change as a separate commit (see negative-instructions).
  5. Review the diff yourself. Agent refactors touch many files, and an unreviewed large diff is where unintended changes hide.
  6. Keep tests untouched during the refactor. Changing tests and implementation together removes the safety net entirely.
  7. Commit at every green point. Frequent commits make it trivial to discard a bad step rather than unpicking it (see git-workflow).

Boundaries

Refactoring preserves behaviour and does not fix design problems that need a rethink. Agents can miss subtle behavioural differences that tests do not cover. Large-scale restructuring may need a migration plan rather than a refactor (see integration-migration).

Keep looking

Skills are one crate of 627,801. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.