refactoring-surgeon

refactoring-surgeon is a skill for Claude Code from curiositech/some_claude_skills. It costs 75 tokens per session (1,595 once invoked), scanned A, original, MIT.

A code-refactoring guide for improving a program's structure and readability while keeping its behaviour unchanged.

In plain words
What is it for?
Use it to extract methods or classes, simplify conditionals, reorganize code, replace magic numbers, and migrate legacy code in small tested steps.
Why use it?
It provides a safety-focused way to address code smells and technical debt without accidentally adding features or changing what the software does.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit Use it to extract methods or classes, simplify conditionals, reorganize code, replace magic numbers, and migrate legacy code in small tested steps.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/curiositech/some_claude_skills/refactoring-surgeon
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 curiositech/some_claude_skills --skill refactoring-surgeon
Clone the repo
git clone --depth 1 https://github.com/curiositech/some_claude_skills

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 refactoring-surgeon

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/curiositech/some_claude_skills/refactoring-surgeon"><img src="https://agentmods.dev/badge/skills/curiositech/some_claude_skills/refactoring-surgeon.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 75 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,595 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00075 $0.01595
Opus 5 $0.00037 $0.00797
Sonnet 5 $0.00015 $0.00319
Haiku 4.5 $0.00007 $0.00160

Measured 8d ago against content hash 0d556fca5c55, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

refactoring-surgeon 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 8d ago.

The scan reads SKILL.md. This mod also ships 5 executable files (references/extract-method.ts, references/introduce-parameter-object.ts, references/replace-conditional-polymorphism.ts, …), 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.

.claude/skills/refactoring-surgeon/SKILL.md · 174 lines

How it starts

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

Refactoring Surgeon

Expert code refactoring specialist focused on improving code quality without changing behavior.

Quick Start

  1. Ensure tests exist - Never refactor without a safety net
  2. Identify the smell - Name the specific code smell you're addressing
  3. Make small changes - One refactoring at a time, commit frequently
  4. Run tests after each change - Behavior must remain identical
  5. Don't add features - Refactoring ≠ enhancement
  6. Document significant changes - Explain the "why" for future maintainers

Core Capabilities

Category Techniques
Extraction Extract Method, Extract Class, Extract Interface
Movement Move Method, Move Field, Inline Method
Simplification Replace Conditional with Polymorphism, Decompose Conditional
Organization Introduce Parameter Object, Replace Magic Numbers
Legacy Migration Strangler Fig, Branch by Abstraction, Parallel Change

Code Smells Reference

Bloaters

┌─────────────────────┐    ┌─────────────────────┐    ┌─────────────────────┐
│    Long Method      │    │    Large Class      │    │   Long Parameter    │
│  > 20 lines?        │    │  > 200 lines?       │    │       List          │
│  → Extract Method   │    │  → Extract Class    │    │  → Parameter Object │
└─────────────────────┘    └─────────────────────┘    └─────────────────────┘

OO Abusers

┌─────────────────────┐    ┌─────────────────────┐    ┌─────────────────────┐
│  Switch Statements  │    │   Refused Bequest   │    │   Parallel          │
│  Type-checking?     │    │  Unused inheritance?│    │   Hierarchies       │
│  → Polymorphism     │    │  → Delegation       │    │  → Move Method      │
└─────────────────────┘    └─────────────────────┘    └─────────────────────┘

Change Preventers

┌─────────────────────┐    ┌─────────────────────┐
│  Divergent Change   │    │  Shotgun Surgery    │
│  One class, many    │    │  One change, many   │
│  reasons to change? │    │  classes affected?  │
│  → Extract Class    │    │  → Move/Inline      │
└─────────────────────┘    └─────────────────────┘

Read the full file on GitHub · 174 lines

Files

What ships with it

6 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. 8d ago First seen · 174 lines · 75 tokens per session scan A 0d556fca5c55

Subscribe to this mod's changes

refactoring-surgeon is a skill published in the GitHub repository curiositech/some_claude_skills (221 stars, last pushed 5d ago), licensed MIT. It adds 75 tokens to every session and 1,595 once invoked, about $0.0004 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-09-03.