Skip to content
Back to skills

Vrefactor

ASecurity

Use when code should be restructured without changing behaviour - extract, merge, rename, deduplicate, move, migrate callers, deepen a module. States the gain up front, pins behaviour at a seam the change won't move, and merges only if the pins stay green and the gain shows; otherwise reverts.

  • 3 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added November 29, 2026
ai-agentsgoapi

Works with

  • api

Security analysis

A100/100

Scanned November 29, 2026

npx -y skills add vocsong/VocsCode --skill vrefactor --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Vrefactor?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Vrefactor
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vocsong-vrefactor/badge)](https://www.skillsdirectory.com/skills/vocsong-vrefactor)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: vrefactor
description: Use when code should be restructured without changing behaviour - extract, merge, rename, deduplicate, move, migrate callers, deepen a module. States the gain up front, pins behaviour at a seam the change won't move, and merges only if the pins stay green and the gain shows; otherwise reverts.
---

# vrefactor — change structure, not behaviour

Read `../vcore/SKILL.md` first and follow it.

## 1. State the gain

Before touching code, write the concrete improvement in terms the diff can show: fewer layers, a
deleted API, one owner instead of several copies, simpler call sites, less code, a contract suite
that now covers every implementation. "Cleaner" is not a gain.

## 2. Pin behaviour

Write characterization tests ("pins") so any behaviour change fails loudly. Typecheck and lint are
not pins.

- **Pin at a seam the refactor doesn't move** — the public entry points callers use, not internals
  you are about to reshape. Check each pin with two imagined edits: break the behaviour → the pin
  must fail; change only the internals → the pin must keep passing.
- Run the pins green on the unchanged code first.
- **Pins are frozen during the refactor.** If one goes red, the refactor changed behaviour — fix the
  code, not the pin. Any edit to a pin is flagged by review's gate-integrity check.

## 3. Shape the work

- **Contained** — one PR. A separate first commit that only deletes dead code makes the reshape
  easier to review.
- **Wide** (many callers or modules) — expand → migrate → contract: add the new shape beside the
  old, move callers in batches sized by blast radius, then delete the old shape. Each batch is a
  slice: spec them with `../vspec/SKILL.md` and `../vslice/SKILL.md` (with the spec sign-off gate)
  and build them like `vfeature`'s large path. If batches can't each stay green on the base, use a
  shared integration branch and a final integrate-and-verify slice.

## 4. Change

- Keep behaviour identical. Resist adjacent fixes; note them for the report.
- **Renames:** sweep strings, docs, config, IPC channel names, log messages and test names, not just
  identifiers.
- Larger reshapes: an **equivalence check** — run old and new on the same inputs and diff outputs.
  UI refactors: compare screenshots before and after (image diff).

## 5. Check the bar

- All pins and the layers the feature map requires stay green.
- The gain from step 1 is visible in the diff. If it isn't, **revert** rather than ship a sideways
  move, and say so in the report.

## 6. Finish

`../vverify/SKILL.md` → `../vreview/SKILL.md` → `../vmerge/SKILL.md`. The PR states the gain and
shows it (lines, layers, copies or APIs before and after).

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.