refactor

refactor is a skill for Claude Code from rtazima/claude-proj-blueprint. It costs 53 tokens per session (1,099 once invoked), scanned A, original, MIT.

A workflow for changing a program's internal structure without changing what it does. It covers operations such as extracting functions, splitting files, renaming code, and moving modules.

In plain words
What is it for?
Use it when simplifying architecture, separating responsibilities, moving or renaming code, or extracting repeated logic while preserving existing behavior.
Why use it?
It makes structural changes safer by requiring tests to pass before and after each change. It also helps keep imports, documentation, and architectural decisions up to date.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: mentions CLAUDE.md.

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/rtazima/claude-proj-blueprint/refactor
Any agent
npx skills add rtazima/claude-proj-blueprint --skill refactor
Clone the repo
git clone --depth 1 https://github.com/rtazima/claude-proj-blueprint

Made for: Claude Code.

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 refactor

README.md
[![agentmods](https://agentmods.dev/badge/skills/rtazima/claude-proj-blueprint/refactor.svg)](https://agentmods.dev/skills/rtazima/claude-proj-blueprint/refactor)
Your own site
<a href="https://agentmods.dev/skills/rtazima/claude-proj-blueprint/refactor"><img src="https://agentmods.dev/badge/skills/rtazima/claude-proj-blueprint/refactor.svg" alt="Measured on agentmods" height="20"></a>
Per session 53 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,099 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.1 $0.00053 $0.01099
Opus 5 $0.00026 $0.00549
Sonnet 5 $0.00011 $0.00220
Haiku 4.5 $0.00005 $0.00110

Measured 6d ago against content hash 9502e787c657, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

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 6d 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.

.claude/skills/refactor/SKILL.md · 99 lines

How it starts

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

Refactoring

Change code structure without changing behavior. Tests must pass before AND after. This is NOT the slop-cleaner (cosmetic). Refactoring is structural/architectural.

Rules

  1. Tests green before starting — if tests don't pass, fix them first (that's debugging, not refactoring)
  2. One refactoring at a time — don't mix extract-function with rename with move-file
  3. Commit between refactorings — each structural change gets its own commit
  4. Tests green after each change — run tests after every refactoring step
  5. ADR for architectural changes — if the refactoring changes module boundaries, create an ADR
  6. Update imports/references — grep the entire codebase for references to moved/renamed items
  7. Update docs — CLAUDE.md module map, README project structure if files moved

Refactoring Catalog

Extract

What When How
Extract function Logic repeated in 2+ places, or function > 30 lines Identify the cohesive block, extract, name by intent
Extract module/file File > 300 lines or has 2+ distinct responsibilities Identify responsibility boundaries, split, update imports
Extract interface/type Concrete type used in 3+ places, or to enable mocking Define interface, make existing code implement it
Extract constant/config Magic numbers or strings used in multiple places Move to config or constants file, reference everywhere

Move

What When How
Move function Function is in the wrong module (called more from elsewhere) Move, update all imports (grep -r "functionName" src/)
Move file File doesn't belong in its current directory Move, update all imports, update CLAUDE.md if module map changes

Rename

What When How
Rename variable/function Name doesn't describe intent, or naming convention changed Rename in definition AND all references
Rename file File name doesn't match its content or convention Rename, update all imports

Read the full file on GitHub · 99 lines

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. 6d ago First seen · 99 lines · 53 tokens per session scan A 9502e787c657

Subscribe to this mod's changes

refactor is a skill published in the GitHub repository rtazima/claude-proj-blueprint (20 stars, last pushed 3mo ago), licensed MIT. It adds 53 tokens to every session and 1,099 once invoked, about $0.0003 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-30.

Related

Other skills, from other repositories