safe-refactor

Orchestrate risk-aware refactor cycles with assessment, implementation, verification, and documentation phases.

60|2|Updated Jan 21, 2026
One-click install
npx skills add https://github.com/ElliotJLT/Claude-Skill-Potions --skill safe-refactor-elliotjlt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: safe-refactor
Source: https://github.com/ElliotJLT/Claude-Skill-Potions/tree/main/skills/safe-refactor
Command: npx skills add https://github.com/ElliotJLT/Claude-Skill-Potions --skill safe-refactor-elliotjlt

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps teams manage risky code changes by orchestrating a safe refactor cycle around critical paths to prevent production issues.

Core Features & Use Cases

  • Risk assessment: Integrates or simulates pre-mortem style checks before changes.
  • Structured phases: Guides implementation, verification, and documentation in a deterministic flow.
  • Governance-ready: Produces auditable steps and gates to minimize accidental breaking changes.

Quick Start

To apply this skill, trigger the refactor workflow on the target module and follow the phase prompts to assess risk, prepare, implement, verify, and document.

Frequently Asked Questions about safe-refactor

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

FAQPage Schema
How do I safely refactor critical code without breaking production?

Safe refactor orchestrates a risk-aware cycle enforcing assessment, implementation, verification, and documentation phases. It uses pre-mortem checks, automated gates with bash, git, pytest, and jest, and produces auditable steps to minimize breaking changes across large rewrites and migrations on critical paths.

What's the best way to manage risk when doing large code migrations?

Structure migrations through phase-based discipline: assess risk upfront, implement changes methodically, verify with automated checks, and document decisions. This approach integrates common tools for testing and version control, creating governance-ready gates that prevent accidental breaking changes.

Can I use refactoring best practices with my existing bash, git, and test framework?

Yes. Safe refactor supports integration with bash, git, pytest, and jest for automated checks and safe gates. It works with your existing tools to enforce verification and documentation without requiring external dependencies.

How do I conduct a pre-mortem check before refactoring code?

Pre-mortem assessment identifies risks before implementation by simulating failure scenarios on critical paths. Safe refactor integrates or simulates these checks in the first phase, allowing teams to surface and mitigate issues before code changes begin.

What should I document during a code refactor to ensure governance compliance?

Document risk assessment findings, implementation decisions, verification results, and deployment gates. Safe refactor enforces structured documentation throughout its phases, producing auditable records that demonstrate governance compliance and support rollback decisions.