# codehygiene

The codehygiene Claude Code skill checks code readability after writing, editing, refactoring, or reviewing code. It flags issues such as deep nesting and swallowed errors that formatters miss.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf (Devin Desktop), Claude.ai · ★ 287 repo stars
- Author: brianbell-x
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/brianbell-x/codehygiene/tree/HEAD/codehygiene/SKILL.md
- Updated: 2026-11-16
- Security check: automated, 2026-11-17 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/codehygiene

## What it does

codehygiene scans changed files in Python, TypeScript, JavaScript, Rust, Go, C, C++, Zig, Java, C#, and Lua. It flags deep nesting, redundant comments, swallowed errors, unclear variable names, magic indices, and duplicated blocks. Run the check after each coding change.

The runner needs Python and the skill files, including `weights.npz`; it works offline. If `numpy` is not installed, use `uv run --with numpy`. To scan files, run `python3 "<SKILL_DIR>" <touched-files> --check`. Run it again after fixes; a clean check exits with code `0`.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add brianbell-x/codehygiene --skill codehygiene -a claude-code
```

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

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add brianbell-x/codehygiene --skill codehygiene -a codex
```

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

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add brianbell-x/codehygiene --skill codehygiene -a cursor
```

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

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install brianbell-x/codehygiene codehygiene
```

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

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add brianbell-x/codehygiene --skill codehygiene -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/brianbell-x/codehygiene --path codehygiene
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/codehygiene/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/brianbell-x/codehygiene/tree/HEAD/codehygiene/SKILL.md

## When to use it
- catch swallowed errors and unsafe fallbacks
- flatten deeply nested control flow
- replace unclear names and magic indices
- remove redundant comments and duplicated blocks

## Example prompts
- Check the readability of my changed files and fix every finding.
- Review `src/parser.py` for readability problems.
- Run codehygiene on the files changed in this refactor.

## Similar
- [finding-duplicate-functions](https://affpapa.org/en/nevibecode/skills/finding-duplicate-functions.md) — skill · 659 installs
- [coding-standards](https://affpapa.org/en/nevibecode/skills/coding-standards.md) — skill · 7900 installs
- [dry-refactoring](https://affpapa.org/en/nevibecode/skills/dry-refactoring.md) — skill · 4100 installs
- [tech-debt-analyzer](https://affpapa.org/en/nevibecode/skills/tech-debt-analyzer.md) — skill · 991 installs
- [command-pattern](https://affpapa.org/en/nevibecode/skills/command-pattern.md) — skill · 668 installs
- [jscodeshift](https://affpapa.org/en/nevibecode/skills/jscodeshift.md) — skill · 422 installs

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