refactoring-patterns

refactoring-patterns is a skill for Claude Code from Claude-Code-Community-Ireland/claude-code-resources. It costs 40 tokens per session (2,190 once invoked), scanned A, original, MIT.

A set of techniques for changing code structure safely without changing what the code does.

In plain words
What is it for?
Use it to extract methods, rename or move code, simplify large structures, and address common code smells.
Why use it?
It reduces the risk of refactoring by requiring existing tests, small transformations, repeated checks, and separate commits.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the vibeworks-library plugin — 34 skills, 21 commands, 33 agents, 3 hooks shipped together

Good fit Use it to extract methods, rename or move code, simplify large structures, and address common code smells.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/claude-code-community-ireland/claude-code-resources/refactoring-patterns
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 Claude-Code-Community-Ireland/claude-code-resources --skill refactoring-patterns
Clone the repo
git clone --depth 1 https://github.com/Claude-Code-Community-Ireland/claude-code-resources

Made for: Claude Code.

Or install vibeworks-library, the plugin that ships this one along with the rest of its 34 skills, 21 commands, 33 agents, 3 hooks.

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 refactoring-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/claude-code-community-ireland/claude-code-resources/refactoring-patterns/github.svg)](https://agentmods.dev/skills/claude-code-community-ireland/claude-code-resources/refactoring-patterns)
Your own site
<a href="https://agentmods.dev/skills/claude-code-community-ireland/claude-code-resources/refactoring-patterns"><img src="https://agentmods.dev/badge/skills/claude-code-community-ireland/claude-code-resources/refactoring-patterns/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 refactoring-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/claude-code-community-ireland/claude-code-resources/refactoring-patterns"><img src="https://agentmods.dev/badge/skills/claude-code-community-ireland/claude-code-resources/refactoring-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 40 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,190 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.00040 $0.02190
Opus 5.5 $0.00016 $0.00876
Sonnet 5.5 $0.00008 $0.00438
Haiku 4.5 $0.00004 $0.00219

Measured 1mo ago against content hash 321779a9d5e8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

refactoring-patterns 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.

plugins/vibeworks-library/skills/refactoring-patterns/SKILL.md · 247 lines

How it starts

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

Refactoring Patterns

Safety Rules

Before any refactoring, verify all of the following:

  • Tests exist covering the code you will change
  • All tests pass before you start
  • Perform one transformation at a time
  • Run tests after every single transformation
  • Commit after each successful step
  • Name every transformation in your commit message (e.g., "refactor: Extract Method -- validateEmail")
  • Never change behavior and structure in the same commit
  • If a step breaks tests, revert immediately and try a smaller step

Code Smell Catalog

Smell Symptoms Typical Refactoring
Long Method Method over 20 lines; multiple levels of abstraction Extract Method
Large Class Class over 300 lines; too many responsibilities Extract Class
Feature Envy Method uses more data from another class than its own Move Method
Data Clump Same group of fields/params appear together repeatedly Introduce Parameter Object
Primitive Obsession Using primitives instead of small domain objects Replace Primitive with Value Object
Shotgun Surgery One change requires edits across many files Move Method, Inline Class
Divergent Change One class changed for many different reasons Extract Class
Dead Code Unreachable code, unused variables, commented-out blocks Remove Dead Code
Long Parameter List Method takes more than 3 parameters Introduce Parameter Object
Switch Statements Repeated switch/if-else on the same type field Replace Conditional with Polymorphism
Duplicate Code Same logic in multiple places Extract Method, Extract Superclass
Magic Numbers Unexplained literal values in logic Replace Magic Number with Named Constant

Read the full file on GitHub · 247 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. 1mo ago First seen · 247 lines · 40 tokens per session scan A 321779a9d5e8

Subscribe to this mod's changes

refactoring-patterns is a skill published in the GitHub repository Claude-Code-Community-Ireland/claude-code-resources (11 stars, last pushed 4mo ago), licensed MIT. It adds 40 tokens to every session and 2,190 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-09-03.

Related

Other skills, from other repositories

adversarial-reviewer

Stress-test a code change for concrete correctness defects, unsafe assumptions, and failure modes. Use when the user explicitly asks for an adversarial review, a deep bug hunt, or to tear a change apart, or to check your own change before submitting it. Do not use for ordinary review, style feedback, or general…

emdash-cms/emdash · 72 tokens

gsd-ns-review

quality gates | code review debug audit security eval ui.

open-gsd/gsd-core · 16 tokens

gitnexus

A code-graph analysis add-on for examining an existing codebase, including symbols, call paths, execution flows, and effects across repositories. It can query GitNexus through its command-line or MCP interfaces.

hashgraph-online/awesome-codex-plugins · 58 tokens

issue

Use when starting a chain from a GitHub issue — turning an issue URL or number into a triaged, planned, dispatched, and reviewed pull request. Classifies the thread (bug → root-cause discipline, feature → plan chain, question → drafted reply), synthesizes a spec from the issue's own acceptance criteria, then runs the…

jeremylongshore/tons-of-skills-marketplace · 115 tokens

cleanup-code-inspections

Reduce technical debt and improve code quality by systematically resolving static analysis warnings.

flutter/flutter-intellij · 19 tokens

superlint

This skill describes the mandatory standard operating procedure for using our internal SuperLint tool. Use this when tasks require fixing code quality issues according to corporate standards.

mgechev/skillgrade · 0 tokens