clean-code

Applies Clean Code, Clean Architecture, and Clean Craftsmanship principles to writing, reviewing, and refactoring software.

1|Updated May 28, 2026
One-click install
npx skills add https://github.com/dhanesh/agent-skills --skill clean-code-dhanesh
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: clean-code
Source: https://github.com/dhanesh/agent-skills/tree/main/clean-code
Command: npx skills add https://github.com/dhanesh/agent-skills --skill clean-code-dhanesh

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Code that is hard to read, test, or change slows every future change down. This Skill gives an AI agent a working, proportionate application of Robert C. Martin's Clean Code, Clean Architecture, and Clean Craftsmanship principles so reviews, refactors, and designs follow consistent, defensible rules instead of ad-hoc taste. ## Core Features & Use Cases - Structured code review: Emits a scannable review report where each finding is anchored to a named principle or smell, with a concrete fix, plus a smells-to-fixes dispatch table and the full Clean Code chapter 17 catalog. - Refactor-on-green discipline: Enforces running the test suite before and after every structural change so cleanups never silently break working code. - Right-sized architecture guidance: Decision trees and layered references (SOLID, TDD, component cohesion/coupling, the Dependency Rule, concurrency, craftsmanship) that scale structure to the problem instead of over-engineering. - Use Case: Ask the agent to review a pull request; it produces a prioritized findings list citing SRP, Law of Demeter, or needless complexity, each with a concrete fix, and calls out what is already good. ## Quick Start Ask the agent to review a file or refactor a function using the clean-code skill, for example by requesting a clean code review of checkout.py.

Frequently Asked Questions about clean-code

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I get an AI agent to do a clean code review?▼

Invoke the skill explicitly (for example /clean-code) or preload it in a subagent's skills field, then ask for a review. It returns a structured report with findings anchored to principles or smells, each with a concrete fix, ordered by importance.

What principles does this clean code skill cover?▼

It covers meaningful naming, small single-purpose functions, DRY, SOLID, error handling, TDD and Kent Beck's simple design rules, component cohesion and coupling, the Clean Architecture Dependency Rule, concurrency defense, and craftsmanship disciplines like estimation and saying no.

Does this skill work with languages other than Python?▼

Yes, it is language-agnostic and prompt-only with no runtime dependencies. The principles apply to any codebase the agent can read; examples are illustrative and the agent is instructed to write in the user's language and idioms.

How does the skill avoid over-engineering small tasks?▼

A dedicated right-sizing section treats needless complexity as a smell and matches structure to the problem. Full Clean Architecture layering is reserved for systems with diverging reasons to change; a short script gets one testable seam, not ports and adapters.

Why doesn't the skill trigger automatically on review requests?▼

As an advisory knowledge skill, models rarely auto-invoke it as a first action. The README recommends preloading it via a subagent's skills field, a SessionStart hook, a CLAUDE.md instruction, or manual /clean-code invocation for reliable application.

When should I not use clean code architecture layering?▼

Skip ports, adapters, and composition roots for small scripts or single-purpose tools without diverging reasons to change. The skill directs you to introduce a boundary only when a concrete pressure appears, such as a second caller, a swapped database, or an untestable seam.