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

Written for no agent in particular: nothing here depends on one. Also seen: mentions subagents; installed under .agents/ (shared by several agents).

Good fit It helps reorganize code, remove duplication and dead code, reduce oversized files, preserve behavior through tests, and correct documentation inconsistencies.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/incommensurablehubris/fullstack-director/08-refactor
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 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/github.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/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 08-refactor

Your own site · 80×15
<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="Reviewed on agentmods" width="80" 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. 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.00244 $0.03861
Opus 5.5 $0.00098 $0.01544
Sonnet 5.5 $0.00049 $0.00772
Haiku 4.5 $0.00024 $0.00386

Measured 1mo ago against content hash 394d968baf55, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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 INLINE — 08'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. 1mo 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 2mo ago), licensed MIT. It adds 244 tokens to every session and 3,861 once invoked, about $0.0010 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

bmad-architecture

Work out and record the architecture decisions that keep separately built parts of a system consistent, in a short architecture document. Creates, updates, or validates one; works from a ticket file, with an existing codebase or architecture document beside it. Use when the user says "create the architecture", "create…

bmad-code-org/BMAD-METHOD · 79 tokens

bmad-prd

Create, update, or validate a PRD. Use when the user wants help producing, editing, or validating a PRD.

bmad-code-org/BMAD-METHOD · 30 tokens

bmad-prfaq

Test a product concept with Amazon's Working Backwards method: write the press release for the finished product first, then answer hard customer and stakeholder questions, ending in a complete PRFAQ document. Use when the user requests to 'create a PRFAQ', 'work backwards', or 'run the PRFAQ challenge'.

bmad-code-org/BMAD-METHOD · 67 tokens

bmad-product-brief

Create, update, or validate a product brief. Use when the user wants help producing, editing, or validating a brief.

bmad-code-org/BMAD-METHOD · 30 tokens

bmad-project-context

Set up, adopt, refresh, or audit a repository's agent instructions (the AGENTS.md block) so AI agents work well in that repo. Also records observed agent mistakes as pitfalls. Use when invoked by name.

bmad-code-org/BMAD-METHOD · 48 tokens

bmad-ux

Capture the user's UX vision in two documents: DESIGN.md for how the product looks and EXPERIENCE.md for how it behaves. Use when the user says "lets create UX design" or "create UX specifications" or "help me plan the UX".

bmad-code-org/BMAD-METHOD · 54 tokens