refactor-guide

Guide incremental code refactoring with one transformation per commit and green test baselines.

20|3|Updated Apr 30, 2026
One-click install
npx skills add https://github.com/DVNghiem/FlowDeck --skill refactor-guide-dvnghiem
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor-guide
Source: https://github.com/DVNghiem/FlowDeck/tree/main/src/skills/refactor-guide
Command: npx skills add https://github.com/DVNghiem/FlowDeck --skill refactor-guide-dvnghiem

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Refactor safely — keep tests green, change structure without behavior change, no public API breakage. Use for code maintenance.

Core Features & Use Cases

  • One-transformation-per-commit discipline to minimize risk.
  • Tests-first approach with green baselines before and after each change.
  • Clear guidelines for renaming, extracting, or moving modules without changing behavior.

Quick Start

Run the tests to ensure a green baseline, then perform one targeted refactor and re-run tests to confirm no regressions.

Frequently Asked Questions about refactor-guide

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor legacy spaghetti code without breaking existing behavior?

To refactor legacy spaghetti code without breaking behavior, enforce a one-transformation-per-commit discipline and verify a green test suite before and after each structural change to prevent regressions.

Can I rename or extract modules in a large codebase while keeping tests green?

Yes, you can rename or extract modules in a large codebase while keeping tests green by applying targeted structural changes one at a time and validating against a green test baseline after each commit.

What is the one-transformation-per-commit rule for code maintenance?

The one-transformation-per-commit rule for code maintenance restricts each commit to a single structural change, minimizing regression risk by isolating modifications and ensuring tests pass before and after the commit.

Do I need a green test baseline before refactoring code with feature churn?

Yes, you need a green test baseline before refactoring code with feature churn to establish a verified behavioral state and ensure your incremental changes do not introduce hidden regressions.

When should I not use incremental refactoring safeguards?

You should not use incremental refactoring safeguards when your codebase lacks an adequate test suite, as verifying a green baseline before and after changes is required to prevent undetected behavior shifts.