Skip to content
Skills Library
Programming · Building & coding

refactor

/refactor

Use for refactoring — same behaviour, better structure. Test-coverage gate enforced. Extract-then-rename ordering. Refuses to mix in feature changes or bug fixes.

Repository
sift-coder ↗
Licence
MIT
Last repository change
03.06.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 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 03.06.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Use for refactoring — same behaviour, better structure. Test-coverage gate enforced. Extract-then-rename ordering. Refuses to mix in feature changes or bug fixes.

Original author description

Use for refactoring — same behaviour, better structure. Test-coverage gate enforced. Extract-then-rename ordering. Refuses to mix in feature changes or bug fixes.

How it works

  1. Method
  2. Output shape
  3. Rules
  4. Anti-patterns
  5. When NOT to use
  6. Subagent dispatch
  7. Value over native CC
Original SKILL.md headings · 63 lines, 383 words
SKILL.md preview
---
name: refactor
description: Use for refactoring — same behaviour, better structure. Test-coverage gate enforced. Extract-then-rename ordering. Refuses to mix in feature changes or bug fixes.
---

# refactor

Same behaviour, better structure. Tests are the contract — they must stay green throughout.

## Method

1. **Coverage gate.** Read the test coverage of the area you're refactoring. **If < 80% line coverage of the target code, write tests first** until it is. Refactor without coverage = unsafe.
2. **Memory pass.** Has this area been refactored before? Reuse the lessons.
3. **Plan.** State the target shape (in < 100 words). State the smell being addressed (e.g. "long method", "feature envy", "shotgun surgery").
4. **Mechanical sequence.** Refactor in this order:
   - **Extract** before **rename** before **move**
   - Each step is its own commit (or commit-shaped diff in a PR)
   - Run tests **after every step**
5. **Verify.** Tests green. Lint. Typecheck. Read your own diff — does it actually look better?

## Output shape

```
Target:      <area: file/symbol>
Smell:       <which one>
Goal shape:  <one paragraph>

Steps:
  1. Extract <X> from <Y>           ✓ tests green
  2. Rename <A> → <B>                ✓ tests green
  3. Move <fn> to <module>           ✓ tests green
  ...

Verify:      lint ✓ types ✓ tests ✓ (M passing, N before N after)
```

## Rules

- **Tests stay green.** If a test breaks, the refactor changed behaviour — that's a different workflow.
- **No feature changes.** Spotted a bug or missing feature? Note in memory + suggest as follow-up.
- **One smell per refactor.** Don't mix "long method" with "rename" with "move" in undisclosed ways.
- **Mechanical.** If you can't describe the step in one verb + one noun, it's too big.

## Anti-patterns

- "Refactor" that touches semantics (e.g. changing default values, error messages)
- Big-bang refactor in one commit — impossible to review or revert
- Renaming variables across 50 files when only the public API needs renaming
- Refactor that increases line count without increasing clarity

## When NOT to use

- Bug fix — `/siftcoder:fix`
- Performance — `/siftcoder:optimize`
- Aggressive simplification / deletion — `/siftcoder:zen`
- New feature — `/siftcoder:add-feature`

## Subagent dispatch

- `Explore` to map current shape
- `Plan` for non-trivial multi-step refactors
- `general-purpose` for the mechanical edits

## Value over native CC

CC will refactor when asked. CC won't naturally insist on coverage gates, mechanical step ordering, or refuse to mix concerns. This skill enforces the discipline that makes refactors safe.

Versions

RepositoryScoreLicence
This page · ialameh/sift-coder100MIT
froglet-studio/cosmic-shore100MIT
mgiovani/cc-arsenal100MIT
jongio/skills100MIT
boshu2/agentops100Apache-2.0
y-miyazaki/terraform-aws-base100Apache-2.0
mickeyyaya/evolve-loop100Apache-2.0
j0hanz/j0hanz-marketplace100MIT
kriscard/kriscard-claude-plugins100MIT

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

Downloads in the last 30 days: 0 · ranking

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

Similar skills

  • 100refactoring
    Changes code structure without changing behaviour. Use when the user asks to refactor, clean up, restructure, extract, rename across files, reduce duplication, or improve the architecture. Not for features, bug fixes or reviews.
  • 100refactor-safely
    Use when code is hard to change, has accumulated cruft, or before a feature that the current structure resists — improve structure in small, behavior-preserving steps under green tests; never mix a refactor with a behavior change.
  • 90refactor-safely
    Refactor code without changing what it does (rename, extract, split files, remove duplication, simplify). Use when the user says "clean this up", "refactor", "split this file", "simplify this function", "rename X everywhere", or "remove this duplication".
  • 100refactoring
    Use when restructuring code or guidance without changing behaviour, meaning a rename, an extraction, a move, deduplication, or hoisting repeated code into a shared module. Keeps behaviour identical, scope contained, and every reference (code, docs, guidance, generated maps)…
  • 100refactor-module
    Use when a ticket asks to restructure code without changing what it does — extract a function, split a file, rename for clarity, reduce duplication — with behaviour preserved. Invoke for "refactor X", "clean up the Y module", or "extract Z" where no behaviour change is intended.
  • 100dev-refactor
    Use when changing structure without changing behavior: restructure, extract, rename, dedupe or split code.

Feedback and reports

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