clean-code-skill

clean-code-skill is a skill for OpenCode from darellchua2/opencode-config-template. It costs 34 tokens per session (6,866 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 OpenCode

Written for OpenCode: installed under .opencode/. Also seen: mentions OpenCode.

Good fit Use it when writing new code, refactoring older code, reviewing readability, setting…

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: OpenCode.

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.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.svg" alt="Measured on agentmods" 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 6,866 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.06866
Opus 5 $0.00017 $0.03433
Sonnet 5 $0.00007 $0.01373
Haiku 4.5 $0.00003 $0.00687

Measured 3d ago against content hash 3274c5600312, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-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 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.

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
opencode_app/.opencode/skills/clean-code-skill/SKILL.md · 935 lines

How it starts

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

What I do

I help you write clean, maintainable code that is easy to understand and change:

  1. Improve Naming: Apply consistent, understandable, specific, and searchable naming conventions
  2. Reduce Function Size: Keep functions small (under 10 lines) with single responsibility
  3. Apply Object Calisthenics: Follow the 9 rules for better object-oriented design
  4. Eliminate Comments: Replace comments with self-documenting code
  5. Improve Formatting: Apply consistent code structure and organization
  6. Reduce Cognitive Load: Write code that tells a story

When to use me

Use this skill when:

  • Code is hard to understand even though it works
  • Functions are long and do multiple things
  • Names are vague, inconsistent, or misleading
  • Code requires extensive comments to explain what it does
  • Reviewing code for readability and maintainability
  • Onboarding new developers who struggle with the codebase
  • Setting up coding standards for a team
  • Refactoring legacy code for better maintainability

Prerequisites

  • Code to analyze or write
  • Understanding of basic programming concepts
  • Willingness to refactor for readability
  • Knowledge of the domain/business context for naming

What is Clean Code?

Code that is:

  • Easy to understand - reveals intent clearly
  • Easy to change - modifications are localized
  • Easy to test - dependencies are injectable
  • Simple - no unnecessary complexity

The Human-Centered Approach

Code has THREE consumers:

  1. Users - get their needs met
  2. Customers - make or save money
  3. Developers - must maintain it

Design for all three, but remember: developers read code 10x more than they write it.


Naming Principles

Priority Order for Naming

  1. Consistency & Uniqueness (HIGHEST PRIORITY)
  2. Understandability
  3. Specificity
  4. Brevity
  5. Searchability
  6. Pronounceability
  7. Austerity

1. Consistency & Uniqueness

Same concept = same name everywhere. One name per concept.

Read the full file on GitHub · 935 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 · 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 today), licensed Apache-2.0. It adds 34 tokens to every session and 6,866 once invoked, about $0.0002 per session on Opus 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

Other skills, from other repositories

recipe-front-review

Reviews completed frontend implementation for governing-source compliance, scope economy, repository quality, and security, then applies user-approved React corrections.

shinpr/claude-code-workflows · 29 tokens

brooks-sweep

Full-sweep mode: runs a unified analysis across all quality dimensions — code decay, architecture, tech debt, and test quality — then applies fixes directly to the codebase. Safe changes are auto-applied; risky changes are confirmed before execution. Drawing on twelve classic engineering books. Triggers when: user…

hyhmrright/brooks-lint · 178 tokens

dorodango

Polishes working code through successive quality passes in fresh subagents. Use after tests pass when code needs multi-dimension refinement before release.

athola/claude-night-market · 31 tokens

ring:exploring-codebases

Exploring a codebase across phases: scopes the target, detects architecture, components, and layers, deep-dives each discovered perspective, then synthesizes findings into actionable guidance with file:line evidence. Use to understand how a feature or system works before planning changes, or to orient on an unfamiliar…

LerianStudio/ring · 91 tokens

ring:searching-code

Forensic code search and analysis with optional Chain of Draft (CoD) ultra-concise mode. Five-phase methodology (clarification, planning, execution, analysis, synthesis) with severity assessment. Use for targeted investigation of specific patterns, bugs, or vulnerabilities. Skip for broad architecture mapping (use…

LerianStudio/ring · 74 tokens

ring:planning-codebase-simplification

Planning a whole-codebase simplification: audits a Go/TS codebase for needless abstraction and emits a KILL/REVIEW/KEEP plan plus a ring:running-dev-cycle task array. Plans only — no edits. Detects single-impl interfaces, pass-through shims, translation-free adapters, and dead-code cascade chains under an inverted…

LerianStudio/ring · 105 tokens