# clean-code

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.

- skill · `type=skill` · Claude Code · 7176 installs
- Author: davila7
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/davila7/claude-code-templates/tree/HEAD/cli-tool/components/skills/development/clean-code
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/skills/clean-code

## What it does

The skill lays out the rules the agent follows while writing and editing code. It ships as tables: core principles (single responsibility, DRY, KISS, YAGNI), naming conventions, limits on function size and nesting depth. A separate section lists anti-patterns — a comment on every line, a helper for a one-liner, a factory for two objects, a `utils.ts` holding a single function.

Before touching any file, the skill makes the agent check what imports it and which tests cover it, then edit the dependent files in the same task. When the work is done, there is a self-check: goal met, all files updated, lint and TypeScript pass. Anything that fails gets fixed before the agent reports back.

The skill also documents a set of verification scripts, but those belong to other skills in the same collection. Each agent runs only its own: `ux_audit.py` for frontend work, `api_validator.py` for backend. Without those skills installed the scripts are simply not there, and `clean-code` runs fine on its own. Tool access is limited to `Read`, `Write` and `Edit`.

## Install

### Claude Code (native platform)

1. **claude-code-templates**
```bash
npx claude-code-templates@latest --skill development/clean-code
```

2. **Skills CLI (Vercel)**
```bash
npx skills add davila7/claude-code-templates --skill clean-code -a claude-code
```

3. **Manually: put the files in place**
- File: `~/.claude/skills/clean-code/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/clean-code/

### Codex

**Manually: put the files in place**
- File: `.agents/skills/clean-code/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

**Manually: put the files in place**
- File: `.cursor/skills/clean-code/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install davila7/claude-code-templates clean-code
```

2. **Manually: put the files in place**
- File: `.github/skills/clean-code/SKILL.md`

### Gemini CLI

**Platform CLI**
```bash
gemini skills install https://github.com/davila7/claude-code-templates --path cli-tool/components/skills/development/clean-code
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/clean-code/SKILL.md` — The legacy .windsurf/skills/ path still works

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/davila7/claude-code-templates/tree/HEAD/cli-tool/components/skills/development/clean-code

## When to use it
- stop the agent from writing hundred-line functions
- strip the obvious comments the agent adds to every line
- rename variables like `n` and `data` into something readable
- check what imports a file before editing it
- remove abstractions like a factory built for two objects

## Example prompts
- add a password change endpoint, follow clean-code
- fix the duplicate email bug, skip the explanation
- refactor `UserService.ts` per clean-code and update the dependent files

## Similar
- [clean-code-guard](https://affpapa.org/en/nevibecode/skills/clean-code-guard.md) — skill · 4700 installs
- [typescript-clean-code](https://affpapa.org/en/nevibecode/skills/typescript-clean-code.md) — skill · 628 installs
- [clean-code-principles](https://affpapa.org/en/nevibecode/skills/clean-code-principles.md) — skill · 1800 installs
- [code-refactoring-refactor-clean](https://affpapa.org/en/nevibecode/skills/code-refactoring-refactor-clean.md) — skill · 1200 installs
- [clean-architecture](https://affpapa.org/en/nevibecode/skills/pproenca-clean-architecture.md) — skill · 2000 installs
- [code-simplification](https://affpapa.org/en/nevibecode/skills/code-simplification.md) — skill · 62800 installs

## Other versions with the same name
- [clean-code · sickn33](https://affpapa.org/en/nevibecode/skills/sickn33-clean-code.md) — 12400 installs
- [clean-code · wondelai](https://affpapa.org/en/nevibecode/skills/wondelai-clean-code.md) — 6600 installs
- [clean-code · decebals](https://affpapa.org/en/nevibecode/skills/decebals-clean-code.md) — 379 installs
- [clean-code · pproenca](https://affpapa.org/en/nevibecode/skills/pproenca-clean-code.md) — 842 installs

From the same set: [davila7/claude-code-templates](https://affpapa.org/en/nevibecode/by/davila7/claude-code-templates.md) — 205 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
