clean-code

clean-code is a skill for Claude Code, Codex from rainmanjam/poka-yoke. It costs 68 tokens per session (2,161 once invoked), scanned A, original, MIT.

Guidance for making code easier to understand and change, covering names, function size, module responsibilities, dependencies, duplication, and testing. It applies to general software design and review.

In plain words
What is it for?
Reviewing, refactoring, or designing code; improving naming and structure; reducing coupling and duplication; and making code easier to test.
Why use it?
Code that is difficult to read hides defects and makes small changes risky. The guidance helps separate responsibilities and reduce the amount of surrounding code that must change together.

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/rainmanjam/poka-yoke/clean-code
Any agent
npx skills add rainmanjam/poka-yoke --skill clean-code
Clone the repo
git clone --depth 1 https://github.com/rainmanjam/poka-yoke

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/rainmanjam/poka-yoke/clean-code.svg)](https://agentmods.dev/skills/rainmanjam/poka-yoke/clean-code)
Your own site
<a href="https://agentmods.dev/skills/rainmanjam/poka-yoke/clean-code"><img src="https://agentmods.dev/badge/skills/rainmanjam/poka-yoke/clean-code.svg" alt="Measured on agentmods" height="20"></a>
Per session 68 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,161 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found 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.00068 $0.02161
Opus 5 $0.00034 $0.01081
Sonnet 5 $0.00014 $0.00432
Haiku 4.5 $0.00007 $0.00216

Measured 3d ago against content hash b76477aed764, 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 3d 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.

benchmarks/controls/clean-code/skills/clean-code/SKILL.md · 192 lines

How it starts

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

Clean Code: Structure, Naming and Cohesion

Most defects are not clever. They are the ordinary consequence of code that is harder to read than it needed to be. A function that does three things hides which one broke. A name that lies sends the next reader to the wrong file. A module that depends on everything cannot be changed without changing everything.

So the work is not cleverness. It is applying a small number of well-established structural disciplines consistently, and being willing to keep applying them after the code already works.

The line that does most of the work:

Code is read far more often than it is written, and almost always by someone with less context than the author had. Optimise for the reader who arrives in six months knowing nothing. If your change makes sense only because you remember why, it is not finished.

The five disciplines

Every recommendation below reduces to one of these. Naming them keeps a review from collapsing into taste.

Single responsibility. A unit should have one reason to change. When you cannot describe a function without "and", it is doing two things, and the two things will need to change on different schedules. Split along the seam where the reasons differ, not where the line count is convenient.

Cohesion over proximity. Things that change together belong together. Code grouped by technical layer (all the controllers here, all the models there) scatters a single feature across the tree, so every change touches five directories. Group by what the code is about.

Explicit dependencies. A unit should declare what it needs rather than reach for it. Constructor parameters and function arguments are declarations; module-level singletons, global config and ambient state are not. The test for this is whether the unit can be exercised without standing up its whole world.

Names that survive being read alone. A name is the only documentation that cannot go stale, because changing the code without changing the name is visible. Prefer a longer name that is accurate to a short one that is approximately right. elapsed_ms beats t.

Read the full file on GitHub · 192 lines

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. 3d ago First seen · 192 lines · 68 tokens per session scan A b76477aed764

Subscribe to this mod's changes

clean-code is a skill published in the GitHub repository rainmanjam/poka-yoke (21 stars, last pushed 8d ago), licensed MIT. It adds 68 tokens to every session and 2,161 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.