Architecture & Systems

Clean Architecture

Building maintainable, testable software architectures

Build maintainable software architectures using Robert C. Martin's Clean Architecture principles. This skill equips your AI agent with the Dependency Rule, layered architecture patterns, and boundary design that keeps business logic independent of frameworks and infrastructure.

Updated Free & MIT-licensed

npx skills add wondelai/skills/clean-architecture --global

02 What it is

What is the Clean Architecture skill?

Clean Architecture is a free AI agent skill built on Robert C. Martin’s book. It enforces the Dependency Rule — source code dependencies point inward, from frameworks toward use cases toward entities — so your agent puts business logic where the database, the web framework and the vendor SDK can be swapped without touching it.

03 Key concepts

Five principles your agent applies.

Drawn from Clean Architecture — not advice it repeats back to you, but decisions it makes while it works.

01 The Dependency Rule Dependencies point inward — outer layers depend on inner layers, never the reverse. Business rules know nothing about UI or databases.
02 Entities & Use Cases Entities encapsulate enterprise-wide business rules. Use cases contain application-specific business rules that orchestrate entities.
03 Interface Adapters Controllers, presenters, and gateways convert data between the format most convenient for use cases and the format used by external agencies.
04 Frameworks Are Details Frameworks and databases are implementation details — keep them at the outer ring and make them replaceable.
05 SOLID Principles Single Responsibility, Open-Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion guide component design.

04 Fit

When to use it, and
when not to.

four symptoms it fixes, and four it doesn't.

Reach for it when

You cannot run a single business rule in a test without booting the web framework and a database first.

Replacing the ORM or upgrading the framework would mean editing files all over the codebase, not just the edges.

Nobody can say which layer a new class belongs in, so everything lands in one enormous services folder.

You are deciding whether to split into microservices and want the boundaries drawn before the deployments are.

Reach for something else when

The app is small and the layers would cost more than they save. Software Design’s complexity test is the better judge.

You know you need boundaries but not where they go. Domain-Driven Design finds the seams the business actually has.

The problem is naming, function length and readability inside one module. Clean Code is the more specific tool.

You need the system to survive a failing dependency, not a cleaner layer diagram. that is Release It!.

05 Prompts

Say it like this.

Name the skill at the end of a prompt and the agent applies the framework rather than a vibe. Or say nothing — it loads on its own when a task matches.

example prompts
# 01 · Architecture

Restructure this application to follow Clean Architecture layers using clean-architecture skill

# 02 · Architecture review

Identify Dependency Rule violations in this codebase using clean-architecture skill

# 03 · Design

Design use case and entity layers for this feature using clean-architecture skill

# 04 · Refactoring

Decouple the database layer so we can swap ORMs without touching business logic using clean-architecture skill

06 About the author

Robert C. Martin

Co-author of the Agile Manifesto, creator of SOLID principles

Robert C. Martin (Uncle Bob) is a software engineer, author, and co-author of the Agile Manifesto. He has been a programmer since 1970 and has shaped how the industry thinks about software design, from SOLID principles to clean architecture.

07 Same stack

The stack it sits in.

08 Questions

Before you install.

01

How do I install the Clean Architecture skill?

Run npx skills add wondelai/skills/clean-architecture --global. It takes about 30 seconds and needs no account. The Clean Architecture skill then works in Claude, Claude Code, Claude Cowork, Codex, Cursor, OpenClaw and Hermes Agent — anything that reads the open agentskills.io format — and your agent loads it on its own when a task calls for it. It is free and MIT-licensed, and the source is at https://github.com/wondelai/skills.

02

Which book is the Clean Architecture skill based on?

It packages Clean Architecture by Robert C. Martin — co-author of the Agile Manifesto, creator of SOLID principles. The skill distils the book's method into instructions your agent follows while it works, covering the dependency rule, entities & use cases and interface adapters. It sits in the Architecture & Systems part of the library.

03

How is this different from the Domain-Driven Design skill?

Clean Architecture answers which way dependencies point across a boundary; Domain-Driven Design answers where the boundary belongs and what the things inside it mean. Martin’s rule tells you a repository interface lives in the inner circle and its Postgres implementation outside. Evans tells you it should be an OrderRepository, because Order is an aggregate root in your fulfilment context. Installed together, one supplies direction, the other supplies location and vocabulary.

04

What does the Dependency Rule actually say?

That source code dependencies may point only inward, toward higher-level policy. An inner circle must not name anything in an outer one — no class, no function, no variable, and especially no data format that an outer layer defines. Because control often has to flow outward at runtime, you invert it: the use case declares an interface, the outer layer implements it, and the source dependency still points in.

05

Isn’t Clean Architecture over-engineering for a small app?

Often, yes, and the skill will say so if you ask it to. Four concentric circles, an interface per gateway and a DTO at every crossing can easily cost more than they save on a CRUD app with one datastore. What survives at any size is the direction rule plus a real boundary at the one or two points of genuine volatility. Ask which boundaries earn their cost and treat the folder count as negotiable.

06

Does it cover microservices?

It covers the decision, not the operations. The book’s position, which the skill applies, is that services are units of deployment rather than units of architecture, and that services sharing one fat data model are a distributed monolith with network failures added. Expect it to push you toward a modular monolith with real internal boundaries, from which later extraction is mechanical. For capacity questions use System Design; for runtime failure modes, Release It!.

09 Guides that use it

Put it to work.

Long-form playbooks where this skill does part of the job.

01 How to Create a New App with AI Skills Go from concept to a well-architected, well-built app — validation, architecture, domain modeling, and clean code — with AI agent skills from Lean Startup, Clean Architecture, DDD, and more. 19 min read 02 From Vibe-Coded Prototype to Production-Ready Product A hands-on engineering playbook for turning an AI-generated prototype into something you can ship and operate — tests, structure, resilience, and scale — using AI agent skills from Clean Code, Refactoring, Release It!, and more. 20 min read 03 How to Refactor a Codebase Buried in Technical Debt A safe, incremental plan for taming a legacy codebase — characterization tests, seams, named refactorings, and boundaries — using AI agent skills from Working Effectively with Legacy Code, Refactoring, Clean Architecture, and more. 18 min read 04 How to Design the Best Possible Architecture for a New App Make the high-leverage architecture decisions right the first time — boundaries, domain model, data, and resilience — using AI agent skills from Clean Architecture, Domain-Driven Design, Designing Data-Intensive Applications, and more. 19 min read 05 Make a Slow App Measurably Faster An engineering playbook for a codebase that ships and earns but has grown slow and tangled — baseline, boundaries, hot paths, the real bottleneck, and the query layer — using AI agent skills from Working Effectively with Legacy Code, Clean Architecture, A Philosophy of Software Design, Refactoring, Release It!, and Designing Data-Intensive Applications. 20 min read

One skill, one command.

Install Clean Architecture, or the whole stack.

npx skills add wondelai/skills/clean-architecture --global

MIT licensed · Claude, Claude Code, Codex, Cursor, OpenClaw, Hermes · No account

  We build the skills you already use. Now we’ll build yours. See what we build  ·  Book a 15-min call