clean-code

clean-code is a skill for Claude Code, Codex from sutchan/Agent-Skills-Hub. It costs 126 tokens per session (3,298 once invoked), scanned A, a copy of clean-code, MIT.

A set of code-quality guidelines for making names clear, functions small, error handling consistent, and tests easier to understand.

In plain words
What is it for?
Use it when writing, reviewing, or refactoring code, especially when functions are too long, names are unclear, or code has smells.
Why use it?
It helps reduce confusing code, duplicated logic, and avoidable maintenance work. It also gives a way to review code and identify specific improvements.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/sutchan/agent-skills-hub/clean-code
Any agent
npx skills add sutchan/Agent-Skills-Hub --skill clean-code
Clone the repo
git clone --depth 1 https://github.com/sutchan/Agent-Skills-Hub

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for clean-code

README.md
[![agentmods](https://agentmods.dev/badge/skills/sutchan/agent-skills-hub/clean-code.svg)](https://agentmods.dev/skills/sutchan/agent-skills-hub/clean-code)
Your own site
<a href="https://agentmods.dev/skills/sutchan/agent-skills-hub/clean-code"><img src="https://agentmods.dev/badge/skills/sutchan/agent-skills-hub/clean-code.svg" alt="Measured on agentmods" height="20"></a>
Per session 126 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,298 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00126 $0.03298
Opus 5 $0.00063 $0.01649
Sonnet 5 $0.00025 $0.00660
Haiku 4.5 $0.00013 $0.00330

Measured 5d ago against content hash 072b309df4ea, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

clean-code scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to clean-code — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/clean-code/SKILL.md · 223 lines

How it starts

The opening of the file, as written. The whole thing — 223 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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.

Key insights:

  • A name should answer why it exists, what it does, and how it is used
  • No encodings, prefixes, or type information (no Hungarian notation); single letters only for tiny-scope loop counters
  • Classes are nouns; methods are verbs
  • One word per concept: don't mix fetch, retrieve, and get
  • Longer scope demands a longer, more descriptive name
  • Rename freely — IDEs make it trivial

Read the full file on GitHub · 223 lines

Files

What ships with it

6 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 223 lines · 126 tokens per session scan A 072b309df4ea

Subscribe to this mod's changes

clean-code is a skill published in the GitHub repository sutchan/Agent-Skills-Hub (2 stars, last pushed today), licensed MIT. It adds 126 tokens to every session and 3,298 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to clean-code, differing in 0 lines, and is treated as a copy.