Guidelines
akash-network/node
Behavioral guidelines to reduce common LLM coding mistakes. An agent skill from akash-network/node.
Apply named refactoring transformations to improve code structure without changing behavior.
$ npx skills add wondelai/skills --skill refactoring-patterns -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install wondelai/skills refactoring-patterns --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/wondelai/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/refactoring-patterns .claude/skills/refactoring-patterns && rm -rf skills-srcUse ~/.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/
Install the "refactoring-patterns" agent skill from https://github.com/wondelai/skills/tree/main/refactoring-patterns into .claude/skills/refactoring-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "refactoring-patterns", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/wondelai/skills/tree/main/refactoring-patternsType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add wondelai/skills --skill refactoring-patterns -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install wondelai/skills refactoring-patterns --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/wondelai/skills.git skills-src && mkdir -p .agents/skills && cp -r skills-src/refactoring-patterns .agents/skills/refactoring-patterns && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "refactoring-patterns" agent skill from https://github.com/wondelai/skills/tree/main/refactoring-patterns into .agents/skills/refactoring-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "refactoring-patterns", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add wondelai/skills --skill refactoring-patterns -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install wondelai/skills refactoring-patterns --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/wondelai/skills.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/refactoring-patterns .cursor/skills/refactoring-patterns && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "refactoring-patterns" agent skill from https://github.com/wondelai/skills/tree/main/refactoring-patterns into .cursor/skills/refactoring-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "refactoring-patterns", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/wondelai/skills.git --path refactoring-patterns--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add wondelai/skills --skill refactoring-patterns -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install wondelai/skills refactoring-patterns --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/wondelai/skills.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/refactoring-patterns .gemini/skills/refactoring-patterns && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "refactoring-patterns" agent skill from https://github.com/wondelai/skills/tree/main/refactoring-patterns into .gemini/skills/refactoring-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "refactoring-patterns", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install wondelai/skills refactoring-patternsInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add wondelai/skills --skill refactoring-patterns -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/wondelai/skills.git skills-src && mkdir -p .github/skills && cp -r skills-src/refactoring-patterns .github/skills/refactoring-patterns && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "refactoring-patterns" agent skill from https://github.com/wondelai/skills/tree/main/refactoring-patterns into .github/skills/refactoring-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "refactoring-patterns", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add wondelai/skills --skill refactoring-patterns -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install wondelai/skills refactoring-patterns --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/wondelai/skills.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/refactoring-patterns .opencode/skills/refactoring-patterns && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "refactoring-patterns" agent skill from https://github.com/wondelai/skills/tree/main/refactoring-patterns into .opencode/skills/refactoring-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "refactoring-patterns", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
refactoring-patternsApply named refactoring transformations to improve code structure without changing behavior.
Refactoring Patterns is an agent skill from wondelai/skills. Apply named refactoring transformations to improve code structure without changing behavior. Use when the user mentions "refactor this", "code smells", "extract method", "replace conditional", "technical debt", "move method", "inline variable", "decompose conditional", or "clean up this messy code". Also trigger when cleaning up legacy code, preparing code for new features by restructuring, or identifying which transformation fits a specific code smell. Covers smell-driven refactoring, safe transformation…
Its SKILL.md is about 4k 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: Wondel.ai Agent Skills — Business, Marketing, UX & Coding Frameworks from Bestselling Books. 50 skills + 12 guided journeys for Claude Code, Codex, Cursor & other agentskills.io… The licence is MIT.
6 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit c172996. It shows what the files ask for, not the result of running them.
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.
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.
Links to these hosts (documentation or services it may open):
amazon.comFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Refactoring Patterns loads about 4k tokens when it runs, and up to ~24k if it reads all its reference files. Until then it costs about 166 tokens; SKILL.md has 1,961 words of instructions outside code blocks.
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.
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.
The full file from wondelai/skills at commit c172996, republished under its MIT licence (© wondelai). 1,961 words, ~3,985 tokens.
.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.A disciplined approach to improving the internal structure of existing code without changing its observable behavior. Every refactoring follows the same loop: verify tests pass, apply one small structural change, verify tests still pass.
Refactoring is not rewriting. It is a sequence of small, behavior-preserving transformations, each backed by tests. You never change what the code does — only how it is organized. 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 a natural consequence of delivering under time pressure, not a character flaw. Code smells are objective signals of degraded structure; the smell catalog tells you where to look, and the refactoring catalog tells you what to do.
Goal: 10/10. Score structural quality by how many of the eight Quick Diagnostic rows pass — score = round(passed / 8 × 10), adjusting down when a single smell is severe. Bands:
Always state the current score, name the smells driving it down, and list the specific refactorings needed to reach 10/10.
Six areas of focus for systematically improving code structure:
Core concept: Code smells are surface indicators of deeper structural problems — not bugs, but signals that the design makes code harder to understand, extend, or maintain. Each smell maps to named refactorings that fix it.
Why it works: Named smells give teams objective criteria instead of subjective "I don't like this" — "This is Feature Envy" points directly at the fix.
Key insights:
Code applications:
| Context | Pattern | Example |
|---|---|---|
| Method > 10 lines | Extract Method | Pull loop body into calculateLineTotal() |
| One change touches many classes (Shotgun Surgery) | Move Method/Field | Gather the scattered behavior into one class |
| Same params in many methods | Introduce Parameter Object | startDate, endDate → DateRange |
| Copy-pasted logic | Extract Method + Pull Up Method | Share via common method or base class |
See references/smell-catalog.md when you need to name a smell and its fix — all five families (Bloaters, OO Abusers, Change Preventers, Dispensables, Couplers) with detection heuristics and the refactoring each maps to.
Core concept: Most refactoring starts here: break long methods into smaller, well-named pieces that read like prose — high-level steps delegating to clearly named helpers.
Why it works: Short methods with intention-revealing names eliminate comments, make bugs obvious at a glance, and enable reuse; a method call costs nothing to read when the name says everything.
Key insights:
Code applications:
| Context | Pattern | Example |
|---|---|---|
| Block with a comment | Extract Method | // check eligibility → isEligible() |
| Temp used once | Inline Variable | Drop const price = order.getPrice() |
| Trivial delegating method | Inline Method | Inline return deliveries > 5 if used once |
| Method with many tangled locals | Replace Method with Method Object | Locals become fields in a new class |
See references/composing-methods.md when applying any method-level transformation — step-by-step mechanics and before/after code for Extract/Inline Method, Extract/Inline Variable, Replace Temp with Query, Split Temporary Variable, and Replace Method with Method Object.
Core concept: The key OO design decision is where responsibilities live. When Feature Envy, excessive coupling, or unbalanced class sizes show a method or field is in the wrong class, move it where it belongs.
Why it works: A method placed away from the data it uses creates invisible cross-class dependencies, so one logical change ripples across many files — Shotgun Surgery. Co-locating method and data confines the change to one class.
Key insights:
Code applications:
| Context | Pattern | Example |
|---|---|---|
| Method envies another class | Move Method | calculateShipping() from Order to ShippingPolicy |
| God class 500+ lines | Extract Class | Pull Address fields/methods into own class |
Client calls a.getB().getC() | Hide Delegate | Add a.getCThroughB() |
| Class only forwards calls | Remove Middle Man | Let client call the delegate directly |
See references/moving-features.md when deciding where a responsibility belongs — mechanics for Move Method/Field, Extract/Inline Class, Hide Delegate, and Remove Middle Man.
Core concept: Raw data — magic numbers, exposed fields, integer type codes — creates subtle bugs and scatters domain knowledge. Replace primitives with objects that encapsulate behavior and enforce invariants.
Why it works: An int amount has no rounding rules or currency code; a Money object encapsulates all of it, so business rules live in one place and the type system catches errors at compile time.
Key insights:
EmailAddress, Money, Temperature)Customer, not copies)Code applications:
| Context | Pattern | Example |
|---|---|---|
if (status == 2) | Replace Magic Number | if (status == ORDER_SHIPPED) |
String email passed everywhere | Replace Data Value with Object | EmailAddress class with validation |
| Getter returns mutable list | Encapsulate Collection | Return Collections.unmodifiableList(items) |
int typeCode with switch | Replace Type Code with Subclasses | Employee → Engineer, Manager |
See references/organizing-data.md when replacing primitives with objects — mechanics for Replace Data Value with Object, Change Value to Reference, Replace Magic Number, Encapsulate Field/Collection, and the Replace Type Code variants.
Core concept: Deeply nested if/else trees, long switches, and scattered null checks are the hardest code to read and the most bug-prone. Named refactorings decompose, consolidate, and replace conditionals with clearer structures.
Why it works: A six-branch conditional forces readers to simulate every path mentally; well-named extracted branches are self-documenting, and polymorphism eliminates whole categories of "forgot this case" bugs.
Key insights:
if (x == null) checks; Introduce Assertion makes assumptions fail fastCode applications:
| Context | Pattern | Example |
|---|---|---|
Long if with complex condition | Decompose Conditional | Extract isSummer(date) and summerCharge() |
Deeply nested if/else | Replace with Guard Clauses | Edge cases first, return early, flat main path |
| Switch on object type | Replace Conditional with Polymorphism | Each type implements its own calculatePay() |
if (customer == null) everywhere | Introduce Special Case | NullCustomer with safe default behavior |
See references/simplifying-conditionals.md when untangling branches — before/after examples for Decompose/Consolidate Conditional, Guard Clauses, Replace Conditional with Polymorphism, Special Case, and Assertions.
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 — don't debug a broken refactoring.
Why it works: Small steps make the failure obvious (it was the last thing you did) and reverting costs seconds; debugging a failed big-bang rewrite costs days.
Key insights:
Code applications:
| Context | Pattern | Example |
|---|---|---|
| About to add a feature | Preparatory Refactoring | Clean the insertion point first |
| Third copy of same logic | Rule of Three | Extract shared logic now |
| Large API change in production | Branch by Abstraction | Add abstraction layer, migrate callers, remove old path |
| Renaming a widely-used method | Parallel Change | Add new, deprecate old, migrate, remove |
See references/refactoring-workflow.md before a large or risky refactoring — the full green-to-green cycle, when (not) to refactor, performance, Branch by Abstraction, and Parallel Change.
| Mistake | Why It Fails | Fix |
|---|---|---|
| Refactoring without tests | No safety net to detect behavior change | Write characterization tests first |
| Big-bang rewrite | Mixes structural and behavioral change; undebuggable | Smallest possible steps, tests after each |
| Refactoring while adding features | Two hats at once — neither change verifiable | Refactor first (commit), then add feature (commit) |
| Renaming without updating callers | Broken build or dead code | Use IDE rename; search all references |
| Extracting too many tiny methods | Indirection without clarity when names are poor | Each name must remove the need to read the body |
| Ignoring the smell catalog | Reinvents fixes instead of applying proven recipes | Learn named smells; each maps to refactorings |
| Refactoring doomed code | Polish on condemned code is waste | Check the code's lifespan justifies the investment |
| Optimizing while refactoring | Conflates clarity with performance | Clarity first, then profile, then optimize hot path |
| Question | If No | Action |
|---|---|---|
| Do tests pass before you start? | No safety net | Write or fix tests first — never refactor red |
| Can you name the smell you're fixing? | Refactoring by instinct, not catalog | Identify the smell, apply its prescribed refactoring |
| Is each method under ~10 lines? | Long Methods likely | Extract Method into named steps |
| Does each class have one reason to change? | Divergent Change or Large Class | Extract Class to separate responsibilities |
| Are there duplicated code blocks? | The most expensive smell | Extract shared logic into common method/base class |
| Do conditionals use polymorphism where apt? | Switch Statements remain | Replace Conditional with Polymorphism |
| Are you committing after each step? | Risk losing work, mixing changes | Commit after every green-to-green transformation |
| Is the code easier to read after your change? | Refactoring added complexity | Revert and try a different approach |
The definitive guides to improving existing code:
Martin Fowler is Chief Scientist at Thoughtworks, a signatory of the Agile Manifesto, and author of Refactoring: Improving the Design of Existing Code (1999; 2nd edition 2018), which introduced catalog-based, named refactorings to mainstream development. His catalog underpins the automated refactoring tools in every major IDE.
© wondelai, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 6 other files (references) in refactoring-patterns of wondelai/skills.
Open the folder on GitHubat commit c172996
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.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Refactoring Patterns this skillwondelai/skills | 2.4k | — | ~4k | Automated safety check: Pass | MIT | |
| Guidelinesakash-network/node | 1.1k | 22 repos | ~577 | Automated safety check: Pass | MIT | |
| Component Refactoringlangflow-ai/langflow | 156k | — | ~3.5k | Automated safety check: Pass | MIT | |
| Migrate Core Code to Submodulestinyhumansai/openhuman | 42k | — | ~2.6k | Automated safety check: Pass | GPL-3.0 | |
| Systematic Code Refactoringluongnv89/claude-howto | 42k | — | ~3k | Automated safety check: Pass | MIT | |
| Codexskills-directory/skill-codex | 1.5k | 3 repos | ~1.8k | Automated safety check: Pass | MIT |
akash-network/node
Behavioral guidelines to reduce common LLM coding mistakes. An agent skill from akash-network/node.
langflow-ai/langflow
Refactor high-complexity React components in Langflow frontend.
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.
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.
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
DavidObando/gsharp
Forces the laziest solution that actually works, simplest, shortest, most minimal.
wondelai/skills
Navigate the technology adoption lifecycle from early adopters to mainstream market.
wondelai/skills
Apply foundational design principles: affordances, signifiers, constraints, feedback, and conceptual models.
wondelai/skills
Run a structured 5-day process to prototype, test, and validate product ideas with real users.
wondelai/skills
Design habit-forming product loops using the Hook Model (Trigger, Action, Variable Reward, Investment).
wondelai/skills
Diagnose and fix retention problems using behavior design (B=MAP).
wondelai/skills
Design products and pricing around validated willingness to pay, from Ramanujam & Tacke's "Monetizing Innovation".
Categories
Apply named refactoring transformations to improve code structure without changing behavior. Refactoring Patterns is an agent skill from wondelai/skills. Apply named refactoring transformations to improve code structure without changing behavior.
Refactoring Patterns fits situations like: the user mentions refactor this; replace conditional; inline variable; decompose conditional.
Run `npx skills add wondelai/skills --skill refactoring-patterns -a claude-code`. Or copy the skill folder (refactoring-patterns in wondelai/skills) into .claude/skills/refactoring-patterns in your project. Claude Code loads it when a task matches its description.
Run `npx skills add wondelai/skills --skill refactoring-patterns -a codex`. Or copy the skill folder (refactoring-patterns in wondelai/skills) into .agents/skills/refactoring-patterns in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add wondelai/skills --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.
SKILL.md names no scripts, command-line tools or credentials: Refactoring Patterns is instructions for the agent only.
SKILL.md names 1 domain. As links in the text: amazon.com. This is read from the text; nothing was executed.
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.
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.
About 4k tokens (SKILL.md is roughly 16k 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 20k tokens, read only when the agent opens those files.
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.
wondelai (a GitHub organization) maintains it in wondelai/skills, which has 2,356 GitHub stars. The repository holds 61 skills in this directory. The repository was last updated on September 10, 2026.
Source: wondelai/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.