refactor

refactor is a skill for Claude Code from irahardianto/awesome-agv. It costs 38 tokens per session (1,224 once invoked), scanned A, original, MIT.

A guided skill for changing the structure of existing code without changing what it does. It can start from a requested change or findings from tools such as linters and static-analysis checkers, and uses TDD—writing a failing test, making it pass, then tidying the code—to protect behaviour.

In plain words
What is it for?
Use it to split handlers, extract interfaces, change asynchronous code, or address findings from DeepSource, Clippy, or language-specific linters.
Why use it?
It reduces the risk of breaking working code while making it easier to maintain. Impact analysis and tests help show which parts may be affected by the change.

Skill for Claude Code

Written for Claude Code: disable-model-invocation in frontmatter. Also seen: mentions subagents; installed under .agents/ (shared by several agents).

Good fit Use it to split handlers, extract interfaces, change asynchronous code, or address findings from DeepSource, Clippy, or language-specific linters.

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

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/irahardianto/awesome-agv/refactor/github.svg)](https://agentmods.dev/skills/irahardianto/awesome-agv/refactor)
Your own site
<a href="https://agentmods.dev/skills/irahardianto/awesome-agv/refactor"><img src="https://agentmods.dev/badge/skills/irahardianto/awesome-agv/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/irahardianto/awesome-agv/refactor"><img src="https://agentmods.dev/badge/skills/irahardianto/awesome-agv/refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 38 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,224 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 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.00038 $0.01224
Opus 5.5 $0.00015 $0.00490
Sonnet 5.5 $0.00008 $0.00245
Haiku 4.5 $0.00004 $0.00122

Measured 5d ago against content hash 5eb7b7d0ad8b, 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 5d 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.

.agents/skills/refactor/SKILL.md · 119 lines

How it starts

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

Refactor Skill

Entry-point guard: This is a user-invoked command skill (/refactor). If you are a spawned subagent, do NOT execute this skill — return to your assigned scope card.

Purpose

Safely restructure existing code while preserving behavior. Uses a different mindset than greenfield feature development: understand first, then change structure.

Requirement Elicitation

Determine refactoring source before proceeding:

Path A — Human-Specified

User provides a specific, actionable target:

  • ✅ /refactor extract storage interface in task feature
  • ✅ /refactor split user handler into separate auth handler
  • ✅ /refactor migrate callbacks to async/await in notification service → Proceed directly to Phase 1

Path B — Tool-Driven

User references a static analysis tool as the requirement source:

  • ✅ /refactor from-deepsource — read DeepSource MCP findings
  • ✅ /refactor from-clippy — parse cargo clippy output
  • ✅ /refactor from-lint — parse linter output (ESLint, golangci-lint, ruff) → Parse tool findings → present summary → user approves scope → proceed to Phase 1

Supported tools:

Tool Integration
DeepSource MCP Read findings via deepsource MCP tools
cargo clippy Parse cargo clippy --message-format json
golangci-lint Parse golangci-lint run --out-format json
ESLint Parse npx eslint . --format json
ruff Parse ruff check . --output-format json
SonarQube Read via API if available

Path C — Discovery

User doesn't know what to refactor, or provides vague request:

  • ✅ /refactor discover — audit first, then refactor
  • ❌ /refactor apps/backend — too vague
  • ❌ /refactor improve code quality — what specific issue? → Multi-agent mode (/workflow-team): Dispatch SCOUT(@scout + @reviewer, code smell audit) → Single-agent mode: Run /audit on the target area first, then use findings as input → Present findings → user approves scope → proceed to Phase 1

Vague request without path → "Run /refactor discover to find issues, or specify a target like /refactor extract storage interface in task feature."

Read the full file on GitHub · 119 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. 5d ago First seen · 119 lines · 38 tokens per session scan A 5eb7b7d0ad8b

Subscribe to this mod's changes

refactor is a skill published in the GitHub repository irahardianto/awesome-agv (156 stars, last pushed 5d ago), licensed MIT. It adds 38 tokens to every session and 1,224 once invoked, about $0.0002 per session on Opus 5.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-10-15.

Related

Other skills, from other repositories

legacy-code-changes

Making safe changes in unfamiliar, undertested, or legacy codebases — comprehension before modification, characterization tests, seams, and incremental replacement. Use when working in a codebase you didn't write, inheriting a project, touching code with no tests, planning a refactor of old code, or when the user says…

05-deepak-patidar/claude-skills · 95 tokens

om-troubleshooter

Diagnose and fix standalone Open Mercato bugs across scope, commands, locking, fields, generated registries, UI hydration, cache/search, bootstraps, queues, and providers. Use for "fix bug", "why does this fail", "regression", "debug", "napraw błąd", or a failing test.

open-mercato/open-mercato · 73 tokens

verify-bug

Post-merge UAT verification workflow. Walks JIRA reproduce steps, performs comparative audits (Before/After), attaches evidence to JIRA, and transitions status on PASS.

HoangNguyen0403/agent-skills-standard · 39 tokens

common-subagent-driven-development

Execute multi-task implementation plans by dispatching a fresh implementer subagent per task with independent review gates. Use when implementing plans, executing multi-task PRs, or transitioning from planning to implementation.

HoangNguyen0403/agent-skills-standard · 45 tokens

implement-feature

Implement an approved feature plan with fresh-context slices, TDD, revision-bound evidence, and PR-ready output.

HoangNguyen0403/agent-skills-standard · 25 tokens

common-tdd

Guides quality-first TDD for new behavior, bug fixes, and test changes. Selects the smallest test layer, proves a distinct regression risk, and runs bounded RED-GREEN-REFACTOR verification.

HoangNguyen0403/agent-skills-standard · 46 tokens