Skip to content
Back to skills

Clean Architecture

ASecurity

Clean architecture — concentric layers (entities, use cases, interface adapters, frameworks), the dependency rule, boundaries and DTOs, module structure, enforcing dependencies with tooling, pragmatic adaptation. Use to structure or review layering and dependency direction (clean architecture, layers, dependency rule, boundaries).

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 3, 2026
ai-agentsgo

Security analysis

A100/100

Scanned December 3, 2026

npx -y skills add vectora-os/kit --skill clean-architecture --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Clean Architecture?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Clean Architecture
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectora-os-clean-architecture/badge)](https://www.skillsdirectory.com/skills/vectora-os-clean-architecture)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: clean-architecture
description: Clean architecture — concentric layers (entities, use cases, interface adapters, frameworks), the dependency rule, boundaries and DTOs, module structure, enforcing dependencies with tooling, pragmatic adaptation. Use to structure or review layering and dependency direction (clean architecture, layers, dependency rule, boundaries).
metadata:
  category: design-patterns
---

# Clean architecture

## Purpose

Make code depend inward on policy, not outward on details, so it stays changeable.

**Use when:** structuring new services or reviewing layering violations.

**Not for:** tiny scripts.

## Inputs

- Codebase or design.

## Outputs

- Layer map, dependency rules, violations list.

## Read first

- [Project Brain](../../../project-brain/README.md) — `npm run brain -- query "clean architecture"` for prior decisions, patterns and anti-patterns.
- [Architecture standard](../../../standards/architecture.md)

## Steps

1. **Layers.** Define layers and what belongs in each.
   Done when each module maps to one layer.
2. **Rule.** Dependencies point inward only; enforce with a tool (e.g., dependency-cruiser, ArchUnit).
   Done when the rule runs in CI.
3. **Boundaries.** Cross boundaries with simple data structures.
   Done when no framework types cross inward.
4. **Review.** List violations with fixes.
   Done when violations have owners.

## Best practices

- Automate the dependency rule.
- Be pragmatic: fewer layers for simple domains.

## Common mistakes

- Layering for its own sake.
- Use cases calling controllers.

## Example

Dependency-cruiser rule forbidding `domain/**` → `infrastructure/**`; 7 violations found and fixed.

## Reusable prompt

```text
Apply the Clean architecture skill (.agents/skills/clean-architecture/SKILL.md).
Context: {{task card or question; links to PRD, ADRs, code paths}}
Constraints: {{approved thresholds, deadlines, allowed files}}
Map the code to layers, define and automate the dependency rule, and list violations with fixes.
Return: Layer map, dependency rules, violations list..
Cite evidence (file:line, command output, source) for every claim; list open questions separately.
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.