clean-code

A language-independent guide to writing code that is easier to change and maintain. It focuses on simple design, clear responsibilities, limited dependencies, and removing unused code.

In plain words
What is it for?
It is for refactoring code, reviewing code quality, fixing naming and complexity problems, applying SOLID principles, and cleaning up code during a TDD cycle.
Why use it?
It helps reduce the cost and risk of future changes by keeping related behavior together and limiting how far a modification spreads.

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

Made for: Claude Code, Codex.

Per session 75 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,554 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.00075 $0.01554
Opus 5 $0.00037 $0.00777
Sonnet 5 $0.00015 $0.00311
Haiku 4.5 $0.00007 $0.00155

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

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

How it starts

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

Clean Code Principles

Disciplined development approach for writing high-quality, maintainable code. This skill is language-agnostic; language-specific conventions come from separate skills.

Philosophy

  • Investment in Low Cost of Change: Clean code enables continuous modification without exponential complexity growth
  • Boy Scout Rule: Always leave code cleaner than you found it
  • Simplicity (KISS): Always prefer the simpler solution
  • Root Cause Analysis: Fix problems at their source, not symptoms

Core Principles (Always Apply)

1. Loose Coupling

Components know little about each other. Dependencies flow through well-defined APIs. Changes in one component minimally affect others. Prefer composition over inheritance. Depend on abstractions, not concretions.

2. High Cohesion

Elements that belong together stay together. Each module has a single, well-defined purpose. Related functionality is grouped. Unrelated functionality is separated.

3. Change is Local

Modifications are contained within boundaries. A feature change affects minimal files/modules. Stable interfaces protect implementations.

4. It is Easy to Remove

Delete dead code immediately. Remove unused abstractions. Eliminate unnecessary features. Code should be easy to delete, not just easy to add.

5. Mind-sized Components

Functions: one screen or less. Classes: under 100 lines as a guideline. If it cannot be held in working memory, it is too big.

Refactoring Scope

When multiple code smells or improvements are found, present them as a prioritized markdown list, then use AskUserQuestion to let the user decide how to proceed:

  • Question: "How do you want to handle these findings?"
  • Options:
    • "Fix all" — apply all suggestions in priority order
    • "Discuss one by one" — walk through each finding for individual approval

This avoids surprise refactorings and lets the user control scope. This process applies regardless of whether findings come from direct review or from the clean-code-reviewer agent.

Read the full file on GitHub · 180 lines

Files

What ships with it

1 file 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. 2d ago First seen · 180 lines · 75 tokens per session scan A da60fc206f01

Subscribe to this mod's changes

clean-code is a skill published in the GitHub repository t1/tdder (14 stars, last pushed 2d ago), licensed Apache-2.0. It adds 75 tokens to every session and 1,554 once invoked, about $0.0004 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.

Related

Other skills, from other repositories

software-test-execution

Run scoped tests for a TDD slice, determine the appropriate test framework and command, and report structured pass/fail results. Use when tests need to be executed after writing, implementing, or refactoring code. Reads test metadata, discovers the test framework if needed, executes the scoped test command, parses…

stencila/stencila · 97 tokens

nw-at-completeness-check

Canonical AT completeness gate — research-anchored 7-category taxonomy (C1-C7) + 15-item mechanical checklist. Paradigm-neutral. Drives acceptance-designer reviewer verdict deterministically.

nWave-ai/nWave · 46 tokens

nw-ab-critique-dimensions

Review dimensions for validating agent quality - template compliance, safety, testing, and priority validation.

nWave-ai/nWave · 26 tokens

re0-git

Rewrite a finished commit's message into a clean, handoff-ready form in your own log style, so git log alone tells the story. User-invoked: run it after a commit.

LilMGenius/paperthin · 46 tokens

debloat

Compress an artifact that has accreted into bloat — padding, over-qualification, fused sentences, walls of enumeration, adjacent restatement — down to its load-bearing density, meaning preserved. Use when prose is correct and current but has grown verbose or patched-over and you want it tight without a full rewrite.

LilMGenius/paperthin · 66 tokens

prism

Split one artifact — a claim, plan, or file — across 2 to 5 independent lenses, one per genuinely distinct failure mode (correctness, security, readability, cost, adversarial-user), and return their convergence: where they agree, where they disagree, and the single next question that resolves the disagreement. Use…

LilMGenius/paperthin · 98 tokens