refactor

Orchestrate multi-step codebase refactoring with pre-flight checks and atomic commits.

3|1|Updated Dec 5, 2025
One-click install
npx skills add https://github.com/trungdo9/ClauKit --skill refactor-trungdo9
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: refactor
Source: https://github.com/trungdo9/ClauKit/tree/main/skills/software/refactor
Command: npx skills add https://github.com/trungdo9/ClauKit --skill refactor-trungdo9

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill ensures large-scale code refactoring is performed safely and with behavior preservation, eliminating the risks of breaking functionality during extensive code changes.

Core Features & Use Cases

  • Large-Scale Refactoring: Handle complex refactoring tasks such as renaming symbols, extracting modules, and migrating APIs.
  • Behavior Preservation: Enforce that refactors do not alter external behavior, ensuring stability.
  • Pre-flight Checks: Before starting a refactor, verify that the working tree is clean, tests pass, and type-checks are successful.
  • Atomic Commits: Each refactor step is committed atomically, allowing for individual rollbacks if needed.
  • Use Case: Ideal for a team working on a significant codebase, ensuring that refactorings like API changes or structural adjustments do not introduce regressions.

Quick Start

Initiate a refactor with the command '/ck:refactor'. Follow the outlined steps in the documentation for scope definition, dry-run discovery, batching, execution, and verification.

Frequently Asked Questions about refactor

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

FAQPage Schema
How do I safely perform large-scale code refactoring without breaking existing behavior?▼

Large-scale code refactoring is orchestrated through a multi-step process that enforces pre-flight checks, atomic commits, and rollback procedures to preserve behavior. This ensures stability during complex tasks like API migrations and module restructuring.

What are pre-flight checks and do I need a clean working tree to start a refactor?▼

Pre-flight checks are mandatory safety gates verifying that your working tree is clean, tests pass, and type-checks are successful before starting a refactor. You must satisfy these prerequisites to prevent introducing regressions.

How do atomic commits work during a module extraction or API migration?▼

Atomic commits ensure that each individual step of a module extraction or API migration is committed independently. This granular approach allows you to isolate specific changes and perform individual rollbacks if a behavior regression is detected.

What is the best way to handle complex code refactoring tasks like renaming symbols across a significant codebase?▼

The best way to handle renaming symbols across a significant codebase is to use a structured refactoring process with scope definition, dry-run discovery, and batching. This step-by-step execution guarantees behavior preservation and structural integrity.

Can I rollback a specific refactoring step if type-checks fail mid-process?▼

Yes, you can rollback a specific refactoring step because the process enforces atomic commits for every change. If type-checks fail or regressions occur, you can revert to the last known stable state without undoing the entire refactor.

When should I not use an orchestrated refactoring workflow for code changes?▼

You should avoid an orchestrated refactoring workflow for minor or localized code changes that do not require strict behavior preservation. The multi-step safety gates, dry-runs, and batching are designed specifically for extensive, large-scale codebase modifications.