Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Clean Architecture Skill for Claude Code

A Claude Code skill that guides architectural design decisions using Robert C. Martin's Clean Architecture principles, SOLID design, and Musk's 5-step engineering algorithm.

What it does

When you ask architecture questions, this skill ensures Claude:

  • Uses Clean Architecture terminology β€” Entities, Use Cases, Interface Adapters, Frameworks & Drivers (not generic "Service Layer" / "Repository Layer")
  • Explains the Dependency Rule β€” dependencies point inward, outer layers depend on inner layers
  • Provides concrete code examples β€” before/after refactoring with explicit layer labels
  • Pushes back on over-engineering β€” applies Musk's Algorithm to question unnecessary complexity
  • Treats infrastructure as detail β€” databases, caches, message queues belong in the outermost layer

Eval Results

Tested across 14 scenarios (3 core + 11 system design):

Category Without Skill With Skill
Core evals (refactoring, DIP, over-engineering) 83% 92%
System design (Twitter, microservices, caching, etc.) 50% 100%

The skill's biggest impact is on system design β€” without it, Claude defaults to infrastructure-first thinking. With it, Claude consistently separates business rules from implementation details.

Installation

Option 1: npx skills (recommended)

npx skills add tokenaissance/clean-architecture-skill

To install for a specific agent only:

npx skills add tokenaissance/clean-architecture-skill -a claude-code

Option 2: Claude Code plugin

claude plugin add tokenaissance/clean-architecture-skill

Option 3: Manual

git clone https://github.com/tokenaissance/clean-architecture-skill.git
cp -r clean-architecture-skill/clean-architecture ~/.claude/skills/

After installation, restart Claude Code. The skill triggers automatically when you ask about architecture, layering, refactoring, dependency management, or technology selection.

Example prompts

My Express.js backend has all business logic in controllers. How should I refactor it?

Our Order entity directly imports the Stripe SDK for payments. What's wrong with this design?

We're building an internal tool for 5 users. A colleague suggests microservices + Kafka + Redis. What do you think?

We need to design a Twitter-like social media platform. How should we architect it?

We're migrating from MongoDB to PostgreSQL. Do we need to rewrite all our code?

Skill structure

clean-architecture/
β”œβ”€β”€ SKILL.md                          # Main skill instructions
β”œβ”€β”€ references/
β”‚   β”œβ”€β”€ clean-architecture.md         # Clean Architecture principles (Robert C. Martin)
β”‚   β”œβ”€β”€ musk-algorithm.md             # Musk's 5-step engineering algorithm
β”‚   └── engineering-philosophy.md     # Dialectical engineering philosophy
└── evals/
    β”œβ”€β”€ evals.json                    # 3 core eval scenarios
    └── system-design-evals.json      # 11 system design eval scenarios

Covered scenarios

# Scenario What it tests
1 Architecture refactoring Clean Architecture layers, dependency rule, code examples
2 Dependency direction DIP violations, interface-based decoupling
3 Over-engineering detection Musk's Algorithm, questioning requirements
4 Twitter-scale system CA layers in distributed systems
5 Microservices vs monolith Modular monolith recommendation
6 Caching strategy Cache as infrastructure detail
7 URL shortener Core business rules as Entities
8 Database sharding Repository abstraction
9 Distributed transactions Saga pattern with CA layers
10 REST to GraphQL API as Interface Adapter
11 Multi-tenancy Tenant-agnostic business logic
12 Third-party adapters Ports & Adapters pattern
13 Database migration Zero business logic change
14 Real-time chat Transport as infrastructure detail

References

  • Robert C. Martin, Clean Architecture: A Craftsman's Guide to Software Structure and Design
  • SOLID Principles
  • Elon Musk's 5-Step Engineering Algorithm

License

MIT

About

πŸ—οΈ Clean Architecture + SOLID principles + Musk's 5-step algorithm β€” Claude Code skill

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors