refactor

refactor is a skill for Claude Code from Supersynergy/awesome-agentic-coding. It costs 13 tokens per session (279 once invoked), scanned A, original, MIT.

A step-by-step protocol for restructuring code without changing its behavior. Refactoring means improving code structure while keeping what the program does the same.

In plain words
What is it for?
Use it to plan and perform safe refactors, run the test suite and linter when available, and keep the change focused without deleting tests.
Why use it?
It catches regressions by requiring a passing baseline, small changes, tests after each change, and final verification.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit Use it to plan and perform safe refactors, run the test suite and linter when available, and keep the change focused without deleting tests.

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

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/supersynergy/awesome-agentic-coding/refactor/github.svg)](https://agentmods.dev/skills/supersynergy/awesome-agentic-coding/refactor)
Your own site
<a href="https://agentmods.dev/skills/supersynergy/awesome-agentic-coding/refactor"><img src="https://agentmods.dev/badge/skills/supersynergy/awesome-agentic-coding/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/supersynergy/awesome-agentic-coding/refactor"><img src="https://agentmods.dev/badge/skills/supersynergy/awesome-agentic-coding/refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 13 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 279 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.00013 $0.00279
Opus 5.5 $0.00005 $0.00112
Sonnet 5.5 $0.00003 $0.00056
Haiku 4.5 $0.00001 $0.00028

Measured 1mo ago against content hash 37f85e59d156, 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 1mo 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.

skills/refactor/SKILL.md · 39 lines

What it actually says

Safe Refactoring Protocol

Target: $ARGUMENTS

Step 1: Baseline

  • Run tests first. If they fail, stop — fix tests before refactoring.
  • Note current test count and pass rate.

Step 2: Plan

List every change you will make. Group into atomic steps where:

  • Each step leaves the code in a working state
  • Each step can be verified independently
  • Steps are ordered by dependency

Step 3: Execute (one step at a time)

For each step:

  1. Make the change
  2. Run tests
  3. If tests pass: continue to next step
  4. If tests fail: undo this step and investigate

Step 4: Final Verification

  • Run full test suite
  • Compare test count (should be same or higher, never lower)
  • Run linter if available

Rules

  • Never change behavior. Only structure.
  • Never delete tests. Never skip tests.
  • If a refactoring step breaks tests, it means the refactoring is wrong, not the test.
  • Keep the diff minimal. Don't rename things "while you're at it."
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. 1mo ago First seen · 39 lines · 13 tokens per session scan A 37f85e59d156

Subscribe to this mod's changes

refactor is a skill published in the GitHub repository Supersynergy/awesome-agentic-coding (1 stars, last pushed 2mo ago), licensed MIT. It adds 13 tokens to every session and 279 once invoked, about $0.0001 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-08-31.

Related

Other skills, from other repositories

eval-hooks

Audit Claude Code and Codex hooks for validity, safety, and correctness across settings.json, hooks.json, config.toml, plugin, and skill or agent frontmatter hooks. Resolves each command, checks event names, handler types, matchers, exit-code and JSON decision strategy, and timeouts against each host's documented…

FlorianBruniaux/claude-code-ultimate-guide · 115 tokens

audit-agents-skills

Audit Claude Code agents, skills, and commands for quality and production readiness. Use when evaluating skill quality, checking production readiness scores, or comparing agents against best-practice templates.

FlorianBruniaux/claude-code-ultimate-guide · 41 tokens

design-patterns

Detect, suggest, and evaluate GoF design patterns in TypeScript/JavaScript codebases. Use when refactoring code, applying singleton/factory/observer/strategy patterns, reviewing pattern quality, or finding stack-native alternatives for React, Angular, NestJS, and Vue.

FlorianBruniaux/claude-code-ultimate-guide · 59 tokens

eval-agents

Audit custom subagent definitions for Claude Code (.claude/agents/.md) and Codex (.codex/agents/.toml): loadability against the native schema, description overlap, model tier, tool scope, and headless-safe instructions. Use when onboarding to a project with agents, after adding or importing agents, or when the parent…

FlorianBruniaux/claude-code-ultimate-guide · 80 tokens

eval-skills

Audit a project or library of skills for metadata, trigger boundaries, workflow completion criteria, local resource closure, instruction economy, tool scope, effort, and routing evidence. Use before shipping skills, after importing a skill collection, or when a skill triggers too often or not at all.

FlorianBruniaux/claude-code-ultimate-guide · 60 tokens

pr-triage

4-phase PR backlog management with audit, deep code review, validated comments, and optional worktree setup. Use when triaging pull requests, catching up on pending code reviews, or managing a backlog of open PRs. Args: 'all' to review all, PR numbers to focus (e.g. '42 57'), 'en'/'fr' for language, no arg = audit…

FlorianBruniaux/claude-code-ultimate-guide · 86 tokens