incremental-refactor

Generate a constraint block for safe incremental code refactoring in Claude Code workflows.

Updated Mar 12, 2019
One-click install
npx skills add https://github.com/gustavofsantos/dot-files --skill incremental-refactor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: incremental-refactor
Source: https://github.com/gustavofsantos/dot-files/tree/main/skills/incremental-refactor
Command: npx skills add https://github.com/gustavofsantos/dot-files --skill incremental-refactor

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides constraints and guardrails to perform safe, incremental refactoring of code during development sessions. It helps users clean up code, remove duplication, extract concepts, or improve structure without altering behavior, and generates a constraint block for the card's Context section in Claude Code.

Core Features & Use Cases

  • Constraint block ready for Claude Code planning sessions, including explicit safety rules and a checklist.
  • The flocking rules guide the identification and elimination of duplication with the simplest change.
  • Common safe moves outline safe, one-step edits (rename, extract, inline, move, replace constants) to keep behavior intact.
  • Signals for violations help prevent multiple structural changes or unintended behavior changes in a single task.

Quick Start

Paste the constraint block into the card's Context before starting the Claude Code session to guide planning.

Frequently Asked Questions about incremental-refactor

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

FAQPage Schema
How do I safely refactor code without altering behavior during development?

To clean up code without altering behavior, apply incremental refactoring constraints that enforce test-driven safety. This approach uses flocking rules to eliminate duplication and safe moves like rename and extract to restructure code one step at a time.

What are flocking rules for removing code duplication?

Flocking rules guide the identification and elimination of code duplication using the simplest possible change. They help you extract shared concepts and restructure code incrementally while keeping behavior intact throughout the refactoring process.

How do I set up constraints for a Claude Code refactoring session?

Paste the generated constraint block into the card's Context section before starting your Claude Code planning session. This block includes explicit safety rules, a checklist, flocking rules, safe moves, and failure signals to enforce disciplined structural changes.

What are safe moves in incremental refactoring?

Safe moves are one-step edits—rename, extract, inline, move, and replace constants—that keep behavior intact. They allow you to restructure code methodically without combining multiple structural changes in a single refactoring task.

When should I avoid doing multiple structural changes during a refactoring task?

Avoid combining multiple structural changes when failure signals indicate unintended behavior shifts. Incremental refactoring constraints enforce one safe move per task to prevent compounding errors and maintain test-driven safety throughout the restructuring process.