Skip to content
Skills Library
Programming · Building & coding

dev-refactor

/dev-refactor

Use when changing structure without changing behavior: restructure, extract, rename, dedupe or split code.

Repository
dev-kit ↗
Licence
MIT
Last repository change
12.11.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 12.11.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 when changing structure without changing behavior: restructure, extract, rename, dedupe or split code.

Original author description

Use when changing structure without changing behavior: restructure, extract, rename, dedupe or split code.

How it works

  1. When to Use
  2. Checklist
  3. Rationalizations
  4. Red Flags
  5. Verification
Original SKILL.md headings · 57 lines, 717 words
SKILL.md preview
---
name: dev-refactor
description: Use when changing structure without changing behavior: restructure, extract, rename, dedupe or split code.
disable-model-invocation: true
---
# dev-refactor

Paths: the `bin/` tools and the `library/` folder live in `~/.agents/dev-kit/`; run tools by that path.

Task: no `DEVKIT_TASK` set? Run `~/.agents/dev-kit/bin/ledger start <slug>` first (it prints your id) and prefix dev-kit commands with `DEVKIT_TASK=<id>`. `<task>` below is `.devkit/tasks/<id>` at the repo root; never write run files anywhere else. Also read `.devkit/memory.md` if it exists.

Open the host todo list (todowrite, TodoWrite or TaskCreate, whichever exists; else a checklist in <task>/state.md) with this checklist verbatim, and tick items as steps finish. A skipped step stays listed with a reason.

Run `bin/ledger` after every step (phase=refactor).

## When to Use
- Structure only: rename, split, extract, dedupe, move, re-layout with no behavior change.
- Not for new behavior (dev-feature), a bug (dev-debug) or a cross-cutting redesign (dev-research).
- A cleanup that reveals a missing feature or a bug: split it out and ship the structure first.

**You own:** a behavior-preserving restructure, with proof the output is unchanged.

**Reads:** always library/principles (step 0), library/simplify, library/verify, library/git-ship, library/state. If the target shape crosses a function boundary: library/deep/sketch and library/explain-html. If an internal API is replaced: library/deep/decision-records. To judge the result: library/deep/reader-load. If a runtime path is touched: library/observability and library/deep/observe-and-test.

## Checklist
- [ ] 0. Skim library/principles; open a deep file only when its trigger matches.
- [ ] 1. State the structural goal and the invariant (what must not change). If the cleanup reveals a missing feature or a bug, split it out (dev-feature, dev-debug) and finish the structure first.
- [ ] 2. Pin behavior: save baseline output of the real artifact; add characterization tests where coverage is thin. Type check and lint are not a pin.
- [ ] 3. Name the target shape (module layout, types, call graph as if built today). It crosses a function boundary? follow library/deep/sketch. Show it on an explain-html page (library/explain-html) unless trivial.
- [ ] 4. Subtract first: delete dead code, one-caller wrappers, redundant validators and orphan references before adding the new shape (library/simplify).
- [ ] 5. Move in small behavior-preserving steps, pin green after each, one commit per step. Internal-only API: migrate every caller and delete the old path in one wave, no shims (library/deep/decision-records).
- [ ] 6. Spot-check every rename against the real files, including strings, docs and back-references.
- [ ] 7. Prove it: output equals the baseline (diff old vs new, or an equivalence script for larger reshapes); follow library/verify.
- [ ] 7a. Runtime path touched? the signals must be identical before and after (library/observability, library/deep/observe-and-test).
- [ ] 8. Keep only what lowers reader load (library/deep/reader-load); revert a change that does not.
- [ ] 9. Review with dev-review; ship via library/git-ship with small ordered commits (subtraction, reshape, follow-on). Closeout: follow library/state. Then run bin/verify, then close the ledger: bin/ledger done "<summary>".

**Hand off to:** dev-review on the full diff. If the cleanup reveals a missing feature or a bug, split it out to dev-feature or dev-debug.

**Reply:** the structure that changed, the pin you held it against, the equivalence proof, the reader-load change, what shipped and what you reverted.

## Rationalizations
| Excuse | Rebuttal |
|---|---|
| "Type check and lint prove it is safe" | They cover types, not behavior; pin the real output. |
| "Keep a shim for callers" | Migrate every caller and delete the old path in the same wave. |
| "Cleanup found a bug, fix it now" | Split it out (dev-debug); finish the structure first. |
| "A grander layout would be nicer" | Name the target shape; revert what does not lower reader load. |

## Red Flags
- Output differs from the baseline with no equivalence proof.
- New indirection or wrappers added before subtracting dead code.
- Rename missed strings, docs or back-references.
- Old and new paths both live; a compatibility shim left behind.
- A speculative cleanup kept though reader load did not drop.

## Verification
- Ledger shows: baseline saved, each step green, equivalence proof, reverts.
- Output equals the baseline: diff old vs new, or an equivalence script.
- Full suite green; the diff holds only structure, no behavior change.
- Run `bin/verify`, then close the ledger: `bin/ledger done "<summary>"`, or a `next` row with the first runnable step if work remains.

Versions

RepositoryScoreLicence
This page · nchandar/dev-kit100MIT
codeaholicguy/ai-devkit100Apache-2.0
HarunRRayhan/RayStack100MIT

Database snapshot: 13.11.2026 · package version 03d3d2ac4c98 (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.
  • 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".
  • 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.
  • 100refactor-safely
    Restructure, rename, split or move code without changing behaviour, and prove that nothing changed. Use this for any refactor, cleanup, file move, module split or dead code removal, including when it is only one step inside a larger task.
  • 100refactor
    Refactor without changing behavior. Use when asked to restructure, extract, move, or split code, or when a review hands over a structural fix. Not for readability (clean-code) or adding behavior (write-plan, tdd).
  • 100safe-refactor
    Refactor JavaScript/TypeScript or Python code without changing behavior — extract functions, rename, split large files, remove duplication, modernize syntax, add types — with tests as a safety net. Use whenever the user asks to refactor, clean up, simplify, "rapikan kode",…

Feedback and reports

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