Safe refactor
Use when code needs restructuring without changing observable behavior.From its SKILL.md
npx -y skills add yeaight7/agent-powerups --skill safe-refactorAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 6 stars6 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
1.9 KB, 380 tokens by cl100k_base, as published. Nobody here has run it
Purpose
Restructure code in small, safe steps while preserving all externally observable behavior. Prevents refactor regressions where behavior silently changes.
When to Use
- Code needs structural improvement but its public API must remain unchanged.
- Naming, organization, or duplication needs cleanup after a feature is complete.
- Technical debt needs reduction without introducing risk.
Do not use this skill if there are no existing tests — write tests first.
Inputs
- Code to refactor.
- Existing test suite (required).
- Optional: specific goals (extract function, rename module, remove duplication).
Workflow
- Confirm behavior — Run the test suite. All tests must pass before starting.
- Plan — List the structural changes. Check each for API impact.
- Refactor in small steps — One change at a time, each independently reversible.
- Avoid interface changes — Do not alter public APIs, exported types, or CLI behavior unless explicitly intended.
- Validate after each step — Re-run targeted tests after each meaningful change.
Output
Changed:
- <structural change 1>
- <structural change 2>
Behavior unchanged because: <reasoning>
Validated by: <test commands run>
Verification
- Tests pass before starting
- Each step is small and independently reversible
- No unintended API or interface changes introduced
- Tests pass after each meaningful step
- Final test suite fully green
Failure Modes
- Missing tests — Stop. Write tests before refactoring. Behavior cannot be verified otherwise.
- Silent API change — If a refactor touches public interfaces, stop and confirm this is intentional.
- Bundled unrelated changes — Keep each step focused. Mixed changes make rollback and blame impossible.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.
Gives 1 of the 12 instructions most refactoring skills give in 380 tokens
Counted across 545 of the 587 authors here whose files we hold, read 2026-09-06
- Run tests after each changein 61 of 545, across 59 files
- Run tests before refactoringin 42 of 545
- Revert immediately if tests failin 31 of 545, across 28 files
- Perform refactoring in small stepshere, and in 30 of 545, across 29 files
- Write characterization tests for untested codein 21 of 545, across 19 files
- Remove dead code and unused importsin 20 of 545
- Identify code smellsin 20 of 545
- Perform one refactoring at a timein 19 of 545
- Commit after each successful refactoringin 17 of 545, across 15 files
- Verify all tests pass after refactoringin 17 of 545
- Keep refactoring separate from behavior changesin 16 of 545, across 14 files
- Run the full test suitein 16 of 545
Said here and by no other author read
- List structural changes before refactoring
- Validate tests after each meaningful change
- Keep each refactoring step focused
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.