refactor

refactor is a skill for Claude Code from hamr0/agentic-toolkit. It costs 10 tokens per session (3,170 once invoked), scanned A, a copy of refactor, Apache-2.0.

A guided command for targeted code refactoring, meaning changing code structure without changing its intended behavior. It includes a performance review and requires uncertain issues to be reported rather than guessed at.

In plain words
What is it for?
Use it to reorganize code, check performance during the change, run relevant tests, and escalate decisions that cannot be verified.
Why use it?
It limits refactoring to the requested scope and avoids unverified fixes or unrelated changes. It also makes the worker responsible for reporting its edits and tests.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions subagents.

Good fit Use it to reorganize code, check performance during the change, run relevant tests, and escalate decisions that cannot be verified.

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

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/hamr0/agentic-toolkit/refactor/github.svg)](https://agentmods.dev/skills/hamr0/agentic-toolkit/refactor)
Your own site
<a href="https://agentmods.dev/skills/hamr0/agentic-toolkit/refactor"><img src="https://agentmods.dev/badge/skills/hamr0/agentic-toolkit/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 refactor

Your own site · 80×15
<a href="https://agentmods.dev/skills/hamr0/agentic-toolkit/refactor"><img src="https://agentmods.dev/badge/skills/hamr0/agentic-toolkit/refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 10 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,170 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 100% copy Near-identical to another mod 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.00010 $0.03170
Opus 5.5 $0.00004 $0.01268
Sonnet 5.5 $0.00002 $0.00634
Haiku 4.5 $0.00001 $0.00317

Measured 15d ago against content hash 0e3faa99cad9, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 15d 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.

Origin

This is a copy

100% identical to refactor — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

ai/subagentic/ampcode/skills/refactor/SKILL.md · 229 lines

How it starts

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

Refactor $ARGUMENTS. A targeted refactor includes the performance pass below — it is on by default, not a separate command.

Guardrails

  • Spawn a worker, mid tier stated explicitly (omitted inherits the parent's, not the balanced one; not cheapest/fastest either — judgment degrades there; never a vendor model name). Fall back to running inline if your tool has no subagent mechanism.
  • Escalate, never assume. Anything you cannot decide, cannot verify, or that this spec does not cover → stop and report it to the orchestrator (the main session). Never improvise, never widen scope, never fix a side issue you noticed along the way.
  • The worker does the work itself — no delegation. The fixer must not spawn subagents of its own. Every edit it reports, and every test run it cites, has to be one it made or ran with its own tool calls: a relayed "I fixed it and the suite is green" from a sub-worker is hearsay, and this command's whole output is the claim that a change landed and the tests still pass. A fix that delegates its work is a report about a report.
  • The HITL gates below belong to the orchestrator, not the worker. A subagent cannot hold a conversation with the user, so it cannot run a gate that ends in stop and ask. When one trips — a failing test, a crossed public API boundary, a change bigger than the bullet asked for — the worker stops there and hands the situation back, with the options and its reasoning but no choice made. The orchestrator asks. A worker that picks revert / patch / update-test on the user's behalf has answered a question it was never allowed to ask.
  • Edit only what a surviving bullet names. Ledger mode's scope is the bullets that survive revalidation, one change per bullet — not the neighbouring code, not the formatting, not a second finding noticed on the way past. Anything else goes back to the orchestrator to become a new bullet.
  • Prove the blast radius with two checks, because neither sees what the other does. git status --porcelain at exit must list only files a surviving bullet named — that is this command's scope guarantee, and unlike /branch-review it is not expected to be empty. It cannot police the memory directory: .amp/ is normally gitignored, so porcelain stays empty whether you deleted a fixed bullet, wrote nothing, or overwrote MEMORY.md. So also hash the files there before you start and again before you report:
    find .amp/remember -maxdepth 1 -type f -exec md5sum {} + | sort -k2
    
    and show the comparison: only fix-ledger.md may differ. last-review.md in particular is /branch-review's to write — a fixer that touches it forges the gate that judges its own work.

Read the full file on GitHub · 229 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. 15d ago Changed · +12 lines 0e3faa99cad9
  2. 16d ago Changed · +7 lines 543a72af722c
  3. 25d ago Changed · +9 lines fbad7a02368d
  4. 28d ago Changed · +31 lines 978c21bd4306
  5. 1mo ago First seen · 170 lines · 10 tokens per session scan A 4064aea25551

Subscribe to this mod's changes

refactor is a skill published in the GitHub repository hamr0/agentic-toolkit (22 stars, last pushed yesterday), licensed Apache-2.0. It adds 10 tokens to every session and 3,170 once invoked, about $0.0000 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 100% identical to refactor, differing in 0 lines, and is treated as a copy.

Related

Other skills, from other repositories

superpowers-systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

EvovexAI/EvoFlow · 23 tokens

workspace-code-workflow

A workspace code-task workflow for routing tasks and finding or rewriting work by using defined search and worker-selection rules.

EvovexAI/EvoFlow · 70 tokens

diagnosing-plugins

Use to diagnose and fix EvoFlow plugin problems. Applies when a plugin is not listed in the marketplace, fails to install, has missing components (skills/commands/hooks/MCP), is not enabled, or its icon does not display. Provides storage layout, install mechanism, enable state, and a step-by-step localization and…

EvovexAI/EvoFlow · 72 tokens

diagnosing-mcp

Use to diagnose and fix EvoFlow MCP (Model Context Protocol) server configuration problems. Applies when an MCP server will not connect, its tools (mcpservertool) do not appear, it shows as disabled or failed, connections time out, a command cannot be found, template variables are not expanded, or a server defined in…

EvovexAI/EvoFlow · 102 tokens

diagnosing-skills

Use to diagnose and fix EvoFlow skill configuration problems. Applies when a skill is not discovered, does not trigger, is shadowed by another skill, is disabled, or its description does not match what was written. Provides discovery order, scope rules, shadowing logic, and a step-by-step localization and repair…

EvovexAI/EvoFlow · 69 tokens

evoflow-debugging

A structured debugging guide for investigating EvoFlow bugs, mismatched behavior, incorrect data, and failed tests.

EvovexAI/EvoFlow · 100 tokens