Agent skill

Clean Code

by jd-solanki in jd-solanki/slidev-theme-dracula

Write readable, maintainable code through disciplined naming, small functions, and clean error handling.

MITAuto-check passedDevelopment

Install Clean Code

skills CLI
$ npx skills add jd-solanki/slidev-theme-dracula --skill clean-code -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jd-solanki/slidev-theme-dracula clean-code --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jd-solanki/slidev-theme-dracula.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.ai/skills/clean-code .claude/skills/clean-code && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
clean-code
GitHub stars
161
Used in
1 other repo
Token cost
~3.8k tokens
SKILL.md length
1,734 words
Files
7 (incl. references)
Skills in repo
6
Repo updated
First seen
Licence
MIT

At a glance

Write readable, maintainable code through disciplined naming, small functions, and clean error handling.

  • Works in 6 steps: Meaningful Names → Functions → Comments and Formatting → …
  • The user mentions code review
  • SKILL.md covers Core Principle, Scoring, The Clean Code Framework and Common Mistakes, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Clean Code is an agent skill from jd-solanki/slidev-theme-dracula. Write readable, maintainable code through disciplined naming, small functions, and clean error handling. Use when the user mentions "code review", "naming conventions", "function too long", "code smells", "readable code", "boy scout rule", "single responsibility", or "unit test quality". Also trigger when reviewing pull requests for readability, refactoring messy functions, debating comment styles, or improving error handling patterns. Covers SRP, comment discipline, formatting, and unit testing. For refactoring…

Its SKILL.md is about 3.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including reference files (for example `references/code-smells.md`, `references/comments-formatting.md` and `references/error-handling.md`).

It sits in Development, covering Unit testing, Refactoring and Code quality. The repository describes itself as: Dracula theme for slidev 🧛. The licence is MIT.

When your agent uses it

  • The user mentions code review
  • Naming conventions
  • Function too long
  • Single responsibility

Example prompts

  • “code review”
  • “naming conventions”
  • “function too long”
  • “/clean-code”

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Meaningful Names
  2. Functions
  3. Comments and Formatting
  4. Error Handling
  5. Unit Testing
  6. Code Smells and Heuristics

What it can do on your machine

Read from SKILL.md and the folder at commit 383e9b1. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • amazon.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Clean Code loads about 3.8k tokens when it runs, and up to ~23k if it reads all its reference files. Until then it costs about 152 tokens; SKILL.md has 1,734 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~152
When it runs · the whole SKILL.md, loaded when a task matches
~3.8k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~23k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from jd-solanki/slidev-theme-dracula at commit 383e9b1, republished under its MIT licence (© jd-solanki). 1,734 words, ~3,778 tokens.

Download SKILL.mdSave it as .claude/skills/clean-code/SKILL.md (or your agent's skills folder). This skill also uses 6 other files; get the full folder from GitHub.
name
clean-code
description
Write readable, maintainable code through disciplined naming, small functions, and clean error handling. Use when the user mentions "code review", "naming conventions", "function too long", "code smells", "readable code", "boy scout rule", "single responsibility", or "unit test quality". Also trigger when reviewing pull requests for readability, refactoring messy functions, debating comment styles, or improving error handling patterns. Covers SRP, comment discipline, formatting, and unit testing. For refactoring techniques, see refactoring-patterns. For architecture, see clean-architecture.
license
MIT
metadata.author
wondelai
metadata.version
1.2.0

Clean Code Framework

A disciplined approach to writing code that communicates intent, minimizes surprises, and welcomes change. Apply these principles when writing new code, reviewing pull requests, refactoring legacy systems, or advising on code quality.

Core Principle

Code is read far more often than it is written — optimize for the reader. The read-to-write ratio is well over 10:1, so every naming choice, function boundary, and formatting decision either adds clarity or adds cost. Clean code reads like well-written prose: names reveal intent, functions tell a story one step at a time, and the Boy Scout Rule applies — always leave the code cleaner than you found it.

Scoring

Goal: 10/10. Rate any code 0-10 against the principles below. Report the current score and the specific improvements needed to reach 10/10.

  • 9-10: Names reveal intent, functions are small and focused, error handling is consistent, tests are clean and comprehensive
  • 7-8: Mostly clean with minor naming ambiguities or a few long functions; tests may lack edge cases
  • 5-6: Mixed — good patterns alongside unclear names, duplicated logic, or inconsistent error handling
  • 3-4: Long multi-purpose functions, misleading names, poor or missing tests
  • 1-2: Nearly unreadable — magic numbers, cryptic abbreviations, no structure, no tests

The Clean Code Framework

Six disciplines for writing code that communicates clearly and adapts to change:

1. Meaningful Names

Core concept: Names should reveal intent, avoid disinformation, and make the code read like prose. If a name requires a comment to explain it, the name is wrong.

Why it works: Names are the most pervasive form of documentation — a well-chosen name eliminates the need to read the implementation; a poor one forces every reader to reverse-engineer intent.

Key insights:

  • A name should answer why it exists, what it does, and how it is used
  • No encodings, prefixes, or type information (no Hungarian notation); single letters only for tiny-scope loop counters
  • Classes are nouns; methods are verbs
  • One word per concept: don't mix fetch, retrieve, and get
  • Longer scope demands a longer, more descriptive name
  • Rename freely — IDEs make it trivial

Code applications:

ContextPatternExample
VariablesIntention-revealingelapsedTimeInDays not d
BooleansPredicate phrasingisActive, hasPermission, canEdit
FunctionsVerb + nouncalculateMonthlyRevenue() not calc()
ClassesNoun naming the responsibilityInvoiceGenerator not InvoiceManager

See: references/naming-conventions.md

2. Functions

Core concept: Functions should be small, do one thing, and do it well — ideally 4-6 lines, zero to two arguments, one level of abstraction.

Why it works: Small single-purpose functions are easy to name, understand, test, and reuse; long functions hide bugs, resist testing, and accumulate responsibilities.

Key insights:

  • Step-Down Rule: code reads top-down, each function calling the next level of abstraction
  • Argument count: zero best, one fine, two acceptable, three+ requires justification
  • Flag arguments are a smell — the function does two things; split it
  • Command-Query Separation: change state or return a value, never both
  • Extract till you drop: if you can pull out a named function, do it
  • No hidden side effects — the name must tell the whole truth

Code applications:

ContextPatternExample
Long functionExtract named stepsvalidateInput(); transformData(); saveRecord();
Flag argumentSplit into two functionsrenderForPrint() / renderForScreen() not render(isPrint)
Error casesGuard clauses at topEarly return for errors, single happy path
Many argumentsIntroduce parameter objectnew DateRange(start, end) not report(start, end, format, locale)
Side effectsMake effects explicitcheckPassword() that starts a session → rename or separate

See: references/functions-and-methods.md

3. Comments and Formatting

Core concept: A comment is a failure to express yourself in code. When comments are necessary, they explain why, never what. Formatting creates the visual structure that makes code scannable.

Why it works: Comments rot — code changes but comments often don't, creating documentation worse than none. Clean formatting lets developers scan code like a newspaper: headlines first, details on demand.

Key insights:

  • The best comment is a well-named extracted function
  • Acceptable: legal headers, TODOs, public API docs, genuine "why" explanations
  • Commented-out code and journal comments: delete — version control remembers
  • Vertical openness between concepts; vertical density within them; declare variables near usage
  • Newspaper metaphor: high-level functions at the top of the file, details below

Code applications:

ContextPatternExample
Explaining "what"Replace with better name// check if eligible → isEligible()
Explaining "why"Keep as comment// RFC 7231 requires this header for proxies
Commented-out codeDelete itTrust version control
Team formattingDecide once, automatePrettier, Black, gofmt

See: references/comments-formatting.md

4. Error Handling

Core concept: Error handling is a separate concern from business logic. Use exceptions rather than return codes, provide context with every exception, and never return or pass null.

Why it works: Return codes clutter the happy path with checks; exceptions separate the two cleanly. Returning null forces null checks on every caller, and one missing check crashes far from the source.

Key insights:

  • Write the try-catch first — it defines a transaction boundary
  • Prefer unchecked exceptions — checked ones violate the Open/Closed Principle
  • Define exception classes by the caller's needs, not the failure type
  • Don't return null (use empty collections, Optional, or throw); don't pass null either
  • Special Case / Null Object pattern: return an object with default behavior instead of null

Code applications:

ContextPatternExample
Null returnsEmpty collection or Optionalreturn Collections.emptyList() not return null
Error codesReplace with exceptionsthrow new InsufficientFundsException(balance, amount)
Third-party APIsWrap with adapterPortfolioService wraps the vendor API, translates its exceptions
Special casesNull Object patternGuestUser with default behavior instead of null checks
Context in errorsInclude operation + state"Failed to save invoice #1234 for customer 'Acme'"

See: references/error-handling.md

5. Unit Testing

Core concept: Tests are first-class code, kept clean with the same discipline as production code. Dirty tests are worse than no tests — they become a liability that slows every change.

Why it works: Clean tests are executable documentation and a safety net for refactoring; dirty tests make every modification a fight through incomprehensible test code.

Key insights:

  • Three Laws of TDD: write a failing test first; only enough test to fail; only enough code to pass
  • One concept per test — one logical assertion, not necessarily one assert
  • F.I.R.S.T.: Fast, Independent, Repeatable, Self-validating, Timely
  • Build a domain-specific testing language: helpers that read like a DSL
  • Refactor test code as readily as production code

Code applications:

ContextPatternExample
Test structureArrange-Act-AssertSetup, execute, verify — clearly separated
Test namingScenario + expected behaviorshouldRejectExpiredToken not test1
Shared setupBuilder/factory helpersaUser().withRole(ADMIN).build()
Flaky testsRemove external dependenciesMock time, network, file system

See: references/testing-principles.md

Show full SKILL.md (675 more words)Show less
6. Code Smells and Heuristics

Core concept: Smells are surface indicators of deeper design problems — learn to recognize them quickly and apply targeted refactorings instead of vague "cleanup".

Why it works: Smells are heuristics that point toward likely problems without deep analysis, turning code review instinct into specific, repeatable moves.

Key insights:

  • Function smells: too many arguments, output arguments, flag arguments, dead functions
  • General smells: duplication, wrong level of abstraction, feature envy, magic numbers
  • Test smells: insufficient coverage, skipped tests, untested boundary conditions and failure paths
  • Refactor in small, tested steps — never refactor and add features simultaneously
  • Boy Scout Rule: leave the code cleaner than you found it

Code applications:

ContextPatternExample
DuplicationExtract shared logicCommon validation → validateEmail() helper
Feature envyMove method to the data's classorder.calculateTotal() not calculator.total(order)
Dead codeDelete itRemove unused functions, unreachable branches
Magic numbersNamed constantsMAX_LOGIN_ATTEMPTS = 5 not bare 5
Shotgun surgeryConsolidate related changesGroup scattered logic into a single module

See: references/code-smells.md

Common Mistakes

MistakeWhy It FailsFix
Abbreviating namesSaves seconds writing, costs hours readingFull descriptive names; IDEs autocomplete
"Clever" one-linersImpressive to write, impossible to debugExpand into readable named steps
Comments instead of refactoringComments rot; code is the truthExtract a well-named function instead
Catching generic exceptionsSwallows bugs along with expected errorsCatch specific exceptions; let the rest propagate
No tests for error pathsHappy path works, edge cases crashTest every branch, boundary, and failure mode
Premature optimizationObscures intent for marginal gainsClean first; optimize measured bottlenecks
God classesOne 2000-line class does everythingApply SRP — split by responsibility
Refactoring without testsNo safety net for regressionsWrite characterization tests first
Inconsistent conventionsEvery file feels like a different codebaseAgree on style; enforce with linters and formatters
Returning null everywhereNull checks spread like a virusOptional, empty collections, or Null Object

Quick Diagnostic

QuestionIf NoAction
Can you understand each function without reading its body?Names don't reveal intentRename to describe what it does
Are all functions under 20 lines?Functions do too many thingsExtract sub-operations into named helpers
Zero commented-out code blocks?Dead code creating confusionDelete — version control has history
Is error handling separate from business logic?Try-catch clutters the main flowExtract handlers; exceptions over return codes
Does every class have a single responsibility?Classes accumulate unrelated dutiesSplit into focused, well-named classes
Is there a test for every public method?No safety net for changesAdd tests before changing further
Are test names descriptive of behavior?Failures are hard to interpretRename to shouldDoXWhenY
Is duplication below 3 occurrences?Copy-paste spreading bugsExtract a shared function or module
Are magic numbers named constants?Intent hidden behind raw valuesExtract descriptive constants
Do all tests run in under 10 seconds?Slow tests don't get runMock external deps; split integration tests

Reference Files

  • naming-conventions.md: Intention-revealing names, avoiding disinformation, class vs. method naming, before/after examples
  • functions-and-methods.md: Small functions, argument counts, command-query separation, the step-down rule, side effects
  • comments-formatting.md: Good vs. bad comments, the newspaper metaphor, vertical formatting, team rules
  • error-handling.md: Exceptions over return codes, null handling, Special Case pattern, wrapping third-party APIs
  • testing-principles.md: TDD laws, F.I.R.S.T. principles, clean test patterns, test readability
  • code-smells.md: Comprehensive smell catalog organized by category, with targeted refactorings

Further Reading

Based on Robert C. Martin's seminal guide to software craftsmanship:

About the Author

Robert C. Martin ("Uncle Bob") has been programming since 1970, co-authored the Agile Manifesto, and founded Uncle Bob Consulting and Clean Coders. His books — Clean Code, The Clean Coder, Clean Architecture, and Clean Agile — shaped how a generation of developers think about code quality, and his core stance is that the only way to go fast is to go well.

© jd-solanki, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 6 other files (references) in .ai/skills/clean-code of jd-solanki/slidev-theme-dracula.

  • SKILL.md
  • references/code-smells.md
  • references/comments-formatting.md
  • references/error-handling.md
  • references/functions-and-methods.md
  • references/naming-conventions.md
  • references/testing-principles.md

Open the folder on GitHubat commit 383e9b1

Used in 1 other repository

We found 4 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in jd-solanki/slidev-theme-dracula, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Clean Code next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Clean Code compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Clean Code this skilljd-solanki/slidev-theme-dracula1611 repos~3.8kAutomated safety check: PassMIT
Solidramziddin/solid-skills606—~2.7kAutomated safety check: PassNone
Smell CheckZhen-Bo/smell-check239—~1.5kAutomated safety check: PassMIT
Cyclomatic Complexitysaurabhkumar8112/cyclomatic-complexity-skill405—~761Automated safety check: PassApache-2.0
Effect TSmattiacerutti/supernova187—~2.8kAutomated safety check: PassMIT
Code ReviewerYikai-Liao/symusic1891 repos~1.3kAutomated safety check: PassMIT

Similar skills

  • Solid

    ramziddin/solid-skills

    A skill your agent uses when writing code, implementing features, refactoring, planning architecture, designing systems, reviewing code, or debugging.

    606 GitHub stars~2.7k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Smell Check

    Zhen-Bo/smell-check

    Runs a smell-first audit on a user-chosen path set: measures structure metrics, applies a named size profile, and reports code smells and test smells with evidence strength.

    239 GitHub stars~1.5k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Cyclomatic Complexity

    saurabhkumar8112/cyclomatic-complexity-skill

    Refactor code to reduce cyclomatic complexity so it stays readable, maintainable, and aligned with the long-term vision of the codebase, not just optimized for AI comprehension.

    405 GitHub stars~761 tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Effect TS

    mattiacerutti/supernova

    Write idiomatic Effect v4 TypeScript following official best practices from effect-solutions and the Effect source.

    187 GitHub stars~2.8k tokensUpdated today
    DevelopmentAuto-check passed
  • Code Reviewer

    Yikai-Liao/symusic

    Analyzes code diffs and files to identify bugs, security vulnerabilities (SQL injection, XSS, insecure deserialization), code smells, N+1 queries, naming issues, and architectural concerns, then…

    189 GitHub starsUsed in 1 repo~1.3k tokens
    DevelopmentAuto-check passed
  • Go Development Guidelines

    jumppad-labs/jumppad

    Sets idiomatic Go conventions with a test-first workflow, using testify/require for assertions and mockery for mocks, for new features, packages and refactors.

    263 GitHub stars~1.5k tokensUpdated 6 days ago
    DevelopmentAuto-check passed

More from jd-solanki/slidev-theme-dracula

  • Automate npm Release

    jd-solanki/slidev-theme-dracula

    Automate npm package publishing via GitHub Actions for single-package repos and independent monorepo packages, including bumpp version tags, GitHub release notes, trusted publishing, provenance, and…

    161 GitHub stars~626 tokensUpdated 3 mo ago
    Auto-check passed
  • Comment Code

    jd-solanki/slidev-theme-dracula

    Write clear, useful in-code comments and documentation that capture what the code cannot say for itself.

    161 GitHub stars~2.7k tokensUpdated 3 mo ago
    Auto-check passed
  • Node CLI

    jd-solanki/slidev-theme-dracula

    Patterns and conventions for building Node.js CLI tools — src structure, entry point setup, Commander wiring, and update notifications.

    161 GitHub stars~1.6k tokensUpdated 3 mo ago
    Auto-check passed
  • Automate Commit Based Gh Release Changelog

    jd-solanki/slidev-theme-dracula

    Automate GitHub release creation and changelog generation from Conventional Commits using changelogithub — includes GitHub release mechanics, tag-based triggers, required permissions, and…

    161 GitHub stars~470 tokensUpdated 3 mo ago
    Auto-check passed
  • Code Organisation

    jd-solanki/slidev-theme-dracula

    Decide where code lives — the directory tree, module and package boundaries, and the layout inside a file.

    161 GitHub stars~1.6k tokensUpdated 3 mo ago
    Auto-check passed

Categories

Questions about Clean Code

What does Clean Code do?

Write readable, maintainable code through disciplined naming, small functions, and clean error handling. Clean Code is an agent skill from jd-solanki/slidev-theme-dracula. Write readable, maintainable code through disciplined naming, small functions, and clean error handling.

When should I use Clean Code?

Clean Code fits situations like: the user mentions code review; naming conventions; function too long; single responsibility.

How do I install Clean Code in Claude Code?

Run `npx skills add jd-solanki/slidev-theme-dracula --skill clean-code -a claude-code`. Or copy the skill folder (.ai/skills/clean-code in jd-solanki/slidev-theme-dracula) into .claude/skills/clean-code in your project. Claude Code loads it when a task matches its description.

How do I install Clean Code in Codex?

Run `npx skills add jd-solanki/slidev-theme-dracula --skill clean-code -a codex`. Or copy the skill folder (.ai/skills/clean-code in jd-solanki/slidev-theme-dracula) into .agents/skills/clean-code in your project. Codex loads it when a task matches its description.

Can I use Clean Code in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jd-solanki/slidev-theme-dracula --skill clean-code -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/clean-code, .gemini/skills/clean-code, .github/skills/clean-code and .opencode/skills/clean-code in your project.

What does Clean Code need to run?

SKILL.md names no scripts, command-line tools or credentials: Clean Code is instructions for the agent only.

Does Clean Code access the network?

SKILL.md names 1 domain. As links in the text: amazon.com. This is read from the text; nothing was executed.

Is Clean Code safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Clean Code use?

Clean Code is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Clean Code use?

About 3.8k tokens (SKILL.md is roughly 15k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 20k tokens, read only when the agent opens those files.

What are the alternatives to Clean Code?

Skills that share tags, products or a category with Clean Code: Solid (ramziddin/solid-skills, 606 stars), Smell Check (Zhen-Bo/smell-check, 239 stars), Cyclomatic Complexity (saurabhkumar8112/cyclomatic-complexity-skill, 405 stars) and Effect TS (mattiacerutti/supernova, 187 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Clean Code?

jd-solanki (a GitHub user) maintains it in jd-solanki/slidev-theme-dracula, which has 161 GitHub stars. The repository holds 6 skills in this directory. The repository was last updated on July 6, 2026.

Source: jd-solanki/slidev-theme-dracula on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.