spec-driven-refactoring

spec-driven-refactoring is a skill for Claude Code, Codex from Arasz/ai-raccoon. It costs 80 tokens per session (3,127 once invoked), scanned A, original, MIT.

A structured workflow for large code refactors, such as renaming a concept or changing a data schema across many files. It writes a specification and checks the plan before and after implementation.

In plain words
What is it for?
Use it for schema migrations, broad renames, and reorganising code that affects five or more files, including tests and docs.
Why use it?
Large changes can leave old assumptions in schemas, scripts, tests, or documentation. The review gates help find those inconsistencies before they spread.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions subagents.

Good fit Use it for schema migrations, broad renames, and reorganising code that affects five or more files, including tests and docs.

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

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 spec-driven-refactoring

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/arasz/ai-raccoon/spec-driven-refactoring"><img src="https://agentmods.dev/badge/skills/arasz/ai-raccoon/spec-driven-refactoring.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 80 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,127 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.00080 $0.03127
Opus 5.5 $0.00032 $0.01251
Sonnet 5.5 $0.00016 $0.00625
Haiku 4.5 $0.00008 $0.00313

Measured yesterday against content hash 7f63e3239c53, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

spec-driven-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 yesterday.

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.

.ai-badger/skills/spec-driven-refactoring/SKILL.md · 257 lines

How it starts

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

Spec-Driven Refactoring

Large refactors (schema migrations, concept renames, structural reorganizations) have more surface area for stale assumptions than normal features. This workflow adds two review gates to catch inconsistencies before they compound.

When to use

  • Multi-file structural changes (5+ files across schemas, scripts, tests, docs)
  • Schema migrations (field renames, type changes, file relocations)
  • Concept renames that ripple through the entire codebase
  • Any refactor where "I thought X was at line Y" mistakes would be expensive

Procedure

1. Analyze

Read all affected files. Identify every contract the refactor touches:

  • Schemas (JSON Schema, TypeScript interfaces, etc.)
  • Scripts (build, scaffold, validate, install)
  • Tests (which test files reference the old structure)
  • Docs (architecture docs, authoring guides, README)

2. Write spec

Produce a markdown specification covering:

  • Problem statement — what's wrong and why
  • Design decisions — numbered, explicit choices with rationale
  • Proposed structure — new/modified/removed files in a table
  • Schemas — full JSON Schema definitions for new contracts
  • Implementation order — phased, with validation gates between phases
  • Risks — what could go wrong

Save to docs/specs/ (or project equivalent).

3. Spec review

Delegate a review sub-agent. Feed it the spec + all key context files. Ask it to check:

  • Logical gaps or missing pieces
  • Naming consistency (especially across old→new renames)
  • Migration path correctness
  • Schema completeness and self-consistency
  • Implementation order dependencies (does Phase 2 need Phase 1's output?)

Categorize findings: Critical / Medium / Low. Return GO/NO-GO with conditions.

4. Fix spec findings

Address all Critical and Medium findings. Low findings can be deferred to implementation but should be tracked in the spec's review tracker.

5. Pre-implementation consistency check

Delegate a SECOND sub-agent to verify the spec's claims against the actual codebase:

  • Do claimed line numbers match?
  • Do file paths exist?
  • Do schema fields match the spec's descriptions?
  • Do test files reference the paths the spec claims?
  • Are there files the spec forgot to mention?

Read the full file on GitHub · 257 lines

Files

What ships with it

4 files 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. yesterday First seen · 257 lines · 80 tokens per session scan A 7f63e3239c53

Subscribe to this mod's changes

spec-driven-refactoring is a skill published in the GitHub repository Arasz/ai-raccoon (7 stars, last pushed today), licensed MIT. It adds 80 tokens to every session and 3,127 once invoked, about $0.0003 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-12-05.

Related

spec-driven-refactoring compared with skills from other repositories

spec-driven-refactoring next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
spec-driven-refactoringArasz/ai-raccoonSkill7todayMITA80Claude Code, Codex
qualityariaxhan/kernel-claudeSkill16yesterdayMITA41Claude Code
tearitapartariaxhan/kernel-claudeSkill16yesterdayMITA43Claude Code
memory-to-skillzilliztech/memsearchSkill3.0k2d agoMITA82Claude Code, Codex
huggingface-vision-trainerwaybarrios/opencode-power-packSkill5625d agoMITA48Claude Code
semgrep-rule-variant-creatorwaybarrios/opencode-power-packSkill5625d agoMITA50Claude Code
huggingface-paper-publisherwaybarrios/opencode-power-packSkill5625d agoMITA42Claude Code