refactoring

refactoring is a skill for Claude Code, Codex from scolladon/craft. It costs 38 tokens per session (482 once invoked), scanned A, original, MIT.

A software-maintenance step that reviews the wider codebase for structural improvements while keeping its behavior unchanged. It looks beyond the files directly changed by a feature.

In plain words
What is it for?
Use it to assess whether code should be shared, moved, or reorganized after a feature is built, while avoiding speculative changes.
Why use it?
A feature can reveal duplicated code or responsibilities placed in the wrong layer that a narrow review would miss. It can also record that no safe improvement was needed.

Skill for Claude CodeCodex

Part of the craft plugin — 20 skills, 4 commands, 18 agents, 1 hook shipped together

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.

agentmods
npx agentmods add skills/scolladon/craft/refactoring
Any agent
npx skills add scolladon/craft --skill refactoring
Clone the repo
git clone --depth 1 https://github.com/scolladon/craft

Made for: Claude Code, Codex.

Or install craft, the plugin that ships this one along with the rest of its 20 skills, 4 commands, 18 agents, 1 hook.

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/scolladon/craft/refactoring.svg)](https://agentmods.dev/skills/scolladon/craft/refactoring)
Your own site
<a href="https://agentmods.dev/skills/scolladon/craft/refactoring"><img src="https://agentmods.dev/badge/skills/scolladon/craft/refactoring.svg" alt="Measured on agentmods" height="20"></a>
Per session 38 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 482 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00038 $0.00482
Opus 5 $0.00019 $0.00241
Sonnet 5 $0.00008 $0.00096
Haiku 4.5 $0.00004 $0.00048

Measured 3d ago against content hash 37ca005f8e05, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 3d 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.

skills/refactoring/SKILL.md · 35 lines

What it actually says

craft:refactoring

Preamble (always runs — non-overridable)

  1. Manifest read (lint if standalone); gates as in implementation's preamble.

Procedure (default body — a manifest override: replaces everything below)

  1. Judgment — session-owned, in-thread: quick candidate scan seeded by the feature's diff, radiating only as far as the feature's concerns reach: duplication now warranting centralization, responsibilities in the wrong layer, the Nth consumer of a pattern that should become shared. Bounded by YAGNI/KISS — no speculative abstraction.
  2. Nothing clears the bar → first-class no-op. Record NO-OP(refactoring): nothing cleared the bar — <justification> in the run record, the 1–3 line justification stating what was considered and why nothing changed; the run record is carried into the PR body (documentation phase), so the no-op is stated, not hidden. This is a recorded outcome symmetric with the decisions phase's NO-OP(decisions): line — same token, kept idiom — not an implicit skip. Spawning an agent merely to conclude no-op is forbidden waste. A silent skip is not allowed.
  3. Candidates survive → scope each into a precise spec (what moves where, which symbols/files, expected mechanical test changes, blast radius), then spawn craft:refactor-executor with the specs, gates, and context files. Integrate-don't-defer: in-scope gains land NOW in this change; only a genuinely feature-sized refactor (own design + ADRs) becomes a follow-up entry.
  4. Re-review, scoped to the refactor diff only, via craft:review's procedure (same dimensions, per-dimension convergence ≤3). Findings implying FURTHER refactoring become follow-ups, not another loop. gates.phase green to close.
  5. Order rationale: this runs BEFORE validation so validation scores the final shape.
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. 3d ago First seen · 35 lines · 38 tokens per session scan A 37ca005f8e05

Subscribe to this mod's changes

refactoring is a skill published in the GitHub repository scolladon/craft (2 stars, last pushed 15d ago), licensed MIT. It adds 38 tokens to every session and 482 once invoked, about $0.0002 per session on Opus 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

define

Manifest builder. Turns shared understanding into a verifiable Manifest with Deliverables, Acceptance Criteria, Global Invariants, and an Initial Approach. Use when planning features, scoping refactors, debugging complex issues, or when the user asks to define, scope, plan, spec out, make a manifest, or break down a…

doodledood/manifest-dev · 68 tokens

check-pr

Read-only inspection of a single GitHub PR lifecycle — checks CI, review threads, description sync, and mergeability, and returns PASS or FAIL with per-gate findings. Never invokes the merge button. Use when verifying a PR is ready to merge, polling lifecycle progress, checking mergeability, or babysitting a GitHub PR…

doodledood/manifest-dev · 74 tokens

babysit-pr

Author-side PR lifecycle babysitter and companion to review-pr. Use when the user wants to tend an existing GitHub PR through CI, review threads, description sync, mergeability, auto-fixes, or asks to babysit a PR with or without an existing manifest.

doodledood/manifest-dev · 59 tokens

review-code

Review a change along one specific quality dimension — bugs, design, simplicity, maintainability, testability, test quality, type safety, contracts, operational readiness, docs, prose value, change intent, defect-class completeness after a fix, or CLAUDE.md adherence. Loads exactly one dimension reference and audits…

doodledood/manifest-dev · 103 tokens

just-define

Goal-based Manifest builder. Encodes shared understanding into a verifiable Manifest — Deliverables, Acceptance Criteria, Global Invariants — deciding for itself how to interview. Use when the user asks to just define it, spec it lean, or make a manifest with minimal process.

doodledood/manifest-dev · 58 tokens

update-lid

Configure or reconcile a project for linked-intent development (LID). Dispatches on project state — fresh bootstrap, append directives to an existing agent-instructions file (AGENTS.md or CLAUDE.md), add missing mode marker, reconcile convention drift, or run mode transitions. Invoked as /update-lid. For fresh…

jszmajda/lid · 105 tokens