Skip to main content
skill CX Codex

clean-code · pproenca — Claude Code skill: 48 clean code rules

A skill that feeds the agent 48 rules on naming, functions, errors and tests, drawn from Robert C. Martin's book with modern fixes. Useful during reviews and refactors.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add pproenca/dot-skills --skill clean-code -a claude-code
Open on GitHub

What clean-code does

The skill splits into 10 categories ranked by impact: names, functions, comments, formatting, error handling, objects, boundaries, classes, unit tests and simple design. Every rule has a prefix such as name-, func- or cmt- and its own reference file with an explanation and code examples. The examples lean on Java, the principles do not.

Names and functions sit at CRITICAL, comments, formatting and errors at HIGH, the rest lower. The agent pulls the matching rule when you ask it to name a variable, shrink a function or write a test. There is also a template for adding your own rules.

The advice comes from the 2008 edition, so parts of it were rewritten to match current practice. If your project already has a style guide, the formatting rules here can clash with it — worth checking which one wins in your review.

What it helps with

  • rename variables so the name states the intent
  • split a long function into pieces at one abstraction level
  • delete commented-out code and redundant comments
  • wrap a third-party API and add learning tests for it
  • rewrite a test that asserts several things at once

Example prompts for the agent

  • review this module against clean-code and list the violations
  • suggest names for these variables using name-intention-revealing
  • break processOrder down following func-one-thing and func-small

How to install clean-code

1Skills CLI (Vercel)

npx skills add pproenca/dot-skills --skill clean-code -a claude-code

2Manually: put the files in place

~/.claude/skills/clean-code/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/clean-code/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about clean-code

How do I install clean-code in Claude?

Run npx skills add pproenca/dot-skills --skill clean-code -a claude-code. The skill then lands in ~/.claude/skills/clean-code/SKILL.md.

What does the clean-code skill do?

It gives the agent 48 rules covering names, functions, comments, errors, classes and tests, and applies them while writing, reviewing or refactoring code.

How is it different from the Clean Code book?

It follows Robert C. Martin's book but rewrites the 2008 advice that no longer holds. The rules are grouped into 10 categories and ordered by impact.

Source text

SKILL.md · MIT
---
name: clean-code
description: Use when writing, reviewing, or refactoring code for maintainability and readability. Triggers on code reviews, naming discussions, function design, error handling, and test writing. Based on Robert C. Martin's Clean Code handbook with modern corrections.
---

# Robert C. Martin (Uncle Bob) Clean Code Best Practices

Comprehensive software craftsmanship guide based on Robert C. Martin's "Clean Code: A Handbook of Agile Software Craftsmanship", updated with modern corrections where the original 2008 advice has been superseded. Contains 48 rules across 10 categories, prioritized by impact to guide code reviews, refactoring decisions, and new development. Examples are primarily in Java but principles are language-agnostic.

## When to Apply

Reference these guidelines when:
- Writing new functions, classes, or modules
- Naming variables, functions, classes, or files
- Reviewing code for maintainability issues
- Refactoring existing code to improve clarity
- Writing or improving unit tests
- Wrapping third-party dependencies

## Rule Categories by Priority

| Priority | Category | Impact | Prefix |
|----------|----------|--------|--------|
| 1 | Meaningful Names | CRITICAL | `name-` |
| 2 | Functions | CRITICAL | `func-` |
| 3 | Comments | HIGH | `cmt-` |
| 4 | Formatting | HIGH | `fmt-` |
| 5 | Error Handling | HIGH | `err-` |
| 6 | Objects and Data Structures | MEDIUM-HIGH | `obj-` |
| 7 | Boundaries | MEDIUM-HIGH | `bound-` |
| 8 | Classes and Systems | MEDIUM-HIGH | `class-` |
| 9 | Unit Tests | MEDIUM | `test-` |
| 10 | Emergence and Simple Design | MEDIUM | `emerge-` |

## Quick Reference

### 1. Meaningful Names (CRITICAL)

- [`name-intention-revealing`](references/name-intention-revealing.md) - Use names that reveal intent
- [`name-avoid-disinformation`](references/name-avoid-disinformation.md) - Avoid misleading names
- [`name-meaningful-distinctions`](references/name-meaningful-distinctions.md) - Make meaningful distinctions
- [`name-pronounceable`](references/name-pronounceable.md) - Use pronounceable names
- [`name-searchable`](references/name-searchable.md) - Use searchable names
- [`name-avoid-encodings`](references/name-avoid-encodings.md) - Avoid encodings in names
- [`name-class-noun`](references/name-class-noun.md) - Use noun phrases for class names
- [`name-method-verb`](references/name-method-verb.md) - Use verb phrases for method names

### 2. Functions (CRITICAL)

- [`func-small`](references/func-small.md) - Keep functions small
- [`func-one-thing`](references/func-one-thing.md) - Functions should do one thing
- [`func-abstraction-level`](references/func-abstraction-level.md) - Maintain one level of abstraction
- [`func-minimize-arguments`](references/func-minimize-arguments.md) - Minimize function arguments
- [`func-no-side-effects`](references/func-no-side-effects.md) - Avoid side effects
- [`func-command-query-separation`](references/func-command-query-separation.md) - Separate commands from queries
- [`func-dry`](references/func-dry.md) - Do not repeat yourself

### 3. Comments (HIGH)

- [`cmt-express-in-code`](references/cmt-express-in-code.md) - Express yourself in code, not comments
- [`cmt-explain-intent`](references/cmt-explain-intent.md) - Use comments to explain intent
- [`cmt-avoid-redundant`](references/cmt-avoid-redundant.md) - Avoid redundant comments
- [`cmt-avoid-commented-out-code`](references/cmt-avoid-commented-out-code.md) - Delete commented-out code
- [`cmt-warning-consequences`](references/cmt-warning-consequences.md) - Use warning comments for consequences

### 4. Formatting (HIGH)

- [`fmt-vertical-formatting`](references/fmt-vertical-formatting.md) - Use vertical formatting for readability
- [`fmt-horizontal-alignment`](references/fmt-horizontal-alignment.md) - Avoid horizontal alignment
- [`fmt-team-rules`](references/fmt-team-rules.md) - Follow team formatting rules
- [`fmt-indentation`](references/fmt-indentation.md) - Respect indentation rules

### 5. Error Handling (HIGH)

- [`err-use-exceptions`](references/err-use-exceptions.md) - Separate error handling from happy path
- [`err-write-try-catch-first`](references/err-write-try-catch-first.md) - Write try-catch-finally first
- [`err-provide-context`](references/err-provide-context.md) - Provide context with exceptions
- [`err-define-by-caller-needs`](references/err-define-by-caller-needs.md) - Define exceptions by caller needs
- [`err-avoid-null`](references/err-avoid-null.md) - Avoid returning and passing null

### 6. Objects and Data Structures (MEDIUM-HIGH)

- [`obj-data-abstraction`](references/obj-data-abstraction.md) - Hide data behind abstractions
- [`obj-data-object-asymmetry`](references/obj-data-object-asymmetry.md) - Understand data/object anti-symmetry
- [`obj-law-of-demeter`](references/obj-law-of-demeter.md) - Follow the Law of Demeter
- [`obj-avoid-hybrids`](references/obj-avoid-hybrids.md) - Avoid hybrid data-object structures
- [`obj-dto`](references/obj-dto.md) - Use DTOs for data transfer

### 7. Boundaries (MEDIUM-HIGH)

- [`bound-wrap-third-party`](references/bound-wrap-third-party.md) - Wrap third-party APIs
- [`bound-learning-tests`](references/bound-learning-tests.md) - Write learning tests for third-party code

### 8. Classes and Systems (MEDIUM-HIGH)

- [`class-small`](references/class-small.md) - Keep classes small
- [`class-cohesion`](references/class-cohesion.md) - Maintain class cohesion
- [`class-organize-for-change`](references/class-organize-for-change.md) - Organize classes for change
- [`class-isolate-from-change`](references/class-isolate-from-change.md) - Isolate classes from change
- [`class-separate-concerns`](references/class-separate-concerns.md) - Separate construction from use

### 9. Unit Tests (MEDIUM)

- [`test-first-law`](references/test-first-law.md) - Follow the three laws of TDD
- [`test-keep-clean`](references/test-keep-clean.md) - Keep tests clean
- [`test-one-assert`](references/test-one-assert.md) - One concept per test
- [`test-first-principles`](references/test-first-principles.md) - Follow FIRST principles
- [`test-build-operate-check`](references/test-build-operate-check.md) - Use Build-Operate-Check pattern

### 10. Emergence and Simple Design (MEDIUM)

- [`emerge-simple-design`](references/emerge-simple-design.md) - Follow the four rules of simple design
- [`emerge-expressiveness`](references/emerge-expressiveness.md) - Maximize expressiveness

## 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

## Reference Files

| File | Description |
|------|-------------|
| [references/_sections.md](references/_sections.md) | Category definitions and ordering |
| [assets/templates/_template.md](assets/templates/_template.md) | Template for new rules |
| [metadata.json](metadata.json) | Version and reference information |

© pproenca · MIT · pproenca/dot-skills

Similar skills

Everything for Code review and refactoring →

clean-code by other authors comes first.

clean-code sickn33 This skill guides code writing, review, and refactoring around Clean Code principles. Use it for legacy changes, pull requests, and test-focused work. CX Codex +1 12,400installs clean-code wondelai A skill that gives coding agents a readability standard: names that carry intent, small functions, disciplined comments, one error-handling style. CX Codex +1 6,600installs clean-code decebals Guides your coding assistant to write readable code using DRY, KISS, and YAGNI principles. Useful when dealing with bloated methods and vague naming. CX Codex +1 379installs clean-code davila7 Gives the agent a set of clean-code rules: small functions, intent-revealing names, no obvious comments, no needless abstraction. Useful when you want working code, not a tutorial. 7,176installs clean-code-guard amElnagdy Reviews fresh code against Clean Code and SOLID, flags the mistakes LLMs keep repeating, and runs in three modes: guard pass, live, review. CX Codex +1 4,700installs typescript-clean-code bmad-labs A skill for reviewing and refactoring TypeScript: code smell catalogs, four detection layers, and step-by-step workflows. CX Codex +1 628installs clean-code-principles AsyrafHussin A skill for architecture review and code quality: SOLID, DRY, KISS, design patterns. Useful when refactoring or weighing design decisions. CX Codex +1 1,800installs code-refactoring-refactor-clean sickn33 Analyzes code smells and plans stepwise refactoring based on SOLID and clean code principles. Helps clean tangled modules before introducing new features. CX Codex +1 1,200installs indexion-identity trkbt10 This skill checks whether function, file and folder names still match their contents, then plans verified renames. Useful during refactoring. CX Codex +1 4,900installs code-simplification addyosmani Simplifies working code without changing its behavior. Use it after a feature passes tests, during review, or when nested logic has become hard to read. CX Codex +1 62,800installs

From the same set45

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor