clean-code

A coding guide for readable code and clear software structure across languages and frameworks. It covers naming, responsibilities, module boundaries, dependencies, testing, and refactoring.

In plain words
What is it for?
Use it while writing, reviewing, testing, refactoring, or organizing application code, scripts, infrastructure, and database work.
Why use it?
It helps prevent code from being placed in the wrong layer, duplicated, or changed without checking how the surrounding system works.

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

Made for: Claude Code, Codex.

Per session 112 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,166 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.00112 $0.05166
Opus 5 $0.00056 $0.02583
Sonnet 5 $0.00022 $0.01033
Haiku 4.5 $0.00011 $0.00517

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

The scan reads SKILL.md. This mod also ships 3 executable files (scripts/check_boundaries.py, scripts/detect_stack.py, scripts/scan_repo.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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 · 373 lines

How it starts

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

Clean Code And Clean Architecture

Clean code makes intent, behavior, boundaries, and failure modes easy for the next maintainer to understand and safely change. Clean architecture keeps the cost of a change proportional to its scope instead of its shape.

Written for AI coding agents of any vendor, and language-agnostic: adapt every rule to the project's language, framework, runtime, and local style. Three agent-specific truths shape everything below:

  1. You read faster than humans but forget context between sessions. Structure, names, placement, and written-down decisions are how your work survives you.
  2. Your most common failures are not syntax errors. They are code in the wrong place, duplicated knowledge, mixed responsibilities, invented APIs, and unverified claims of success.
  3. You are prone to a specific architectural failure: wiring the shortest path between two points. That is how a controller ends up calling a repository directly and skipping the only authorization check in the system.

When To Use

Any coding work in any language: features, fixes, refactors, tests, reviews, scripts, SQL, infrastructure as code, UI, services, libraries. Specifically whenever you are about to create a file or directory, add behavior to an existing unit, decide where logic belongs, add a dependency, cross a boundary, introduce a layer, start a project, or clean one up.

Use a lighter touch for trivial edits, but still avoid unrelated changes.

Start Here: Load Project Context

You may have no memory of this project. Recover what you need from disk before deciding anything.

  1. Read .clean/context.json if it exists: language, frameworks, test command, layout. If it is missing or stale, run scripts/detect_stack.py --write, or answer its questions by inspection.
  2. Read .clean/architecture.md if it exists: the declared layers and which dependencies are allowed. This is the project's intended design, and it overrides your instincts.
  3. Read .clean/decisions.md and .clean/ledger.md if they exist: past decisions and any cleanup campaign already in progress. Never re-litigate a recorded decision; never restart a campaign that is mid-flight.
  4. Read the project's own instructions — AGENTS.md, CLAUDE.md, CONTRIBUTING.md, ARCHITECTURE.md, README.md. Project instructions outrank this skill.

Read the full file on GitHub · 373 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. 2d ago First seen · 373 lines · 112 tokens per session scan A 30eb3500ddef

Subscribe to this mod's changes

clean-code is a skill published in the GitHub repository btseee/clean-code-skills (7 stars, last pushed 11d ago), licensed MIT. It adds 112 tokens to every session and 5,166 once invoked, about $0.0006 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-31.

Related

Other skills, from other repositories

dingtalk_channel_connect

Use a headed browser to automatically complete DingTalk channel integration for QwenPaw. Applicable when the user mentions DingTalk, developer console, Client ID, Client Secret, bot, Stream mode, binding or configuring a channel. Supports pausing when a login page is detected and resuming after the user logs in.

agentscope-ai/QwenPaw · 69 tokens

pdf

当用户需要对PDF文件进行任何操作时,请使用此技能。包括从 PDF 中读取或提取文本/表格、合并多个 PDF、拆分 PDF、旋转页面、添加水印、创建新PDF、填写PDF表单、加密/解密 PDF、提取图片,以及对扫描版 PDF 进行 OCR 使其可搜索。如果用户提到 .pdf 文件或要求生成 PDF,请使用此技能。.

agentscope-ai/QwenPaw · 95 tokens

make_plan

For external plan request scenarios, guides the Agent to request a clear, actionable, step-by-step plan from a stronger Agent via listagents and chatwithagent, emphasizing that the plan is executed by the requester, not by the consulted Agent.

agentscope-ai/QwenPaw · 51 tokens

gpt-image-2

面向 GPT Image 2 的图像生成 / 编辑技能。可在 3 种环境下使用:(A) Garden 本地模式,通过 OpenAI 兼容接口直接出图并落盘;(B) Host-Native 模式,把本 Skill 当作提示词工程指引,把渲染好的 prompt 交给宿主 Agent 自带的图像工具出图;(C) Advisor 模式,宿主无任何图像工具时退化为高质量 prompt 顾问。涵盖 18 大类、80+ 个结构化模板,覆盖海报 / UI / 产品 / 信息图 / 学术图 / 技术架构图 / 漫画 / 头像 / 流程板 / 电影分镜 / IP 周边 / 编辑工作流等场景。.

ConardLi/garden-skills · 177 tokens

new

Create a new project to start development quickly.

clacky-ai/openclacky · 10 tokens

officecli-word-form

Use this skill to create fillable Word forms (.docx) with real Content Controls (SDT) + legacy FormField checkboxes + MERGEFIELD mail-merge placeholders + document protection. Trigger on: 'fillable form', 'form fields', 'content controls', 'SDT', 'word form', 'fill in', 'only editable fields', 'protect document'…

iOfficeAI/OfficeCLI · 224 tokens