Skip to content
Skills Library
Programming · Building & coding

safe-refactor

/safe-refactor

Use when code needs restructuring without changing observable behavior.

Licence
Apache-2.0
Last repository change
27.09.2026

Assessment and security

96/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability21 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 27.09.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What it does and when to use it

Use when code needs restructuring without changing observable behavior.

Original author description

Use when code needs restructuring without changing observable behavior.

How it works

  1. Purpose
  2. When to Use
  3. Inputs
  4. Workflow
  5. Output
  6. Verification
  7. Failure Modes
Original SKILL.md headings · 53 lines, 284 words
SKILL.md preview
---
name: safe-refactor
description: Use when code needs restructuring without changing observable behavior.
---

## 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

1. **Confirm behavior** — Run the test suite. All tests must pass before starting.
2. **Plan** — List the structural changes. Check each for API impact.
3. **Refactor in small steps** — One change at a time, each independently reversible.
4. **Avoid interface changes** — Do not alter public APIs, exported types, or CLI behavior unless explicitly intended.
5. **Validate after each step** — Re-run targeted tests after each meaningful change.

## Output

```markdown
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.

Versions

RepositoryScoreLicence
This page · yeaight7/agent-powerups96Apache-2.0
Sanit-mann/The-Insectoids100MIT
meyshad/skillforge100MIT
KILN-skills/kiln100MIT

Identical content appears in 1 other GitHub folders. We show one copy with the highest score.

Database snapshot: 13.11.2026 · package version d0b34bcdc280 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 1 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100refactor
    Use when code quality needs improvement after implementation, without changing behavior
  • 90safe-refactor-pass
    Use when restructuring or simplifying code without changing behavior, removing AI slop, or writing a refactor plan. Not for repeated mechanical edits across many files (sweep-rewriter).
  • 100test-preserving-refactor
    Use when code needs restructuring and observable behavior must stay unchanged, with existing tests kept green at every step.
  • 100dev-refactor
    Use when changing structure without changing behavior: restructure, extract, rename, dedupe or split code.
  • 85refactor
    Changes the structure of code without changing its behaviour, with the current behaviour pinned by tests first. Use when asked to "refactor", "clean up", "simplify", "extract", "rename", "move" or "deduplicate" code, or when another task needs restructuring first.
  • 100refactor-clean
    Use when code has grown complex, duplicated, or cluttered — clean up structure and remove dead code without changing observable behavior

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.