refactor
Code refactoring best practices based on Martin Fowler's catalog and Clean Code principles (formerly refactoring).
Skill by pproenca
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/pproenca-refactor
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/refactor
What's inside
- Skill name
refactor- Description
- 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.
- License
- MIT
- Instructions
- 108 lines in SKILL.md · view on GitHub
Files (49)
- AGENTS.md
- README.md
- SKILL.md
- _template.md · assets/templates/
- metadata.json
- _sections.md · references/
- cond-consolidate.md · references/
- cond-decompose.md · references/
- cond-guard-clauses.md · references/
- cond-lookup-table.md · references/
- cond-polymorphism.md · references/
- cond-special-case.md · references/
- couple-dependency-injection.md · references/
- couple-feature-envy.md · references/
- couple-hide-delegate.md · references/
- couple-interface-segregation.md · references/
- couple-preserve-whole-object.md · references/
- couple-remove-middle-man.md · references/
- data-encapsulate-collection.md · references/
- data-encapsulate-record.md · references/
- data-replace-primitive.md · references/
- data-replace-temp-with-query.md · references/
- data-split-variable.md · references/
- error-custom-exceptions.md · references/
- error-exceptions-over-codes.md · references/
- error-fail-fast.md · references/
- error-separate-concerns.md · references/
- micro-inline-variable.md · references/
- micro-remove-dead-code.md · references/
- micro-rename-for-clarity.md · references/
- micro-simplify-expressions.md · references/
- name-avoid-abbreviations.md · references/
- name-avoid-encodings.md · references/
- name-consistent-vocabulary.md · references/
- name-intention-revealing.md · references/
- name-searchable-names.md · references/
- pattern-composition-over-inheritance.md · references/
- pattern-extract-superclass.md · references/
- pattern-factory.md · references/
- pattern-open-closed.md · references/
- pattern-strategy.md · references/
- pattern-template-method.md · references/
- struct-compose-method.md · references/
- struct-extract-class.md · references/
- struct-extract-method.md · references/
- struct-function-length.md · references/
- struct-parameter-object.md · references/
- struct-replace-method-with-object.md · references/
- struct-single-responsibility.md · references/
SKILL.md (first lines)
# 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
| Priority | Category | Impact | Prefix |
|----------|----------|--------|--------|
| 1 | Structure & Decomposition | CRITICAL | `struct-` |
| 2 | Coupling & Dependencies | CRITICAL | `couple-` |
| 3 | Naming & Clarity | HIGH | `name-` |
| 4 | Conditional Logic | HIGH | `cond-` |
| 5 | Abstraction & Patterns | MEDIUM-HIGH | `pattern-` |
| 6 | Data Organization | MEDIUM | `data-` |
| 7 | Error Handling | MEDIUM | `error-` |
| 8 | Micro-Refactoring | LOW | `micro-` |
## Quick Reference
### 1. Structure & Decomposition (CRITICAL)
- `struct-extract-method` - Extract Method for Long Functions
- `struct-single-responsibility` - Apply Single Responsibility Principle
- `struct-extract-class` - Extract Class from Large Class
- `struct-compose-method` - Compose Method for Readable Flow
- `struct-function-length` - Keep Functions Under 20 Lines
- `struct-replace-method-with-object` - Replace Method with Method Object
- `struct-parameter-object` - Introduce Parameter Object
### 2. Coupling & Dependencies (CRITICAL)
- `couple-dependency-injection` - Use Dependency Injection
- `couple-hide-delegate` - Hide Delegate to Reduce Coupling
- `couple-remove-middle-man` - Remove Middle Man When Excessive
- `couple-feature-envy` - Fix Feature Envy by Moving Methods
- `couple-interface-segregation` - Apply Interface Segregation Principle
- `couple-preserve-whole-object` - Preserve Whole Object Instead of Fields
### 3. Naming & Clarity (HIGH)
- `name-intention-revealing` - Use Intention-Revealing Names
- `name-avoid-abbreviations` - Avoid Abbreviations and Acronyms
- `name-consistent-vocabulary` - Use Consistent Vocabulary
- `name-searchable-names` - Use Searchable Names
- `name-avoid-encodings` - Avoid Type Encodings in Names
### 4. Conditional Logic (HIGH)
- `cond-guard-clauses` - Replace Nested Conditionals with Guard Clauses
- `cond-polymorphism` - Replace Conditional with Polymorphism
- `cond-decompose` - Decompose Complex Conditionals
- `cond-consolidate` - Consolidate Duplicate Conditional Fragments
- `cond-special-case` - Introduce Special Case Object
- `cond-lookup-table` - Replace Conditional with Lookup Table
### 5. Abstraction & Patterns (MEDIUM-HIGH)
- `pattern-strategy` - Extract Strategy for Algorithm Variants
- `pattern-template-method` - Use Template Method for Shared Skeleton
- `pattern-factory` - Use Factory for Complex Object Creation
- `pattern-open-closed` - Apply Open-Closed Principle
- `pattern-composition-over-inheritance` - Prefer Composition Over Inheritance
- `pattern-extract-superclass` - Extract Superclass for Common Behavior
### 6. Data Organization (MEDIUM)
- `data-encapsulate-collection` - Encapsulate Collection
- `data-replace-primitive` - Replace Primitive with Object
- `data-encapsulate-record` - Encapsulate Record into Class
- `data-split-variable` - Split Variable with Multiple Assignments
- `data-replace-temp-with-query` - Replace Temp with Query
### 7. Error Handling (MEDIUM)
- `error-exceptions-over-codes` - Use Exceptions Instead of Error Codes
- `error-custom-exceptions` - Create Domain-Specific Exception Types
- `error-fail-fast` - Fail Fast with Preconditions
- `error-separate-concerns` - Separate Error Handling from Business Logic
### 8. Micro-Refactoring (LOW)
- `micro-remove-dead-code` - Remove Dead Code
- `micro-inline-variable` - Inline Trivial Variables
- `micro-simplify-expressions` - Simplify Boolean Expressions
- `micro-rename-for-clarity` - Rename for Clarity
## How to Use
Read individual reference files for detailed explanations and code examples:
- [Section definitions](references/_sections.md) - Category structure and impact levels
- [Rule template](assets/templates/_template.md) - Template for adding new rules
- Individual rules: `references/{prefix}-{slug}.md`
## Full Compiled Document
For the complete guide with all rules expanded: `AGENTS.md`From pproenca/dot-skills, MIT.
More from pproenca/dot-skills
- 0.694score
tanstack-query
community
TanStack Query v5 performance optimization for data fetching, caching, mutations, and query patterns.
SkillCFreshness: C★ 218Claude Code +9 - 0.596score
mlflow-3
pproenca
MLflow 3 (open-source, pinned to 3.15) for classic-ML MLOps — logging and registering models, promoting versions across dev/staging/prod, standing up a…
SkillBFreshness: B★ 218Claude Code +9 - 0.596score
ray
pproenca
Production Ray (open-source, pinned to 2.57) for classic-ML workloads from training to serving — Ray Train, Tune, Data, Serve, Core, and cluster deployment on…
SkillBFreshness: B★ 218Claude Code +9 - 0.596score
mlflow-mlops-migration
pproenca
Guided workflow for taking any ML codebase — including one with no experiment tracking at all, or one full of MLflow 2-era idioms — to a production-grade…
SkillBFreshness: B★ 218Claude Code +9 - 0.596score
ray-llm
pproenca
LLM workloads on open-source Ray (pinned to 2.57) — OpenAI-compatible serving with ray.serve.llm (vLLM-backed LLMConfig + build_openai_app) and batch…
SkillBFreshness: B★ 218Claude Code +9 - 0.550score
expo-ui
pproenca
Library reference for @expo/ui SwiftUI components on iOS — covers Host boundaries, modifier composition, iOS 26 Liquid Glass and Human Interface Guidelines…
SkillCFreshness: C★ 218Claude Code +9 - 0.550score
debug
pproenca
Comprehensive debugging methodology for finding and fixing bugs (formerly debugging).
SkillCFreshness: C★ 218Claude Code +9 - 0.550score
bug-review
pproenca
Use this skill when a user asks to review a pull request for bugs, wants AI code review focused on correctness issues, or runs /bug-review.
SkillCFreshness: C★ 218Claude Code +9 - 0.550score
ios-taste
pproenca
Designs iOS 18+ SwiftUI experiences with real taste — starting from user goals, not pixels.
SkillCFreshness: C★ 218Claude Code +9 - 0.550score
implementation-functional-patterns
pproenca
TypeScript's functional answers to the 22 Gang of Four classes — factory functions (Factory Method, Abstract Factory, Prototype, Memento), module-scope…
SkillCFreshness: C★ 218Claude Code +9 - 0.550score
expo
pproenca
Expo React Native performance optimization guidelines.
SkillCFreshness: C★ 218Claude Code +9 - 0.550score
deterministic-metric-design
pproenca
Inventing deterministic metrics — turning a fuzzy property like 'maintainability', 'risk', or 'how reducible this code is' into a deterministic, computable…
SkillCFreshness: C★ 218Claude Code +9
Signals
- Stars
- 218
- Forks
- 19
- Open issues
- 3
- Last commit (this folder)
- May 14, 2026 (5 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/pproenca/dot-skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from pproenca
- 0.596score
ray-llm
pproenca
LLM workloads on open-source Ray (pinned to 2.57) — OpenAI-compatible serving with ray.serve.llm (vLLM-backed LLMConfig + build_openai_app) and batch…
SkillBFreshness: B★ 218Claude Code +9 - 0.596score
mlflow-mlops-migration
pproenca
Guided workflow for taking any ML codebase — including one with no experiment tracking at all, or one full of MLflow 2-era idioms — to a production-grade…
SkillBFreshness: B★ 218Claude Code +9 - 0.596score
mlflow-3
pproenca
MLflow 3 (open-source, pinned to 3.15) for classic-ML MLOps — logging and registering models, promoting versions across dev/staging/prod, standing up a…
SkillBFreshness: B★ 218Claude Code +9 - 0.596score
ray
pproenca
Production Ray (open-source, pinned to 2.57) for classic-ML workloads from training to serving — Ray Train, Tune, Data, Serve, Core, and cluster deployment on…
SkillBFreshness: B★ 218Claude Code +9 - 0.550score
expo
pproenca
Expo React Native performance optimization guidelines.
SkillCFreshness: C★ 218Claude Code +9 - 0.550score
debug
pproenca
Comprehensive debugging methodology for finding and fixing bugs (formerly debugging).
SkillCFreshness: C★ 218Claude Code +9
Cite this page
refactor skill. Agent Mart. https://agentmart.dev/skills/pproenca-refactor (last updated 2026-10-24)