refactor-safety-net

refactor-safety-net is a skill for Claude Code, Codex from wsauret/flywheel. It costs 17 tokens per session (1,691 once invoked), scanned A, original, Apache-2.0.

A verification method for structural refactors that promises to keep existing behavior unchanged. It compares outputs from the original and refactored code using a matrix, replayed examples, and equivalence checks.

In plain words
What is it for?
It helps prepare characterization tests and test data before a refactor, compare golden results during the work, investigate unexplained differences, and repeat checks after rebasing.
Why use it?
It detects regressions at boundaries where code paths or data transformations are being rearranged. It also preserves a reviewable record when behavior is intentionally changed.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It helps prepare characterization tests and test data before a refactor, compare golden results during the work, investigate unexplained differences, and repeat checks after rebasing.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/wsauret/flywheel/refactor-safety-net
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add wsauret/flywheel --skill refactor-safety-net
Clone the repo
git clone --depth 1 https://github.com/wsauret/flywheel

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for refactor-safety-net

README.md
[![agentmods](https://agentmods.dev/badge/skills/wsauret/flywheel/refactor-safety-net/github.svg)](https://agentmods.dev/skills/wsauret/flywheel/refactor-safety-net)
Your own site
<a href="https://agentmods.dev/skills/wsauret/flywheel/refactor-safety-net"><img src="https://agentmods.dev/badge/skills/wsauret/flywheel/refactor-safety-net/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for refactor-safety-net

Your own site · 80×15
<a href="https://agentmods.dev/skills/wsauret/flywheel/refactor-safety-net"><img src="https://agentmods.dev/badge/skills/wsauret/flywheel/refactor-safety-net.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 17 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,691 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00017 $0.01691
Opus 5.5 $0.00007 $0.00676
Sonnet 5.5 $0.00003 $0.00338
Haiku 4.5 $0.00002 $0.00169

Measured 28d ago against content hash 704dd9f23e29, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

refactor-safety-net scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 28d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

src/orchestration/modules/development/definitions/skills/refactor-safety-net/SKILL.md · 92 lines

How it starts

The opening of the file, as written. The whole thing — 92 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Refactor Safety Net

Input: a planned refactor that changes how behavior is produced and promises that the behavior itself does not change, its plan document, and the code it rewires.

Mandatory gates:

  • The matrix, the corpus replay, and the equivalence check all pass against the unmodified code, and the corpus and its generator are committed, before the first refactor commit lands.
  • During the refactor, a matrix or corpus diff that you cannot explain is the regression that the net exists to catch. Stop and revert. Do not update the test to make it pass.
  • A deliberate behavior change updates the schema, the characterization test, and a written rationale in the same commit as the code. The diff between the old and new golden artifacts is the reviewable record of each behavior change.
  • Run the net again after every rebase, because concurrent work on the same files changes the baseline.

1. Decide whether the net applies

Build the net when the refactor does one of these:

  • collapses or moves a seam: two code paths that produce the same output, a coordinate translation layer, or a protocol boundary;
  • keeps an observable contract that code you do not change consumes: a wire schema, a projection shape, or a client;
  • touches a surface with a history of incidents, such as session loading or output hydration.

Skip it for pure renames, dead-code removal, and changes that wire-level tests already pin. The net costs a medium-sized phase, so spend it only where a silent regression costs more.

2. Write the contract inventory

Before any test exists, write each contract that the refactor can break into the plan document with a file:line citation. Sort each contract into one category:

Category Definition Protection
A: untouched by design Contracts keyed on stable identity and structurally outside the change, such as identity-keyed lazy tool-body expansion or per-kind wire shapes Point characterization tests that pass unchanged before and after
B: implicit equivalence Two code paths that must agree while nothing enforces it, such as a block rendered live and the same block replayed later An executable equivalence check (step 5)
C: the change surface Contracts keyed on the thing that the refactor changes: coordinates, offsets, routing decisions The full characterization matrix (step 3) and the golden corpus (step 4)

Read the full file on GitHub · 92 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 28d ago First seen · 92 lines · 17 tokens per session scan A 704dd9f23e29

Subscribe to this mod's changes

refactor-safety-net is a skill published in the GitHub repository wsauret/flywheel (19 stars, last pushed today), licensed Apache-2.0. It adds 17 tokens to every session and 1,691 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-03.

Related

refactor-safety-net compared with skills from other repositories

refactor-safety-net next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
refactor-safety-netwsauret/flywheelSkill19todayApache-2.0A17Claude Code, Codex
investigateAbyssCN/oh-my-dagSkill441mo agoMITA77Claude Code, Codex
test-fixture-designerlfyxhappy/lfcodeSkill22mo agoMITA60Claude Code, Codex
unit-test-engineerlfyxhappy/lfcodeSkill22mo agoMITA58Claude Code, Codex
codew-release-qa-sweepHmbown/CodeWhaleSkill41k2d agoMITA31Claude Code, Codex
gh-find-prsHmbown/CodeWhaleSkill41k2d agoMITA27Claude Code, Codex
contributor-onboardingHmbown/CodeWhaleSkill41k2d agoMITA57Claude Code, Codex