refactoring-safely
FeaturedChange the structure of code that already exists without changing what it does: smells as triggers, the named transformations (extract/inline, move feature, organise data, simplify conditionals), and above all the workflow that makes it safe — characterization tests first, one transformation at a time, green between every step. Use when a file or function is already too large; when asked to "split this module", "extract this", "break up main.py", "clean up this legacy code", "reduce coupling here"; when a shape advisory fires on a grown file; or before any restructuring of code that has users. Do NOT use to decide the target layout of a NEW project (use architecture-first), for unit-level naming and function quality in code you are writing fresh (use code-complexity), for capacity or storage decisions (use system-and-data-design), or to strip over-engineering on request (use lean-code). This is the transformation with a net; deciding WHERE things should end up is a different question, and doing both at once i
Install
Quality Score: 88/100
Skill Content
Details
- Author
- AnastasiyaW
- Repository
- AnastasiyaW/codex-claude-code-config
- Created
- 5 months ago
- Last Updated
- 3 days ago
- Language
- Python
- License
- MIT
Bundled in these plugins
Similar Skills
Semantically similar based on skill content — not just same category
refactoring-safely
Change the shape of code without changing what it does — get a test harness under it first, move in reversible steps, and keep the refactor out of the change that alters behaviour. Use before restructuring, renaming across files, or untangling something to make a feature possible.
refactoring
Improve code structure in small, always-green steps without changing behavior. Use when asked to clean up, simplify, restructure, or de-duplicate working code.
refactoring-safely
Changing code structure without changing behaviour - establishing a safety net first, making small reversible steps, and verifying equivalence at each one. Use when code is hard to change or test, before adding a feature to a tangled area, or when cleaning up after a fix. Distinguishes refactoring from rewriting and from behaviour change, which need different handling.