Individual skill
refactor
Code refactoring best practices based on Martin Fowler's catalog and Clean Code principles (formerly refactoring). This skill should be used when refactoring existing code, improving code structure, reducing complexity, eliminating code smells, or reviewing code for maintainability. Triggers on tasks involving extract method, rename, decompose conditional, reduce coupling, or improve readability.
skills/.curated/refactor/SKILL.md
Source commit cf93c57cac89d6fc3e4194686000411567f5caf3
What was checked
- Matches the observed repository HEAD
- Yes
- Scanner rules are current
- Yes
- Repository scan complete
- No
- Skill scan complete
- Yes
- Observed behavior
- Instructions only
- Last checked
- Nov 5, 2026
These are observations at the recorded commit, not a guarantee of safety. Review the source before running it.
Install this skill
Choose an agent in your Stack or copy a command below. Commands fetch the pinned commit and copy only this skill directory. Existing destinations are refused. Copying a command does not install anything.
An install command is unavailable: current rules, complete repository and skill scans, an eligible behavior level and a permitted license are required.
Repository context
- Repository stars (not skill ratings)
- 221
- Repository last updated
- Aug 15, 2026
- License
- MIT
Observed agent integration: codex
- engineering Derived category
Files and excerpt
File metadata and permitted, redacted excerpts come from the recorded scan. Source links are pinned to that commit.
Browse files
AGENTS.mddoc · 8,772 bytesREADME.mddoc · 4,386 bytesSKILL.mdcore · 4,915 bytesassets/templates/_template.mddoc · 827 bytesmetadata.jsonasset · 882 bytesreferences/_sections.mddoc · 1,930 bytesreferences/cond-consolidate.mddoc · 2,356 bytesreferences/cond-decompose.mddoc · 2,234 bytesreferences/cond-guard-clauses.mddoc · 2,399 bytesreferences/cond-lookup-table.mddoc · 2,522 bytesreferences/cond-polymorphism.mddoc · 2,526 bytesreferences/cond-special-case.mddoc · 2,410 bytesreferences/couple-dependency-injection.mddoc · 2,311 bytesreferences/couple-feature-envy.mddoc · 2,049 bytesreferences/couple-hide-delegate.mddoc · 1,845 bytesreferences/couple-interface-segregation.mddoc · 2,206 bytesreferences/couple-preserve-whole-object.mddoc · 2,119 bytesreferences/couple-remove-middle-man.mddoc · 2,054 bytesreferences/data-encapsulate-collection.mddoc · 2,279 bytesreferences/data-encapsulate-record.mddoc · 2,604 bytesreferences/data-replace-primitive.mddoc · 2,842 bytesreferences/data-replace-temp-with-query.mddoc · 2,119 bytesreferences/data-split-variable.mddoc · 2,733 bytesreferences/error-custom-exceptions.mddoc · 3,160 bytesreferences/error-exceptions-over-codes.mddoc · 2,768 bytesreferences/error-fail-fast.mddoc · 2,556 bytesreferences/error-separate-concerns.mddoc · 3,369 bytesreferences/micro-inline-variable.mddoc · 2,216 bytesreferences/micro-remove-dead-code.mddoc · 2,101 bytesreferences/micro-rename-for-clarity.mddoc · 2,048 bytesreferences/micro-simplify-expressions.mddoc · 2,023 bytesreferences/name-avoid-abbreviations.mddoc · 1,792 bytesreferences/name-avoid-encodings.mddoc · 2,058 bytesreferences/name-consistent-vocabulary.mddoc · 1,862 bytesreferences/name-intention-revealing.mddoc · 1,427 bytesreferences/name-searchable-names.mddoc · 1,708 bytesreferences/pattern-composition-over-inheritance.mddoc · 2,323 bytesreferences/pattern-extract-superclass.mddoc · 2,523 bytesreferences/pattern-factory.mddoc · 3,350 bytesreferences/pattern-open-closed.mddoc · 2,776 bytesreferences/pattern-strategy.mddoc · 3,032 bytesreferences/pattern-template-method.mddoc · 3,222 bytesreferences/struct-compose-method.mddoc · 2,762 bytesreferences/struct-extract-class.mddoc · 2,250 bytesreferences/struct-extract-method.mddoc · 2,494 bytesreferences/struct-function-length.mddoc · 3,099 bytesreferences/struct-parameter-object.mddoc · 2,526 bytesreferences/struct-replace-method-with-object.mddoc · 3,820 bytesreferences/struct-single-responsibility.mddoc · 2,241 bytes
Read excerpt
# Fowler/Martin Code Refactoring Best Practices
Comprehensive code refactoring guide based on Martin Fowler's catalog and Clean Code principles, designed for AI agents and LLMs. Contains 43 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.
## When to Apply
Reference these guidelines when:
- Refactoring existing code to improve maintainability
- Decomposing long methods or large classes
- Reducing coupling between components
- Simplifying complex conditional logic
- Reviewing code for code smells and anti-patterns
## Rule Categories by Priority