Agent skill

Refactoring Surgeon

by curiositech in curiositech/some_claude_skills

Expert code refactoring specialist for improving code quality without changing behavior.

MITAuto-check passedDevelopment

Install Refactoring Surgeon

skills CLI
$ npx skills add curiositech/some_claude_skills --skill refactoring-surgeon -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install curiositech/some_claude_skills refactoring-surgeon --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/curiositech/some_claude_skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/refactoring-surgeon .claude/skills/refactoring-surgeon && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
refactoring-surgeon
GitHub stars
243
Token cost
~1.6k tokens
SKILL.md length
495 words
Files
8 (incl. scripts, references)
Skills in repo
95
Repo updated
First seen
Licence
MIT

At a glance

Expert code refactoring specialist for improving code quality without changing behavior.

  • Works in 10 steps: Big Bang Refactoring → Refactoring Without Tests → Premature Abstraction → …
  • Tasks that involve Refactoring
  • SKILL.md covers Quick Start, Core Capabilities, Code Smells Reference and Reference Examples, plus 5 more sections
  • Runs TypeScript and Shell scripts from its folder

What it does

Refactoring Surgeon is an agent skill from curiositech/some_claude_skills. Expert code refactoring specialist for improving code quality without changing behavior. Activate on: refactor, code smell, technical debt, legacy code, cleanup, simplify, extract method, extract class, DRY, SOLID principles. NOT for: new feature development (use feature skills), bug fixing (use debugging skills), performance optimization (use performance skills).

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 10 other files, including scripts and reference files (for example `.claude-plugin/plugin.json`, `CHANGELOG.md` and `references/extract-method.ts`).

It sits in Development, covering Refactoring. The repository describes itself as: Claude skills that make my life easier. The licence is MIT.

When your agent uses it

  • Tasks that involve Refactoring

Example prompts

  • “/refactoring-surgeon”

Requirements

  • Node.js
  • A Bash shell
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Bash(npm test:*,npm run lint:*,git:*)

Workflow steps

10 steps, taken from the step headings in SKILL.md.

  1. Big Bang Refactoring
  2. Refactoring Without Tests
  3. Premature Abstraction
  4. Renaming Without IDE Support
  5. Mixing Refactoring and Features
  6. Ignoring Code Reviews
  7. Over-Abstracting
  8. Incomplete Refactoring
  9. Refactoring Production During Incidents
  10. Not Measuring Improvement

What it can do on your machine

Read from SKILL.md and the folder at commit 6713fc7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Bash(npm test:*
    • npm run lint:*
    • git:*)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (TypeScript and Shell), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • refactoring.guru
    • refactoring.com
    • oreilly.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Refactoring Surgeon loads about 1.6k tokens when it runs, and up to ~10k if it reads all its reference files. Until then it costs about 97 tokens; SKILL.md has 495 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~97
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~10k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from curiositech/some_claude_skills at commit 6713fc7, republished under its MIT licence (© curiositech). 495 words, ~1,605 tokens.

Download SKILL.mdSave it as .claude/skills/refactoring-surgeon/SKILL.md (or your agent's skills folder). This skill also uses 7 other files; get the full folder from GitHub.
name
refactoring-surgeon
description
Expert code refactoring specialist for improving code quality without changing behavior. Activate on: refactor, code smell, technical debt, legacy code, cleanup, simplify, extract method, extract class, DRY, SOLID principles. NOT for: new feature development (use feature skills), bug fixing (use debugging skills), performance optimization (use performance skills).
allowed-tools
Read, Write, Edit, Bash(npm test:*,npm run lint:*,git:*)
metadata.category
Code Quality & Testing
metadata.tags
refactoring, code-smells, solid, dry, cleanup

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

CategoryTechniques
ExtractionExtract Method, Extract Class, Extract Interface
MovementMove Method, Move Field, Inline Method
SimplificationReplace Conditional with Polymorphism, Decompose Conditional
OrganizationIntroduce Parameter Object, Replace Magic Numbers
Legacy MigrationStrangler 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      │
└─────────────────────┘    └─────────────────────┘

Reference Examples

Complete refactoring examples in ./references/:

FilePatternUse Case
extract-method.tsExtract MethodLong methods → focused functions
replace-conditional-polymorphism.tsReplace Conditionalswitch/if → polymorphic classes
introduce-parameter-object.tsParameter ObjectLong params → structured objects
strangler-fig-pattern.tsStrangler FigLegacy code → gradual migration

Anti-Patterns (10 Critical Mistakes)

1. Big Bang Refactoring

Symptom: Rewriting entire modules in one massive change Fix: Strangler fig pattern, small incremental changes with tests

2. Refactoring Without Tests

Symptom: Changing structure without test coverage Fix: Write characterization tests first, add coverage for affected areas

3. Premature Abstraction

Symptom: Creating generic frameworks "for future flexibility" Fix: Wait for three concrete examples before abstracting (Rule of Three)

4. Renaming Without IDE Support

Symptom: Find-and-replace that misses occurrences Fix: Use IDE refactoring tools, search for usages first

5. Mixing Refactoring and Features

Symptom: Adding new functionality while restructuring Fix: Separate commits - refactor first, then add features

6. Ignoring Code Reviews

Symptom: Large refactoring PRs that are hard to review Fix: Small, focused PRs with clear commit messages

7. Over-Abstracting

Symptom: Three layers of abstraction for a simple operation Fix: YAGNI - start concrete, abstract when patterns emerge

Show full SKILL.md (190 more words)Show less
8. Incomplete Refactoring

Symptom: Starting Extract Method but leaving partial duplication Fix: Complete the refactoring or revert - no half-measures

9. Refactoring Production During Incidents

Symptom: "I'll just clean this up while I'm here..." Fix: Never refactor during incidents - fix the bug, create a ticket

10. Not Measuring Improvement

Symptom: Refactoring without knowing if it helped Fix: Track metrics: complexity, test coverage, build time

Safety Checklist

Before Refactoring:

  • Code compiles/runs successfully
  • All tests pass
  • Test coverage is adequate for area being refactored
  • Commit current state (can rollback)

During Refactoring:

  • Make small, incremental changes
  • Run tests after each change
  • Keep behavior identical
  • Don't add features while refactoring

After Refactoring:

  • All tests still pass
  • No new warnings/errors
  • Code is more readable
  • Complexity metrics improved
  • Document significant changes

Quality Checklist

  • No behavior changes (tests prove this)
  • Improved readability
  • Reduced complexity (cyclomatic, cognitive)
  • Better adherence to SOLID principles
  • Removed duplication (DRY)
  • More testable code
  • Clear naming
  • Appropriate abstractions (not over-engineered)

Validation Script

Run ./scripts/validate-refactoring.sh to check:

  • Test coverage presence
  • Code smell indicators
  • Duplication patterns
  • Complexity metrics
  • SOLID violations
  • Refactoring safety (git, uncommitted changes)

External Resources

© curiositech, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 7 other files (scripts, references) in .claude/skills/refactoring-surgeon of curiositech/some_claude_skills.

  • SKILL.md
  • .claude-plugin/plugin.json
  • CHANGELOG.md
  • references/extract-method.ts
  • references/introduce-parameter-object.ts
  • references/replace-conditional-polymorphism.ts
  • references/strangler-fig-pattern.ts
  • scripts/validate-refactoring.sh

Open the folder on GitHubat commit 6713fc7

Compare with similar skills

Refactoring Surgeon next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Refactoring Surgeon compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Refactoring Surgeon this skillcuriositech/some_claude_skills243—~1.6kAutomated safety check: PassMIT
Guidelinesakash-network/node1.1k20 repos~577Automated safety check: PassMIT
Component Refactoringlangflow-ai/langflow155k—~3.5kAutomated safety check: PassMIT
Migrate Core Code to Submodulestinyhumansai/openhuman42k—~2.6kAutomated safety check: PassGPL-3.0
ast-grep Structural Searchcode-yeongyu/oh-my-openagent70k—~3.3kAutomated safety check: PassMIT
Systematic Code Refactoringluongnv89/claude-howto42k—~3kAutomated safety check: PassMIT

Similar skills

  • Guidelines

    akash-network/node

    Behavioral guidelines to reduce common LLM coding mistakes. An agent skill from akash-network/node.

    1.1k GitHub starsUsed in 20 repos~577 tokens
    DevelopmentAuto-check passed
  • Component Refactoring

    langflow-ai/langflow

    Refactor high-complexity React components in Langflow frontend.

    155k GitHub stars~3.5k tokensUpdated today
    DevelopmentAuto-check passed
  • Migrate Core Code to Submodules

    tinyhumansai/openhuman

    Plans and carries out moving non-host-specific code and its tests from the OpenHuman core into vendored tiny submodule libraries, then releases the submodule and re-pins the host.

    42k GitHub stars~2.6k tokensUpdated today
    DevelopmentAuto-check passed
  • ast-grep Structural Search

    code-yeongyu/oh-my-openagent

    Searches and rewrites code by syntax-tree shape across 25 languages with ast-grep, for codemods, structural queries and YAML lint rules, using a Python wrapper script.

    70k GitHub stars~3.3k tokensUpdated today
    DevelopmentAuto-check passed
  • Systematic Code Refactoring

    luongnv89/claude-howto

    Guides refactoring in phases based on Martin Fowler's method: research, test coverage check, planning and small tested steps, with your approval at each phase.

    42k GitHub stars~3k tokensUpdated 9 days ago
    DevelopmentAuto-check passed
  • Codex

    skills-directory/skill-codex

    A skill your agent uses when the user asks to run Codex CLI (codex exec, codex resume) or references OpenAI Codex for code analysis, refactoring, or automated editing

    1.5k GitHub starsUsed in 3 repos~1.8k tokens
    DevelopmentAuto-check passed

More from curiositech/some_claude_skills

All 95 skills in this repo
  • Crisis Detection Intervention AI

    curiositech/some_claude_skills

    Detect crisis signals in user content using NLP, mental health sentiment analysis, and safe intervention protocols.

    243 GitHub starsUsed in 2 repos~3.8k tokens
    Auto-check passed
  • Form Validation Architect

    curiositech/some_claude_skills

    End-to-end form handling with react-hook-form, Zod schemas, validation patterns, error messaging, field arrays, and multi-step wizards.

    243 GitHub stars~3.8k tokensUpdated 1 mo ago
    Auto-check passed
  • GitHub Actions Pipeline Builder

    curiositech/some_claude_skills

    Build production CI/CD pipelines with GitHub Actions. An agent skill from curiositech/some_claude_skills.

    243 GitHub stars~2.8k tokensUpdated 1 mo ago
    Auto-check: notes
  • Background Job Orchestrator

    curiositech/some_claude_skills

    Expert in background job processing with Bull/BullMQ (Redis), Celery, and cloud queues.

    243 GitHub stars~3.2k tokensUpdated 1 mo ago
    Auto-check passed
  • Competitive Cartographer

    curiositech/some_claude_skills

    Strategic analyst that maps competitive landscapes, identifies white space opportunities, and provides positioning recommendations.

    243 GitHub stars~1.3k tokensUpdated 1 mo ago
    Auto-check passed
  • Computer Vision Pipeline

    curiositech/some_claude_skills

    Build production computer vision pipelines for object detection, tracking, and video analysis.

    243 GitHub stars~4k tokensUpdated 1 mo ago
    Auto-check passed

Categories

Questions about Refactoring Surgeon

What does Refactoring Surgeon do?

Expert code refactoring specialist for improving code quality without changing behavior. Refactoring Surgeon is an agent skill from curiositech/some_claude_skills. Expert code refactoring specialist for improving code quality without changing behavior.

When should I use Refactoring Surgeon?

Refactoring Surgeon fits situations like: tasks that involve Refactoring.

How do I install Refactoring Surgeon in Claude Code?

Run `npx skills add curiositech/some_claude_skills --skill refactoring-surgeon -a claude-code`. Or copy the skill folder (.claude/skills/refactoring-surgeon in curiositech/some_claude_skills) into .claude/skills/refactoring-surgeon in your project. Claude Code loads it when a task matches its description.

How do I install Refactoring Surgeon in Codex?

Run `npx skills add curiositech/some_claude_skills --skill refactoring-surgeon -a codex`. Or copy the skill folder (.claude/skills/refactoring-surgeon in curiositech/some_claude_skills) into .agents/skills/refactoring-surgeon in your project. Codex loads it when a task matches its description.

Can I use Refactoring Surgeon in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add curiositech/some_claude_skills --skill refactoring-surgeon -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/refactoring-surgeon, .gemini/skills/refactoring-surgeon, .github/skills/refactoring-surgeon and .opencode/skills/refactoring-surgeon in your project.

What does Refactoring Surgeon need to run?

Going by SKILL.md and its folder, Refactoring Surgeon needs TypeScript and a shell for the scripts in its folder. Our summary lists: Node.js; A Bash shell. Its frontmatter pre-approves these tools: Read, Write, Edit, Bash(npm test:*,npm run lint:*,git:*).

Does Refactoring Surgeon access the network?

SKILL.md names 3 domains. As links in the text: refactoring.guru, refactoring.com and oreilly.com. This is read from the text; nothing was executed.

Is Refactoring Surgeon safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Refactoring Surgeon use?

Refactoring Surgeon is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Refactoring Surgeon use?

About 1.6k tokens (SKILL.md is roughly 6.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 8.3k tokens, read only when the agent opens those files.

What are the alternatives to Refactoring Surgeon?

Skills that share tags, products or a category with Refactoring Surgeon: Guidelines (akash-network/node, 1.1k stars), Component Refactoring (langflow-ai/langflow, 155k stars), Migrate Core Code to Submodules (tinyhumansai/openhuman, 42k stars) and ast-grep Structural Search (code-yeongyu/oh-my-openagent, 70k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Refactoring Surgeon?

curiositech (a GitHub organization) maintains it in curiositech/some_claude_skills, which has 243 GitHub stars. The repository holds 95 skills in this directory. The repository was last updated on September 6, 2026.

Source: curiositech/some_claude_skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.