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.
npx skills add orlando-japan/claude-code-setting --skill refactor-surgicalgit clone --depth 1 https://github.com/orlando-japan/claude-code-settingWrote 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.
[](https://agentmods.dev/skills/orlando-japan/claude-code-setting/refactor-surgical)<a href="https://agentmods.dev/skills/orlando-japan/claude-code-setting/refactor-surgical"><img src="https://agentmods.dev/badge/skills/orlando-japan/claude-code-setting/refactor-surgical/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.
<a href="https://agentmods.dev/skills/orlando-japan/claude-code-setting/refactor-surgical"><img src="https://agentmods.dev/badge/skills/orlando-japan/claude-code-setting/refactor-surgical.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00025 | $0.00633 |
| Opus 5 | $0.00013 | $0.00316 |
| Sonnet 5 | $0.00005 | $0.00127 |
| Haiku 4.5 | $0.00003 | $0.00063 |
Grade A, and why
refactor-surgical 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.
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.
How it starts
The opening of the file, as written. The whole thing — 63 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Surgical refactor
The refactor contract: behavior before == behavior after. Only internal structure changes.
Pre-flight
- Tests must be green. A refactor on red isn't a refactor — it's a rewrite.
- There must be enough test coverage that tests would catch a behavior change. If coverage is thin, write characterization tests first, then refactor.
- You must have a concrete reason. "Cleaner" is not a reason. "Duplicated in 4 places, next change needs to happen in 5" is a reason.
The protocol
- List the refactor in ≤5 steps before touching code.
- Execute one step.
- Run tests. They must still pass.
- Commit.
- Next step.
If step 2 turns into "and also…", stop — you're scope-creeping. Split into another refactor.
Safe refactors (tooling handles these)
- Rename. IDE rename, not search-and-replace.
- Extract function. Select the code, extract, run tests.
- Inline function. When a function has one caller and adds nothing.
- Move symbol. Between files, between classes.
These are almost always safe if tests cover the behavior.
Risky refactors (do carefully)
- Change a public API. This isn't a refactor, it's a migration. Needs a spec and callers updated.
- Change data structures. Tests catch behavior, not performance or memory shape. Profile before and after.
- Change concurrency model. Tests rarely cover race conditions. Think hard.
- Remove abstraction. Removing an indirection can reveal behavior that depended on it.
Never refactors
- "Fix a bug while refactoring." Refactor is behavior-preserving. Bug fixes change behavior. Separate them.
- "Clean up while adding a feature." Feature and cleanup in one PR = unreviewable. Split.
- "Rename while restructuring." Rename first, restructure second. Each on its own commit.
Stop conditions
- Tests go red → revert the last step, diagnose, redo.
- You discover the original code was wrong, not just ugly → stop. Surface the bug separately.
- You need to touch public API → stop. This is a migration.
- Scope creep detected → stop. Commit what you have, start a new refactor.
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.
- 8d ago First seen · 63 lines · 25 tokens per session scan A cf1d26e3caff
refactor-surgical is a skill published in the GitHub repository orlando-japan/claude-code-setting (2 stars, last pushed 3mo ago), licensed MIT. It adds 25 tokens to every session and 633 once invoked, about $0.0001 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.
Other skills, from other repositories
coding
Use when five specialized coding agents (linter, perf, refactor, security, test) that enforce quality gates across the development lifecycle. From lint enforcement through performance profiling, refactoring, security auditing, and test coverage. Use when working with coding agents.
receiving-code-review
Use when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation.
requesting-code-review
Use when completing tasks, implementing major features, or before merging to verify work meets requirements.
claude_code_delegation
Delegate coding, review, and refactor tasks to Claude Code CLI through Row-Bot's approval-gated shell workflow.
chimera
Use this skill for post-session code quality review of files added or modified during a WrongStack session. It runs automatically when a session ends, and on demand. Trigger on the explicit vocabulary — "review", "code review", "quality check", "post-session review", "chimeric review", "chimera" — and on the task…
auto-review
Use this skill to configure and understand the built-in auto-review plugin (wstack-auto-review) that fires automated code review subagents on every code change during a session. Triggers: user says "auto review", "otomatik review", "auto code review", "her değişiklikte review", "/auto-review".