refactor

Plan and execute multi-file refactorings with automatic rollback on verification failure.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/special-place-administrator/citadel_codex --skill refactor-special-place-administrator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor
Source: https://github.com/special-place-administrator/citadel_codex/tree/main/skills/refactor
Command: npx skills add https://github.com/special-place-administrator/citadel_codex --skill refactor-special-place-administrator

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Safe multi-file refactoring with automatic rollback. Establishes a contract: the codebase must typecheck and pass tests after changes, or revert.

Core Features & Use Cases

  • Baseline-driven plan-and-execute workflow for symbol/file/module renames, extractions, moves, splits, and merges.
  • Automatic rollback if verification fails, maintaining behavior.
  • Guidance for planning, executing, and verifying changes with minimal disruption.

Quick Start

Refactor a symbol rename across the codebase and verify no regressions.

Frequently Asked Questions about refactor

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

FAQPage Schema
How do I safely refactor code across multiple files?

Multi-file refactoring is safe when executed via a baseline-driven plan that verifies typecheck and tests pass after changes. This approach establishes a contract to automatically revert modifications if verification fails, ensuring behavior remains stable.

What is the best way to rename a symbol across a codebase without breaking tests?

Renaming a symbol across a codebase requires a plan-and-execute workflow that applies the changes and then runs typecheck and tests. If the verification step detects regressions, the process automatically rolls back the modifications.

Can I execute codebase refactoring and automatically revert if the typecheck fails?

Yes, refactoring with automatic rollback establishes a strict contract where the codebase must typecheck and pass tests after changes. If verification fails, the workflow automatically reverts the modifications to maintain stable behavior.

How does a plan-and-execute workflow handle code extractions and module moves?

A plan-and-execute workflow handles extractions and moves by first planning the multi-file changes against a baseline, executing them, and verifying behavior through typecheck and tests. If validation fails, the changes are rolled back automatically.

When do I need a baseline-driven workflow for refactoring?

A baseline-driven workflow is needed for multi-file refactoring tasks like splits and merges to ensure safe, auditable changes. It guarantees that if typecheck and tests fail post-execution, the system automatically reverts to the stable baseline.

Does automated refactoring work without writing new tests?

Automated refactoring relies on existing tests and typecheck verification to ensure behavior remains stable after changes. Without these baseline checks, the system cannot establish the contract needed to safely execute and roll back modifications.