Agent skill

Refactoring Patterns

by tmcfarlane in tmcfarlane/oh-my-cursor

Apply named refactoring transformations to improve code structure without changing behavior.

MITAuto-check passedDevelopment

Install Refactoring Patterns

skills CLI
$ npx skills add tmcfarlane/oh-my-cursor --skill refactoring-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install tmcfarlane/oh-my-cursor refactoring-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/tmcfarlane/oh-my-cursor.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/refactoring-patterns .claude/skills/refactoring-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
refactoring-patterns
GitHub stars
109
Token cost
~5.2k tokens
SKILL.md length
2,677 words
Files
7 (incl. references)
Skills in repo
14
Repo updated
First seen
Licence
MIT

At a glance

Apply named refactoring transformations to improve code structure without changing behavior.

  • Works in 6 steps: Code Smells as Triggers → Composing Methods → Moving Features Between Objects → …
  • The user mentions refactor this
  • SKILL.md covers Core Principle, Scoring, The Refactoring Patterns… and Common Mistakes, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Refactoring Patterns is an agent skill from tmcfarlane/oh-my-cursor. Apply named refactoring transformations to improve code structure without changing behavior. Use when the user mentions "refactor this", "code smells", "extract method", "replace conditional", or "technical debt". Covers smell-driven refactoring, safe transformation sequences, and testing guards. For code quality foundations, see clean-code. For managing complexity, see software-design-philosophy.

Its SKILL.md is about 5.2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including reference files (for example `references/composing-methods.md`, `references/moving-features.md` and `references/organizing-data.md`).

It sits in Development, covering Refactoring. The repository describes itself as: Like “oh-my-opencode”, but for Cursor IDE. Multi-agent orchestration, natively, using nothing but a few config files. The licence is MIT.

When your agent uses it

  • The user mentions refactor this
  • Replace conditional

Example prompts

  • “refactor this”
  • “code smells”
  • “extract method”
  • “/refactoring-patterns”

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Code Smells as Triggers
  2. Composing Methods
  3. Moving Features Between Objects
  4. Organizing Data
  5. Simplifying Conditional Logic
  6. Safe Refactoring Workflow

What it can do on your machine

Read from SKILL.md and the folder at commit 5bad458. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • amazon.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Refactoring Patterns loads about 5.2k tokens when it runs, and up to ~24k if it reads all its reference files. Until then it costs about 105 tokens; SKILL.md has 2,677 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~105
When it runs · the whole SKILL.md, loaded when a task matches
~5.2k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~24k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from tmcfarlane/oh-my-cursor at commit 5bad458, republished under its MIT licence (© tmcfarlane). 2,677 words, ~5,245 tokens.

Download SKILL.mdSave it as .claude/skills/refactoring-patterns/SKILL.md (or your agent's skills folder). This skill also uses 6 other files; get the full folder from GitHub.
name
refactoring-patterns
description
Apply named refactoring transformations to improve code structure without changing behavior. Use when the user mentions "refactor this", "code smells", "extract method", "replace conditional", or "technical debt". Covers smell-driven refactoring, safe transformation sequences, and testing guards. For code quality foundations, see clean-code. For managing complexity, see software-design-philosophy.
license
MIT
metadata.author
wondelai
metadata.version
1.0.0

Refactoring Patterns Framework

A disciplined approach to improving the internal structure of existing code without changing its observable behavior. Apply these named transformations when reviewing code, reducing technical debt, or preparing code for new features. Every refactoring follows the same loop: verify tests pass, apply one small structural change, verify tests still pass.

Core Principle

Refactoring is not rewriting. It is a sequence of small, behavior-preserving transformations, each backed by tests. You never change what the code does -- you change how the code is organized. The discipline of taking tiny verified steps is what makes refactoring safe. Big-bang rewrites fail because they combine structural change with behavioral change, making it impossible to know which broke things.

The foundation: Bad code is not a character flaw -- it is a natural consequence of delivering features under time pressure. Code smells are objective signals that structure has degraded. Named refactorings are the proven mechanical recipes for fixing each smell. The catalog of smells tells you where to look; the catalog of refactorings tells you what to do.

Scoring

Goal: 10/10. When reviewing or refactoring code, rate the structural quality 0-10 based on adherence to the principles below. A 10/10 means: no obvious smells remain, each function does one thing, names reveal intent, duplication is eliminated, and the test suite covers the refactored paths. Always provide the current score and specific refactorings needed to reach 10/10.

The Refactoring Patterns Framework

Six areas of focus for systematically improving code structure:

1. Code Smells as Triggers

Core concept: Code smells are surface indicators of deeper structural problems. They are not bugs -- the code works -- but they signal that the design is making the code harder to understand, extend, or maintain. Each smell maps to one or more named refactorings that fix it.

Why it works: Without a shared vocabulary of smells, code review devolves into subjective "I don't like this." Named smells give teams objective criteria: "This is Feature Envy -- the method uses six fields from another class and only one of its own." The name points directly to the fix.

Key insights:

  • Smells cluster into five families: Bloaters, Object-Orientation Abusers, Change Preventers, Dispensables, and Couplers
  • Long Method is the most common smell and the gateway to most other refactorings
  • Duplicate Code is the single biggest driver of maintenance cost
  • A method that needs a comment to explain what it does is a smell -- extract and name the block instead
  • Shotgun Surgery (one change requires edits in many classes) and Divergent Change (one class changes for many reasons) are opposites that both signal misplaced responsibilities
  • Primitive Obsession -- using raw strings, ints, or arrays instead of small domain objects -- causes errors and duplication throughout the codebase

Code applications:

ContextPatternExample
Method > 10 linesExtract MethodPull the loop body into calculateLineTotal()
Class > 200 linesExtract ClassMove shipping logic into a ShippingCalculator
Switch on type codeReplace Conditional with PolymorphismCreate subclasses for each order type
Multiple methods use same paramsIntroduce Parameter ObjectGroup startDate, endDate into DateRange
Method uses another object's dataMove MethodMove calculateDiscount() to the Customer class
Copy-pasted logicExtract Method + Pull Up MethodShare via a common method or base class

See: references/smell-catalog.md

2. Composing Methods

Core concept: Most refactoring starts here. Long methods are broken into smaller, well-named pieces. Each extracted piece should do one thing and its name should say what that thing is. The goal is methods you can read like prose -- a sequence of high-level steps, each delegating to a clearly named helper.

Why it works: Short methods with intention-revealing names eliminate the need for comments, make bugs obvious (each method is small enough to verify at a glance), and enable reuse. The cognitive cost of a method call is near zero when the name tells you everything.

Key insights:

  • Extract Method is the single most important refactoring -- master it first
  • If you feel the urge to write a comment, extract the code block and use the comment as the method name
  • Inline Method when a method body is as clear as the name -- indirection without value is noise
  • Replace Temp with Query when a temporary variable holds a computed value that is used in multiple places
  • Split Temporary Variable when one variable is reused for two different purposes
  • Replace Method with Method Object when a method is too tangled to extract from (many local variables referencing each other)

Code applications:

ContextPatternExample
Block with a commentExtract Method// check eligibility becomes isEligible()
Temp used onceInline VariableRemove const price = order.getPrice() if used once
Temp used in multiple placesReplace Temp with QueryReplace let discount = getDiscount() with method calls
Temp assigned twice for different reasonsSplit Temporary VariableIntroduce perimeterWidth and perimeterHeight
Trivial delegating methodInline MethodInline moreThanFiveDeliveries() if it's return deliveries > 5 and only used once
Complex method with many localsReplace Method with Method ObjectMove the method into its own class where locals become fields

See: references/composing-methods.md

3. Moving Features Between Objects

Core concept: The key decision in object-oriented design is where to put responsibilities. When a method or field is in the wrong class -- evidenced by Feature Envy, excessive coupling, or unbalanced class sizes -- move it to where it belongs.

Why it works: Well-placed responsibilities reduce coupling and increase cohesion. When a method lives in the class whose data it uses, changes to that data affect only one class. Misplaced methods create invisible dependencies that cause Shotgun Surgery.

Key insights:

  • Move Method when a method uses more features of another class than its own
  • Move Field when a field is used more by another class than the class it lives in
  • Extract Class when one class does two things -- split along the axis of change
  • Inline Class when a class does too little to justify its existence
  • Hide Delegate to enforce the Law of Demeter -- a client shouldn't navigate a chain of objects
  • Remove Middle Man when a class does nothing but forward calls
  • The tension between Hide Delegate and Remove Middle Man is resolved case by case: hide the delegate when the chain is unstable; remove the middle man when forwarding becomes the entire class

Code applications:

ContextPatternExample
Method envies another classMove MethodMove calculateShipping() from Order to ShippingPolicy
Field used by another class constantlyMove FieldMove discountRate from Order to Customer
God class with 500+ linesExtract ClassPull Address fields and methods into their own class
Tiny class with one fieldInline ClassMerge PhoneNumber back into Contact if no behavior
Client calls a.getB().getC()Hide DelegateAdd a.getCThroughB() so client doesn't know about C
Class only forwards callsRemove Middle ManLet client call the delegate directly

See: references/moving-features.md

4. Organizing Data

Core concept: Raw data -- magic numbers, exposed fields, type codes represented as integers, parallel arrays -- creates subtle bugs and scatters domain knowledge. Replace primitive representations with objects that encapsulate behavior and enforce invariants.

Why it works: An int representing a currency amount has no concept of rounding rules, currency codes, or formatting. A Money object encapsulates all of that. When domain concepts are represented as first-class objects, business rules live in one place, validation happens automatically, and the type system catches errors at compile time.

Key insights:

  • Replace Magic Number with Symbolic Constant as the simplest data refactoring -- it names the intent
  • Replace Data Value with Object (Primitive Obsession cure) -- wrap strings and numbers in domain objects (EmailAddress, Money, Temperature)
  • Encapsulate Field -- never expose a raw field; a getter/setter allows you to add validation, logging, or computation later
  • Encapsulate Collection -- return an unmodifiable view; never let callers mutate your internal list
  • Replace Type Code with Subclasses when the type code affects behavior; use Strategy when subclassing is impractical
  • Change Value to Reference when you need identity semantics (one shared Customer object, not copies)

Code applications:

ContextPatternExample
if (status == 2)Replace Magic Number with Symbolic Constantif (status == ORDER_SHIPPED)
String email passed everywhereReplace Data Value with ObjectCreate EmailAddress class with validation
Public fieldEncapsulate FieldReplace order.total with order.getTotal()
Getter returns mutable listEncapsulate CollectionReturn Collections.unmodifiableList(items)
int typeCode with switchReplace Type Code with SubclassesEmployee -> Engineer, Manager, Salesperson
Duplicated customer recordsChange Value to ReferenceShare one Customer instance via a registry

See: references/organizing-data.md

5. Simplifying Conditional Logic

Core concept: Complex conditionals -- deeply nested if/else trees, long switch statements, null checks scattered everywhere -- are the hardest code to read and the most likely to contain bugs. Named refactorings decompose, consolidate, and replace conditionals with clearer structures.

Why it works: A conditional with six branches and nested sub-conditions requires the reader to simulate every path mentally. Decomposing the condition into well-named methods makes each branch self-documenting. Replacing conditionals with polymorphism eliminates entire categories of "forgot to handle this case" bugs.

Key insights:

  • Decompose Conditional: extract the condition, the then-branch, and the else-branch into named methods
  • Consolidate Conditional Expression: merge multiple conditions that lead to the same result into one named check
  • Replace Nested Conditional with Guard Clauses: handle edge cases early and return, leaving the main path unindented
  • Replace Conditional with Polymorphism: the gold standard for type-based conditionals -- each type knows its own behavior
  • Introduce Special Case (Null Object): eliminate if (x == null) checks by providing an object that represents "nothing" with safe default behavior
  • Introduce Assertion: make assumptions explicit so they fail fast in development

Code applications:

ContextPatternExample
Long if with complex conditionDecompose ConditionalExtract isSummer(date) and summerCharge()
Multiple ifs return same valueConsolidate ConditionalCombine into isDisabled() returning early
Deeply nested if/elseReplace with Guard ClausesCheck edge cases first, return early, flatten the main path
Switch on object typeReplace Conditional with PolymorphismEach type implements its own calculatePay()
if (customer == null) everywhereIntroduce Special CaseCreate NullCustomer with default behavior
Hidden assumption in codeIntroduce Assertionassert quantity > 0 at method entry

See: references/simplifying-conditionals.md

Show full SKILL.md (1,031 more words)Show less
6. Safe Refactoring Workflow

Core concept: Refactoring is only safe when wrapped in tests. The workflow is mechanical: run tests (green), apply one small transformation, run tests (green), commit. If tests go red, revert the last change -- don't debug a broken refactoring.

Why it works: Small steps make it trivial to find what went wrong (it was the last thing you did). Reverting a failed step costs seconds. Debugging a failed big-bang rewrite costs days. Frequent commits create save points you can return to.

Key insights:

  • The refactoring cycle: test -> refactor -> test -> commit (repeat)
  • Rule of Three: tolerate duplication once, note it twice, refactor on the third occurrence
  • Preparatory refactoring: restructure code to make the feature easy before adding the feature
  • Comprehension refactoring: refactor to understand code as you read it -- leave it clearer than you found it
  • Litter-pickup refactoring: small improvements whenever you touch a file (Boy Scout Rule)
  • When NOT to refactor: when it's easier to rewrite from scratch, when there are no tests and adding them first isn't feasible, or when the code will be deleted soon
  • Refactoring and performance: refactor for clarity first, then profile and optimize the measured bottleneck -- refactored code is easier to tune because the hot path is isolated
  • Branch by Abstraction and Parallel Change enable large refactorings in production systems without feature branches

Code applications:

ContextPatternExample
About to add a featurePreparatory RefactoringExtract method to make new feature's insertion point clean
Reading unfamiliar codeComprehension RefactoringRename variables and extract methods to understand intent
Saw a small issue while workingLitter-Pickup RefactoringFix the smell before moving on (Boy Scout Rule)
Third copy of same logicRule of ThreeExtract the shared logic into a common method
Large API change in productionBranch by AbstractionIntroduce abstraction layer, migrate callers, remove old path
Renaming a widely-used methodParallel ChangeAdd new name, deprecate old, migrate callers, remove old

See: references/refactoring-workflow.md

Common Mistakes

MistakeWhy It FailsFix
Refactoring without testsNo safety net -- you can't tell if behavior changedWrite characterization tests first, then refactor
Big-bang rewrite instead of incremental stepsCombines structural and behavioral changes; impossible to debugTake the smallest step possible, run tests after each
Refactoring and adding features at the same timeTwo hats at once -- you can't verify either change in isolationSeparate the hats: refactor first (commit), then add feature (commit)
Renaming without updating all callersBreaks the build or introduces dead codeUse IDE rename refactoring; search for all references
Extracting too many tiny methodsCreates indirection without clarity when names are poorEach extracted method must have a name that removes the need to read the body
Ignoring the smell catalogReinventing fixes instead of applying proven recipesLearn the named smells; each one maps to specific refactorings
Refactoring code that will be deletedWasted effort -- polish on condemned codeAsk first: is this code's lifespan long enough to justify the investment?
Optimizing prematurely during refactoringConflates clarity with performance; optimized code is often harder to readRefactor for clarity first, then profile, then optimize the measured hot path only

Quick Diagnostic

QuestionIf NoAction
Do tests pass before you start?You have no safety netWrite or fix tests first -- do not refactor without green tests
Can you name the smell you're fixing?You're refactoring by instinct, not by catalogIdentify the smell from the catalog, then apply its prescribed refactoring
Is each method under ~10 lines?Long Methods are likely presentApply Extract Method to break long methods into named steps
Does each class have a single reason to change?Divergent Change or Large Class smellApply Extract Class to separate responsibilities
Are there duplicated code blocks?Duplicate Code is the most expensive smellExtract shared logic into a common method or base class
Do conditionals use polymorphism where appropriate?Switch Statements or complex if/else trees remainApply Replace Conditional with Polymorphism
Are you committing after each refactoring step?You risk losing work and mixing changesCommit after every green-to-green transformation
Is the code easier to read after your change?The refactoring may have added complexityRevert and try a different approach

Reference Files

  • smell-catalog.md: Comprehensive catalog of code smells organized by family -- Bloaters, Object-Orientation Abusers, Change Preventers, Dispensables, and Couplers -- with detection heuristics and fix mappings
  • composing-methods.md: Extract Method, Inline Method, Extract Variable, Inline Variable, Replace Temp with Query, Split Temporary Variable, Remove Assignments to Parameters, Replace Method with Method Object -- motivation, mechanics, and examples
  • moving-features.md: Move Method, Move Field, Extract Class, Inline Class, Hide Delegate, Remove Middle Man -- when and how to redistribute responsibilities between objects
  • organizing-data.md: Replace Data Value with Object, Change Value to Reference, Replace Array with Object, Replace Magic Number, Encapsulate Field, Encapsulate Collection, Replace Type Code with Class/Subclasses/Strategy
  • simplifying-conditionals.md: Decompose Conditional, Consolidate Conditional, Replace Nested Conditional with Guard Clauses, Replace Conditional with Polymorphism, Introduce Special Case, Introduce Assertion -- with before/after examples
  • refactoring-workflow.md: The refactoring cycle, when to refactor, when NOT to refactor, refactoring and performance, Branch by Abstraction, Parallel Change

Further Reading

This skill is based on the definitive guide to improving the design of existing code:

About the Author

Martin Fowler is the Chief Scientist at Thoughtworks and one of the most influential voices in software engineering. He is the author of Refactoring: Improving the Design of Existing Code (1999, 2nd edition 2018), which introduced the concept of named, catalog-based refactoring transformations to mainstream software development. Fowler is also the author of Patterns of Enterprise Application Architecture, UML Distilled, and numerous influential articles on software design, agile methodology, and continuous delivery. He was a signatory of the Agile Manifesto and has spent decades advocating for evolutionary design -- the practice of continuously improving code structure through disciplined, incremental refactoring rather than upfront big design. His refactoring catalog, originally written in Java, has been adapted to virtually every programming language and is built into the automated refactoring tools of every major IDE.

© tmcfarlane, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 6 other files (references) in skills/refactoring-patterns of tmcfarlane/oh-my-cursor.

  • SKILL.md
  • references/composing-methods.md
  • references/moving-features.md
  • references/organizing-data.md
  • references/refactoring-workflow.md
  • references/simplifying-conditionals.md
  • references/smell-catalog.md

Open the folder on GitHubat commit 5bad458

Compare with similar skills

Refactoring Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Refactoring Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Refactoring Patterns this skilltmcfarlane/oh-my-cursor109—~5.2kAutomated safety check: PassMIT
Guidelinesakash-network/node1.1k22 repos~577Automated safety check: PassMIT
Component Refactoringlangflow-ai/langflow156k—~3.5kAutomated safety check: PassMIT
Migrate Core Code to Submodulestinyhumansai/openhuman42k—~2.6kAutomated safety check: PassGPL-3.0
Systematic Code Refactoringluongnv89/claude-howto42k—~3kAutomated safety check: PassMIT
Codexskills-directory/skill-codex1.5k3 repos~1.8kAutomated safety check: PassMIT

Similar skills

  • Guidelines

    akash-network/node

    Behavioral guidelines to reduce common LLM coding mistakes. An agent skill from akash-network/node.

    1.1k GitHub starsUsed in 22 repos~577 tokens
    DevelopmentAuto-check passed
  • Component Refactoring

    langflow-ai/langflow

    Refactor high-complexity React components in Langflow frontend.

    156k GitHub stars~3.5k tokensUpdated today
    DevelopmentAuto-check passed
  • Migrate Core Code to Submodules

    tinyhumansai/openhuman

    Plans and carries out moving non-host-specific code and its tests from the OpenHuman core into vendored tiny submodule libraries, then releases the submodule and re-pins the host.

    42k GitHub stars~2.6k tokensUpdated today
    DevelopmentAuto-check passed
  • Systematic Code Refactoring

    luongnv89/claude-howto

    Guides refactoring in phases based on Martin Fowler's method: research, test coverage check, planning and small tested steps, with your approval at each phase.

    42k GitHub stars~3k tokensUpdated 7 days ago
    DevelopmentAuto-check passed
  • Codex

    skills-directory/skill-codex

    A skill your agent uses when the user asks to run Codex CLI (codex exec, codex resume) or references OpenAI Codex for code analysis, refactoring, or automated editing

    1.5k GitHub starsUsed in 3 repos~1.8k tokens
    DevelopmentAuto-check passed
  • Ponytail

    DavidObando/gsharp

    Forces the laziest solution that actually works, simplest, shortest, most minimal.

    565 GitHub starsUsed in 8 repos~1.7k tokens
    DevelopmentAuto-check passed

More from tmcfarlane/oh-my-cursor

All 14 skills in this repo
  • Docs Write

    tmcfarlane/oh-my-cursor

    Write documentation following Metabase's conversational, clear, and user-focused style.

    110 GitHub starsUsed in 3 repos~716 tokens
    Auto-check: notes
  • Debugging

    tmcfarlane/oh-my-cursor

    Systematic 4-phase debugging with root cause investigation. An agent skill from tmcfarlane/oh-my-cursor.

    110 GitHub stars~4.4k tokensUpdated 3 mo ago
    Auto-check passed
  • Documentation Engineer

    tmcfarlane/oh-my-cursor

    Technical documentation expert for creating clear, comprehensive documentation.

    109 GitHub stars~881 tokensUpdated 3 mo ago
    Auto-check passed
  • Planning

    tmcfarlane/oh-my-cursor

    Technical implementation planning and architecture design. An agent skill from tmcfarlane/oh-my-cursor.

    109 GitHub stars~815 tokensUpdated 3 mo ago
    Auto-check passed
  • Codebase Search

    tmcfarlane/oh-my-cursor

    Search and navigate large codebases efficiently. An agent skill from tmcfarlane/oh-my-cursor.

    109 GitHub starsUsed in 1 repo~2.8k tokens
    Auto-check: notes
  • Cursor Image Generation

    tmcfarlane/oh-my-cursor

    Generate and iterate images in Cursor using the built-in image model and strong prompts.

    109 GitHub stars~1.8k tokensUpdated 3 mo ago
    Auto-check passed

Categories

Questions about Refactoring Patterns

What does Refactoring Patterns do?

Apply named refactoring transformations to improve code structure without changing behavior. Refactoring Patterns is an agent skill from tmcfarlane/oh-my-cursor. Apply named refactoring transformations to improve code structure without changing behavior.

When should I use Refactoring Patterns?

Refactoring Patterns fits situations like: the user mentions refactor this; replace conditional.

How do I install Refactoring Patterns in Claude Code?

Run `npx skills add tmcfarlane/oh-my-cursor --skill refactoring-patterns -a claude-code`. Or copy the skill folder (skills/refactoring-patterns in tmcfarlane/oh-my-cursor) into .claude/skills/refactoring-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Refactoring Patterns in Codex?

Run `npx skills add tmcfarlane/oh-my-cursor --skill refactoring-patterns -a codex`. Or copy the skill folder (skills/refactoring-patterns in tmcfarlane/oh-my-cursor) into .agents/skills/refactoring-patterns in your project. Codex loads it when a task matches its description.

Can I use Refactoring Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add tmcfarlane/oh-my-cursor --skill refactoring-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/refactoring-patterns, .gemini/skills/refactoring-patterns, .github/skills/refactoring-patterns and .opencode/skills/refactoring-patterns in your project.

What does Refactoring Patterns need to run?

SKILL.md names no scripts, command-line tools or credentials: Refactoring Patterns is instructions for the agent only.

Does Refactoring Patterns access the network?

SKILL.md names 1 domain. As links in the text: amazon.com. This is read from the text; nothing was executed.

Is Refactoring Patterns safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Refactoring Patterns use?

Refactoring Patterns is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Refactoring Patterns use?

About 5.2k tokens (SKILL.md is roughly 21k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 19k tokens, read only when the agent opens those files.

What are the alternatives to Refactoring Patterns?

Skills that share tags, products or a category with Refactoring Patterns: Guidelines (akash-network/node, 1.1k stars), Component Refactoring (langflow-ai/langflow, 156k stars), Migrate Core Code to Submodules (tinyhumansai/openhuman, 42k stars) and Systematic Code Refactoring (luongnv89/claude-howto, 42k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Refactoring Patterns?

tmcfarlane (a GitHub user) maintains it in tmcfarlane/oh-my-cursor, which has 109 GitHub stars. The repository holds 14 skills in this directory. The repository was last updated on July 2, 2026.

Source: tmcfarlane/oh-my-cursor on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.