08-refactor

08-refactor is a skill for Claude Code, Codex from IncommensurableHubris/fullstack-director. It costs 244 tokens per session (3,861 once invoked), scanned A, original, MIT.

A code-refactoring workflow for improving a program’s internal structure while keeping its behavior unchanged. It also reconciles related project documents when the refactor reveals contradictions.

In plain words
What is it for?
It helps reorganize code, remove duplication and dead code, reduce oversized files, preserve behavior through tests, and correct documentation inconsistencies.
Why use it?
It addresses accumulated structural debt such as duplicated code, unused code, oversized files, and outdated documentation without turning the work into a rewrite.

Skill for Claude CodeCodex

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/incommensurablehubris/fullstack-director/08-refactor
Any agent
npx skills add IncommensurableHubris/fullstack-director --skill 08-refactor
Clone the repo
git clone --depth 1 https://github.com/IncommensurableHubris/fullstack-director

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 08-refactor

README.md
[![agentmods](https://agentmods.dev/badge/skills/incommensurablehubris/fullstack-director/08-refactor.svg)](https://agentmods.dev/skills/incommensurablehubris/fullstack-director/08-refactor)
Your own site
<a href="https://agentmods.dev/skills/incommensurablehubris/fullstack-director/08-refactor"><img src="https://agentmods.dev/badge/skills/incommensurablehubris/fullstack-director/08-refactor.svg" alt="Measured on agentmods" height="20"></a>
Per session 244 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,861 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.00244 $0.03861
Opus 5 $0.00122 $0.01930
Sonnet 5 $0.00049 $0.00772
Haiku 4.5 $0.00024 $0.00386

Measured 4d ago against content hash 394d968baf55, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

08-refactor 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 4d ago.

The scan reads SKILL.md. This mod also ships 11 executable files (evals/build_fixture.py, evals/check_refactor.py, evals/fixtures/app/src/auth.js, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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/skills/08-refactor/SKILL.md · 167 lines

How it starts

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

08 · Refactor — improve structure, preserve behavior, reconcile

A cross-cutting refactor activity (named by function, not an SDLC seat — like status). It fills the gap between 05's within-sprint tidy and a rewrite: after several sprints, structural debt accrues that no one sprint owns — cross-cutting duplication, dead code, god files, doc drift. 08 improves structure while preserving behavior, reconciles the realization docs, and appends amendment rows only where a refactor surfaces a declaration contradiction.

Kent Beck's rule frames it: "For each desired change, make the change easy (warning: this may be hard), then make the easy change." 08 is the first half — it makes future change easy by improving structure without changing what the software does. Its graded value is not "cleaner code" (a strong engineer writes that too). It is the provably behavior-preserving change + the correctly-routed reconcile (a local doc fix vs a gated spine amendment) that /status and the release gate can trust.

The seat's two defining properties

  • Sequential — no subagents. shared/subagent-protocol.md: "Build and refactor stay sequential." The health pass is a single sequential read, not a parallel panel; Reconcile runs INLINE08's Reconcile-sibling is 02 (the first inline appender), not 03 (which spawns a subagent). Nothing here spawns.
  • Appender — but most findings are local. shared/spec-amendment-protocol.md: the appenders are 00 / 02 / 03 / 08. 08 emits amendment-log.json rows — but only for declaration-level findings. A code↔doc drift is a realization fix, corrected locally, never an amendment.

Operating principle — improve structure, preserve behavior, reconcile locally, escalate only declarations

  • Two Hats (Fowler). Either you change structure or behavior — never both in a commit. A bug found mid-refactor routes to /05; a vuln to /07; a feature to /04. 08 fixes none of them — it notes and routes. A smell is 08's iff it is maintainability, not a bug, a vuln, or missing behavior.
  • Behavior preservation is the non-negotiable gate (below) — the safety-net oracle, unchanged, green before and after, and still biting. This is 08's honesty gate, the analog of 05's EXECUTED gate.
  • Baby steps + explicit move-typing. One named move (Extract Method/Module, Move, Inline, Rename, Replace Conditional…) → run the oracle → commit, or revert-don't-debug. Telling the model the exact move type is the single biggest accuracy lever (ICSE: 15.6%→86.7% vs "clean this up").
  • Reconcile: critic, not builder. Bound findings to "changes this slice / violates the contract." A clean, healthy slice yields ~zero refactors and ~zero amendments — surfacing invented ones is the crying-wolf failure mode.

Read the full file on GitHub · 167 lines

Files

What ships with it

38 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. 4d ago First seen · 167 lines · 244 tokens per session scan A 394d968baf55

Subscribe to this mod's changes

08-refactor is a skill published in the GitHub repository IncommensurableHubris/fullstack-director (5 stars, last pushed 24d ago), licensed MIT. It adds 244 tokens to every session and 3,861 once invoked, about $0.0012 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

gsd-audit-milestone

Audit milestone completion against original intent before archiving.

open-gsd/gsd-core · 17 tokens

spec-kitty-charter-doctrine

Run charter interview, generation, context, and sync workflows for project governance in Spec Kitty 3.x. Access doctrine artifacts programmatically via DoctrineService. Resolve agent profiles. Load action-scoped governance context iteratively, not all at once. Triggers: "interview for charter", "generate charter"…

Priivacy-ai/spec-kitty · 135 tokens

spec-kitty-spdd-reasons

Drive REASONS Canvas authoring and review for Spec Kitty missions that opted in to Structured-Prompt-Driven Development (SPDD) via charter selection. Triggers: "use SPDD", "use REASONS", "generate a REASONS canvas", "apply structured prompt driven development", "make this mission SPDD". Does NOT handle: enforcing SPDD…

Priivacy-ai/spec-kitty · 118 tokens

conductor-implement

Executes the tasks defined in the specified track's plan. Use this to start or continue working on a feature, bug fix, or chore.

gemini-cli-extensions/conductor · 34 tokens

dependency-upgrade

Plan, batch, and verify dependency upgrades safely. Triages outdated packages into risk tiers, upgrades in order (dev/minor/patch first, runtime majors last), verifies each batch, and produces an auditable commit sequence. Use when asked to "upgrade deps", "bump packages", "update nodemodules", "fix vulnerabilities"…

open-gsd/gsd-pi · 90 tokens

forensics

Post-mortem a failed GSD auto-mode run. Traces symptom to root cause via .gsd/ activity, journal, metrics, and lock artifacts, producing a filing-ready bug report with file:line refs and a fix suggestion. Use when asked to "forensics", "post-mortem", "why did auto-mode fail", "trace the stuck loop", "debug the crash"…

open-gsd/gsd-pi · 112 tokens