# Clean Code

Write readable, maintainable code through disciplined naming, small functions, and...

- Repository: https://github.com/wondelai/skills (2552 stars)
- Category: Testing
- License: MIT
- Last updated: 2026-09-10
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add wondelai/skills --skill clean-code -g -a claude-code -y`
Codex: `npx skills add wondelai/skills --skill clean-code -g -a codex -y`
Cursor: `npx skills add wondelai/skills --skill clean-code -g -a cursor -y`
Gemini CLI: `npx skills add wondelai/skills --skill clean-code -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add wondelai/skills`

## Description

Write readable, maintainable code through disciplined naming, small functions, and clean error handling. Use when the user mentions "clean up this code", "this function is too long", "code smells", "naming conventions", "boy scout rule", "single responsibility", or "unit test quality". Also trigger when reviewing a pull request for readability, untangling a messy function, debating comment styles, or improving error-handling patterns. Covers SRP, comment discipline, formatting, and unit testing. For refactoring techniques, see refactoring-patterns. For architecture and dependency rules, see clean-architecture.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Clean Code Framework

A disciplined approach to writing code that communicates intent, minimizes surprises, and welcomes change. Apply these principles when writing new code, reviewing pull requests, refactoring legacy systems, or advising on code quality.

## Core Principle

**Code is read far more often than it is written, optimize for the reader.** The read-to-write ratio is well over 10:1, so every naming choice, function boundary, and formatting decision either adds clarity or adds cost. Clean code reads like well-written prose: names reveal intent, functions tell a story one step at a time, and the Boy Scout Rule applies, always leave the code cleaner than you found it.

## Scoring

**Goal: 10/10.** Rate any code 0-10 against the principles below. Report the current score and the specific improvements needed to reach 10/10.

- **9-10:** Names reveal intent, functions are small and focused, error handling is consistent, tests are clean and comprehensive
- **7-8:** Mostly clean with minor naming ambiguities or a few long functions; tests may lack edge cases
- **5-6:** Mixed, good patterns alongside unclear names, duplicated logic, or inconsistent error handling
- **3-4:** Long multi-purpose functions, misleading names, poor or missing tests
- **1-2:** Nearly unreadable, magic numbers, cryptic abbreviations, no structure, no tests

## The Clean Code Framework

Six disciplines for writing code that communicates clearly and adapts to change:

### 1. Meaningful Names

**Core concept:** Names should reveal intent, avoid disinformation, and make the code read like prose. If a name requires a comment to explain it, the name is wrong.

**Why it works:** Names are the most pervasive form of documentation, a well-chosen name eliminates the need to read the implementation; a poor one forces every reader to reverse-engineer intent.

The rest: https://github.com/wondelai/skills/blob/HEAD/clean-code/SKILL.md
