refactoring

refactoring is a skill for Codex from kreek/consult. It costs 25 tokens per session (774 once invoked), scanned A, original, MIT.

A set of rules for changing a program's internal structure while keeping its behavior the same. Refactoring includes work such as renaming, extracting code, moving modules, or migrating callers without changing what users experience.

In plain words
What is it for?
Use it for legacy refactors, large renames, code extraction, migrations, characterization tests, branch-by-abstraction, or planning a safer alternative to a full rewrite.
Why use it?
It reduces the risk of breaking existing behavior by requiring tests before and after each small step. It also keeps structural changes separate from feature changes so problems are easier to identify and reverse.

Skill for Codex

Written for Codex: agents/openai.yaml present. Also seen: installed under .agents/ (shared by several agents).

Good fit Use it for legacy refactors, large renames, code extraction, migrations, characterization tests, branch-by-abstraction, or planning a safer alternative to a full rewrite.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kreek/consult/refactoring
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 kreek/consult --skill refactoring
Clone the repo
git clone --depth 1 https://github.com/kreek/consult

Made for: 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 refactoring

README.md
[![agentmods](https://agentmods.dev/badge/skills/kreek/consult/refactoring/github.svg)](https://agentmods.dev/skills/kreek/consult/refactoring)
Your own site
<a href="https://agentmods.dev/skills/kreek/consult/refactoring"><img src="https://agentmods.dev/badge/skills/kreek/consult/refactoring/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 refactoring

Your own site · 80×15
<a href="https://agentmods.dev/skills/kreek/consult/refactoring"><img src="https://agentmods.dev/badge/skills/kreek/consult/refactoring.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 25 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 774 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.00025 $0.00774
Opus 5.5 $0.00010 $0.00310
Sonnet 5.5 $0.00005 $0.00155
Haiku 4.5 $0.00003 $0.00077

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

Security

Grade A, and why

refactoring 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 16d 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.

agents/.agents/skills/refactoring/SKILL.md · 70 lines

How it starts

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

Refactoring

Iron Law

GREEN BEFORE THE REFACTOR. GREEN AFTER EACH STEP. NEVER MIX STRUCTURE AND BEHAVIOR IN ONE COMMIT.

When to Use

  • Changing structure while preserving behavior: legacy refactors, large renames, extractions, migrations, branch by abstraction, strangler fig, characterization tests, big-bang rewrite avoidance.

When NOT to Use

  • Behavior-first feature work; use proof.
  • Commit grouping or history surgery after changes exist; use commit or git-workflow.

Rules

  1. Every commit is structural or behavioral, never both. Opportunistic tweaks and behavior fixes go in separate behavior commits or are left out.
  2. Name the coupling being separated (data shape, side effect, module boundary, ownership, time, transport, persistence, compatibility) before code moves. "Extract a helper to shorten this" is not a named coupling.
  3. Each behavior-preservation claim gets a Proof Contract: unchanged behavior, invariant, public boundary, before/after check, evidence. Add characterization tests where coverage is missing. An unproven refactor is reported as unproven.
  4. For public interfaces, use parallel change: expand, migrate callers, contract. Ask which callers, data, and releases must keep working before adding shims, dual paths, or migration machinery.
  5. Delete old paths only when verification proves callers and traffic have moved. Leftover migration or deletion work has an owner and a deadline.
  6. For broad renames, write a rename map first, separating private symbols, file paths, runtime and public keys, persisted names, docs, and compatibility cleanup.
  7. Shorter is simpler only when it hides no state, effect, compatibility, ownership, or independent behavior. Simplification removes complexity with a named cost: hidden mutable state, unnecessary layer, broad helper, scattered behavior, compatibility shim, dead flag, duplicated rule with divergent meaning.
  8. Deleted tests are replaced by equal or stronger behavior coverage.
  9. No big-bang rewrites. Take the next safe slice or a branch-by-abstraction path; the system is shippable at every commit.

Read the full file on GitHub · 70 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 16d ago Changed · +6 tokens per session a97e6d62c4fb
  2. 1mo ago Changed · -30 lines a8f8b92a4e0b
  3. 1mo ago First seen · 100 lines · 19 tokens per session scan A e810cdadbc1b

Subscribe to this mod's changes

refactoring is a skill published in the GitHub repository kreek/consult (1 stars, last pushed 17d ago), licensed MIT. It adds 25 tokens to every session and 774 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-08-31.

Related

Other skills, from other repositories

arch-review

Team baseline for architecture, design-doc, and RFC review — produces summary, strengths, concerns, and open questions. Auto-triggers when you say review this design, review this architecture, review this proposal, review my RFC, poke holes in this proposal, is this design sound, or critique this tech spec. Defers to…

ramboz/jig · 207 tokens

clarify

Lightweight spec clarification scan for jig projects — a six-category ambiguity audit that asks up to five prioritized questions and appends them to the spec's ## Clarifications section. Auto-triggers when you say clarify this spec, audit this spec for ambiguities, is this spec ready for review, find unknowns in this…

ramboz/jig · 153 tokens

explain

Explain jig vocabulary and artifacts in plain language. Three modes: term mode defines one lexicon term; artifact mode walks through a spec or ADR and its linked references; passage mode explains pasted jig output. Output is ephemeral (chat-only). Auto-triggers when you say explain this term, walk me through this…

ramboz/jig · 173 tokens

pr-review

Team baseline for PR and code review — produces scope, blockers, nits, and strengths. Auto-triggers when you say review this PR, check this diff, review these changes, pre-review before I share, what do you think of this PR, or review the diff on this branch. Defers to any other installed skill whose description…

ramboz/jig · 183 tokens

security-review

Team baseline for security review — a best-effort heuristic security pass over a diff or change-set. Auto-triggers for review this for security, any vulnerabilities here, security pass on this diff, is this code secure, check this for security issues, or security review this. Uses installed scanners when available…

ramboz/jig · 147 tokens

contracts

Team baseline for external-interface contract artifacts: OpenAPI, JSON Schema, AsyncAPI, .proto, and GraphQL SDL, with spectral, ajv, buf, and graphql-inspector validation. Nudges devs toward contract-first artifacts; never writes them and never scaffolds a contracts/ directory. Auto-triggers for what contract should…

ramboz/jig · 163 tokens