Skip to content
Skills Library
Programming · Building & coding

refactor

/refactor

Use when refactoring code while preserving behavior — checkpoint, extract, test, audit

Repository
keiseikit ↗
Licence
Apache-2.0
Last repository change
19.07.2026

Assessment and security

90/ 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.
Content25 / 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 19.07.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 refactoring code while preserving behavior — checkpoint, extract, test, audit

Original author description

Use when refactoring code while preserving behavior — checkpoint, extract, test, audit

How it works

  1. When to use
  2. Step 1: Understand Current State
  3. Step 2: Plan Refactoring
  4. Step 3: Checkpoint
  5. Step 4: Refactor (Incremental)
  6. Step 5: Audit
  7. Step 6: Final Verification
  8. Step 7: Commit
Original SKILL.md headings · 47 lines, 248 words
SKILL.md preview
---
name: refactor
description: Use when refactoring code while preserving behavior — checkpoint, extract, test, audit
arguments:
  - name: target
    description: File or module to refactor
    required: true
  - name: goal
    description: "What the refactoring should achieve"
    required: false
---

# Refactor Workflow

## When to use

- Restructuring code that violates the Constructor Pattern (file >200 LOC, function >30 LOC, multiple responsibilities, duplicated code).
- Safe refactoring that must preserve existing behaviour — checkpoint, tests baseline, extract, verify.
- When `wave-audit` or `/dev-guard` flags a structural issue that requires decomposition.

## Step 1: Understand Current State
- Read target file(s) completely
- Identify existing tests for the target
- Run existing tests — baseline must pass
- Document current behavior (inputs → outputs)

## Step 2: Plan Refactoring
- Identify what violates Constructor Pattern:
  - File >200 lines → decompose
  - Function >30 lines → extract
  - Multiple responsibilities → split
  - Duplicated code → single source
  - Overlay/patches → root formula
- List concrete changes BEFORE making them

## Step 3: Checkpoint
- `checkpoint: before refactor $target`

## Step 4: Refactor (Incremental)
- ONE structural change at a time
- After each change: run tests
- If test breaks → fix immediately or revert
- Preserve all public interfaces unless explicitly changing them

## Step 5: Audit
- Check: does refactored code follow Constructor Pattern?
- Check: no overlay, no dead code, no orphaned imports
- Check: SSOT — no duplicated logic
- Check: file sizes within limits

## Step 6: Final Verification
- Run full test suite — all pass
- Diff review: no accidental behavior changes
- No new dependencies added without reason

## Step 7: Commit
- `refactor: <what was restructured and why>`

Versions

RepositoryScoreLicence
This page · keiseilab/keiseikit90Apache-2.0
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 92cb290ca311 (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-expert
    Expert safe, incremental, behavior-preserving refactoring. Trigger keywords: refactor, code smell, cleanup, technical debt, extract function, rename, inline, decouple, simplify, guard clause, legacy code, duplication, god class. Use to restructure code without changing behavior,…
  • 100craftsman-refactor
    Systematic refactoring with behavior preservation. Use when improving existing code structure, reducing technical debt, or when code smells are detected.
  • 100test-preserving-refactor
    Use when code needs restructuring and observable behavior must stay unchanged, with existing tests kept green at every step.
  • 86refactoring
    Use when the user asks to refactor code.
  • 100code-refactor
    Implement safe, behavior-preserving code refactors after inspecting the existing project. Use when the user asks to refactor, split large files, extract methods, reduce duplication, rename, clean dead code, or says 重构代码, 拆分模块, 提取方法, 优化命名, 优化注释, 删除未调用代码. For broad requests, plan…
  • 100refactor-code
    Use this skill whenever the user wants to actually refactor, rewrite, modernize, or transform existing code. Triggers include: "refactor this", "rewrite this code", "convert to hooks", "modernize this", "extract utilities", "clean up this code", "apply the refactor plan",…

Feedback and reports

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