clean-code

clean-code is a skill for Claude Code from t1/tdder. It costs 75 tokens per session (1,554 once invoked), scanned A, original, Apache-2.0.

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 Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions subagents; names the AskUserQuestion tool.

Part of the tdder plugin — 14 skills, 2 commands, 6 agents, 1 hook shipped together

Good fit It is for refactoring code, reviewing code quality, fixing naming and complexity problems, applying SOLID principles, and cleaning up code during a TDD cycle.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/t1/tdder/clean-code
View source ↗ t1/tdder
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.

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.

Or install tdder, the plugin that ships this one along with the rest of its 14 skills, 2 commands, 6 agents, 1 hook.

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/t1/tdder/clean-code/github.svg)](https://agentmods.dev/skills/t1/tdder/clean-code)
Your own site
<a href="https://agentmods.dev/skills/t1/tdder/clean-code"><img src="https://agentmods.dev/badge/skills/t1/tdder/clean-code/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for clean-code

Your own site · 80×15
<a href="https://agentmods.dev/skills/t1/tdder/clean-code"><img src="https://agentmods.dev/badge/skills/t1/tdder/clean-code.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
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. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00075 $0.01554
Opus 5.5 $0.00030 $0.00622
Sonnet 5.5 $0.00015 $0.00311
Haiku 4.5 $0.00007 $0.00155

Measured 1mo ago against content hash da60fc206f01, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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. 1mo 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 today), licensed Apache-2.0. It adds 75 tokens to every session and 1,554 once invoked, about $0.0003 per session on Opus 5.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.