clean-code-skill

clean-code-skill is a skill for Claude Code, Codex from darellchua2/opencode-config-template. It costs 34 tokens per session (1,258 once invoked), scanned C, original, Apache-2.0.

A set of practices for making code easier for people to read, understand, and change, regardless of programming language.

In plain words
What is it for?
Use it when writing new code, refactoring older code, reviewing readability, setting team standards, or helping new developers understand a codebase.
Why use it?
It addresses vague names, oversized functions, confusing structure, and code that needs too many comments to explain.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions OpenCode.

Good fit Use it when writing new code, refactoring older code, reviewing readability, setting team standards, or helping new developers understand a codebase.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/darellchua2/opencode-config-template/clean-code-skill
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 darellchua2/opencode-config-template --skill clean-code-skill
Clone the repo
git clone --depth 1 https://github.com/darellchua2/opencode-config-template

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-skill

README.md
[![agentmods](https://agentmods.dev/badge/skills/darellchua2/opencode-config-template/clean-code-skill/github.svg)](https://agentmods.dev/skills/darellchua2/opencode-config-template/clean-code-skill)
Your own site
<a href="https://agentmods.dev/skills/darellchua2/opencode-config-template/clean-code-skill"><img src="https://agentmods.dev/badge/skills/darellchua2/opencode-config-template/clean-code-skill/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-skill

Your own site · 80×15
<a href="https://agentmods.dev/skills/darellchua2/opencode-config-template/clean-code-skill"><img src="https://agentmods.dev/badge/skills/darellchua2/opencode-config-template/clean-code-skill.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 34 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,258 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. 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.00034 $0.01258
Opus 5.5 $0.00014 $0.00503
Sonnet 5.5 $0.00007 $0.00252
Haiku 4.5 $0.00003 $0.00126

Measured 2mo ago against content hash 0568cd73de9c, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade C, and why

clean-code-skill scanned grade C with 1 finding 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 2mo 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

When protocol is enabled, this skill defaults to `Iterations: 10` (sufficient for typical single-pass workflows). Override with `Iterations: N` for specific tasks. Safety blocks: `.env`, `node_modules/`, `rm -rf`, `git p
skills/clean-code-skill/SKILL.md · 77 lines

How it starts

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

What I do

Apply clean-code practice — naming, small functions (<10 lines), single responsibility, self-documenting code — and enforce this project's codified learnings below. House rules take precedence over textbook practice.

When to use me

  • Writing or reviewing code for readability and maintainability
  • Refactoring legacy code; vague, inconsistent, or misleading names; long multi-purpose functions

Textbook content (naming priority order, Object Calisthenics with code examples, formatting, steps, checklists) removed 2026-09 — the model already knows it; this file carries only house-specific rules. All 10 learnings preserved verbatim (rule + detection); illustrative code blocks dropped.

House Learnings

Learning: method-name-reuse-different-semantics

A method name reused across classes with DIFFERENT semantics violates the principle of least surprise — the reader assumes one meaning, the code does another. Before naming a method, grep the codebase for the proposed name; if it exists elsewhere, verify the semantic contract is IDENTICAL or qualify the name with the specific condition (process_for_refund, build_draft). Detection: rg 'def (\w+)\(self' --type py -o --no-filename | sort | uniq -c | sort -rn | head -30

Learning: duplicate-service-account-check

Never call the same expensive method twice in one function — extract to a local variable. Single call, clear intent, no redundant work.

Learning: two-phase-dataclass-initialization

Every function must return a COMPLETE object. If a field cannot be computed at construction time, make it Optional[None] so the type system surfaces the incompleteness — sentinel defaults (0.0, None, "") plus a companion compute_*/populate_* call are silently wrong when the second call is forgotten. Detection: functions returning hardcoded defaults that have companion compute_*/populate_* methods.

Learning: parallel-hierarchies-for-report-type-variants

Two container+hook+component trees that are >70% identical for different report types are a duplication smell — every bug fix must be applied twice and drifts silently on the second pass. Extract a single parameterized tree driven by a type discriminator + config object (REPORT_CONFIG: Record<ReportType, …>). Detection: sibling feature folders with matching use*Report hooks; structural diff (difftastic) on the pair.

Read the full file on GitHub · 77 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. 2mo ago Changed · -858 lines 0568cd73de9c
  2. 3mo ago First seen · 935 lines · 34 tokens per session scan C 3274c5600312

Subscribe to this mod's changes

clean-code-skill is a skill published in the GitHub repository darellchua2/opencode-config-template (6 stars, last pushed 2mo ago), licensed Apache-2.0. It adds 34 tokens to every session and 1,258 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

clean-code-skill compared with skills from other repositories

clean-code-skill next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
clean-code-skilldarellchua2/opencode-config-templateSkill62mo agoApache-2.0C34Claude Code, Codex
recipe-front-reviewshinpr/claude-code-workflowsSkill7254d agoMITA29Claude Code
new-skillhyhmrright/brooks-lintSkill1.6kyesterdayMITA145Claude Code, Codex
brooks-sweephyhmrright/brooks-lintSkill1.6kyesterdayMITA178Claude Code
dorodangoathola/claude-night-marketSkill358yesterdayMITA31Claude Code
laravel-owasp-securityAsyrafHussin/agent-skillsSkill116yesterdayMITA111Claude Code
code-slopAsyrafHussin/agent-skillsSkill116yesterdayMITA110Claude Code, Codex