Provides implementation patterns for Clean Architecture, Domain-Driven Design (DDD), and Hexagonal Architecture (Ports & Adapters) in NestJS/TypeScript applications.

MITAuto-check: notesDevelopment

Install Clean Architecture

skills CLI
$ npx skills add giuseppe-trisciuoglio/developer-kit --skill clean-architecture -a claude-code

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

GitHub CLI
$ gh skill install giuseppe-trisciuoglio/developer-kit clean-architecture --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/giuseppe-trisciuoglio/developer-kit.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/developer-kit-typescript/skills/clean-architecture .claude/skills/clean-architecture && 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-architecture
GitHub stars
357
Token cost
~2k tokens
SKILL.md length
689 words
Files
6 (incl. references)
Skills in repo
115
Repo updated
First seen
Licence
MIT

At a glance

Provides implementation patterns for Clean Architecture, Domain-Driven Design (DDD), and Hexagonal Architecture (Ports & Adapters) in NestJS/TypeScript applications.

  • Works in 8 steps: Understand the Architectural Layers → Learn DDD Tactical Patterns → Organize Your Project Structure → …
  • Structuring complex backend systems
  • SKILL.md covers Overview, When to Use, Instructions and Examples, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Clean Architecture is an agent skill from giuseppe-trisciuoglio/developer-kit. Provides implementation patterns for Clean Architecture, Domain-Driven Design (DDD), and Hexagonal Architecture (Ports & Adapters) in NestJS/TypeScript applications. Use when structuring complex backend systems, designing domain layers with entities/value objects/aggregates, implementing ports and adapters, creating use cases, or refactoring from anemic models to rich domain models with dependency inversion.

Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 6 other files, including reference files (for example `references/best-practices.md`, `references/constraints.md` and `references/examples.md`).

It sits in Development, covering Design patterns and Domain-driven design. It works with NestJS and TypeScript. The repository describes itself as: Modular plugin marketplace for Claude Code and agentic CLIs, with validated, spec-driven skills, agents, commands, and workflows for Java, TypeScript, Python, PHP, AWS, and AI. The licence is MIT.

When your agent uses it

  • Structuring complex backend systems
  • Designing domain layers with entities/value objects/aggregates
  • Implementing ports and adapters
  • Creating use cases

Example prompts

  • “Use the clean-architecture skill to provide implementation patterns for Clean Architecture, Domain-Driven Design (DDD), and Hexagonal Architecture…”
  • “/clean-architecture”

Requirements

  • Pre-approved tools (allowed-tools): Read, Write, Edit, Bash, Glob, Grep

Workflow steps

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

  1. Understand the Architectural Layers
  2. Learn DDD Tactical Patterns
  3. Organize Your Project Structure
  4. Implement the Domain Layer
  5. Implement the Application Layer
  6. Implement Adapters
  7. Configure Dependency Injection
  8. Apply Best Practices

What it can do on your machine

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

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Bash
    • Glob
    • Grep

    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

    No URLs in SKILL.md.

    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 Architecture loads about 2k tokens when it runs, and up to ~15k if it reads all its reference files. Until then it costs about 108 tokens; SKILL.md has 689 words of instructions outside code blocks.

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

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: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Read, Write, Edit, Bash, Glob, Grep

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 giuseppe-trisciuoglio/developer-kit at commit fe73fb3, republished under its MIT licence (© giuseppe-trisciuoglio). 689 words, ~2,023 tokens.

Download SKILL.mdSave it as .claude/skills/clean-architecture/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
clean-architecture
description
Provides implementation patterns for Clean Architecture, Domain-Driven Design (DDD), and Hexagonal Architecture (Ports & Adapters) in NestJS/TypeScript applications. Use when structuring complex backend systems, designing domain layers with entities/value objects/aggregates, implementing ports and adapters, creating use cases, or refactoring from anemic models to rich domain models with dependency inversion.
allowed-tools
Read, Write, Edit, Bash, Glob, Grep

Clean Architecture, DDD & Hexagonal Architecture for NestJS

Overview

This skill provides comprehensive guidance for implementing Clean Architecture, Domain-Driven Design (DDD), and Hexagonal Architecture patterns in NestJS/TypeScript applications. It covers the architectural layers, tactical patterns, and practical implementation examples for building maintainable, testable, and loosely-coupled backend systems.

When to Use

  • Architecting complex NestJS applications with long-term maintainability
  • Refactoring from tightly-coupled MVC to layered architecture
  • Implementing rich domain models with business logic encapsulation
  • Designing testable systems with swappable infrastructure
  • Creating microservices with clear bounded contexts
  • Separating business rules from framework code
  • Implementing event-driven architectures with domain events

Instructions

1. Understand the Architectural Layers

Clean Architecture organizes code into concentric layers where dependencies flow inward. Inner layers have no knowledge of outer layers:

+-------------------------------------+
|  Infrastructure (Frameworks, DB)    |  Outer layer - volatile
+-------------------------------------+
|  Adapters (Controllers, Repositories)|  Interface adapters
+-------------------------------------+
|  Application (Use Cases)            |  Business rules
+-------------------------------------+
|  Domain (Entities, Value Objects)   |  Core - most stable
+-------------------------------------+

The Hexagonal Architecture (Ports & Adapters) pattern complements this:

  • Ports: Interfaces defining what the application needs
  • Adapters: Concrete implementations of ports
  • Domain Core: Pure business logic with zero dependencies
2. Learn DDD Tactical Patterns

Apply these patterns in your domain layer:

  • Entities: Objects with identity and lifecycle
  • Value Objects: Immutable, defined by attributes
  • Aggregates: Consistency boundaries with aggregate roots
  • Domain Events: Capture state changes
  • Repositories: Abstract data access for aggregates
3. Organize Your Project Structure

Structure your NestJS project following Clean Architecture principles:

src/
+-- domain/                    # Inner layer - no external deps
|   +-- entities/              # Domain entities
|   +-- value-objects/         # Immutable value objects
|   +-- aggregates/            # Aggregate roots
|   +-- events/                # Domain events
|   +-- repositories/          # Repository interfaces (ports)
|   +-- services/              # Domain services
+-- application/               # Use cases - orchestration
|   +-- use-cases/             # Individual use cases
|   +-- ports/                 # Input/output ports
|   +-- dto/                   # Application DTOs
|   +-- services/              # Application services
+-- infrastructure/            # External concerns
|   +-- database/              # ORM config, migrations
|   +-- http/                  # HTTP clients
|   +-- messaging/             # Message queues
+-- adapters/                  # Interface adapters
    +-- http/                  # Controllers, presenters
    +-- persistence/           # Repository implementations
    +-- external/              # External service adapters
4. Implement the Domain Layer

Create pure domain objects with no external dependencies:

  1. Value Objects: Immutable objects validated at construction
  2. Entities: Objects with identity containing business logic
  3. Aggregates: Consistency boundaries protecting invariants
  4. Repository Ports: Interfaces defining data access contracts
5. Implement the Application Layer

Create use cases that orchestrate business logic:

  1. Define input/output DTOs for each use case
  2. Inject repository ports via constructor
  3. Implement business workflows in the execute method
  4. Keep use cases focused on a single responsibility
6. Implement Adapters

Create concrete implementations of ports:

  1. Persistence Adapters: Map domain objects to/from ORM entities
  2. HTTP Adapters: Controllers that transform requests to use case inputs
  3. External Service Adapters: Integrate with third-party services
7. Configure Dependency Injection

Wire everything together in NestJS modules:

  1. Register use cases as providers
  2. Provide repository implementations using interface tokens
  3. Import required infrastructure modules (TypeORM, etc.)
8. Apply Best Practices

Follow these principles throughout implementation:

  1. Dependency Rule: Dependencies only point inward. Domain knows nothing about NestJS, TypeORM, or HTTP.
  2. Rich Domain Models: Put business logic in entities, not services. Avoid anemic domain models.
  3. Immutability: Value objects must be immutable. Create new instances instead of modifying.
  4. Interface Segregation: Keep repository interfaces small and focused.
  5. Constructor Injection: Use NestJS DI in outer layers only. Domain entities use plain constructors.
  6. Validation: Validate at boundaries (DTOs) and enforce invariants in domain.
  7. Testing: Domain layer tests require no NestJS testing module - pure unit tests.
  8. Transactions: Keep transactions in the application layer, not domain.
Show full SKILL.md (225 more words)Show less

Examples

For detailed code examples covering all aspects of Clean Architecture implementation, see:

  • references/examples.md - Complete examples including:
    • Value Objects (Email, Money)
    • Entities with Business Logic (OrderItem)
    • Aggregate Roots with Domain Events (Order)
    • Repository Ports (Interfaces)
    • Use Cases (Application Layer)
    • Repository Adapters (Infrastructure)
    • Controller Adapters (HTTP)
    • Module Configuration (DI setup)

Best Practices

For comprehensive guidance on Clean Architecture best practices, including:

  • Core Principles: Dependency Rule, Rich Domain Models, Immutability, Interface Segregation
  • Testing Strategies: Unit testing domain, integration testing application, E2E testing adapters
  • Performance Considerations: Aggregate design, caching strategy, lazy loading

See references/best-practices.md

Constraints and Warnings

Important constraints, common pitfalls, and implementation warnings:

  • Architecture Constraints: Dependency rule violations, domain purity requirements, interface location rules
  • Common Pitfalls: Leaky abstractions, anemic domain models, wrong layer dependencies, missing ports
  • Implementation Warnings: Mapping overhead, learning curve, boilerplate code, transaction boundaries
  • Performance Considerations: Aggregate size, database queries, caching strategies

See references/constraints.md

Quick Start

  1. Read the architectural layers overview above
  2. Review the examples.md for implementation patterns
  3. Study best-practices.md for core principles
  4. Check constraints.md to avoid common pitfalls
  5. Start implementing your domain layer with pure TypeScript classes
  6. Add application layer use cases to orchestrate business logic
  7. Implement adapters for infrastructure concerns
  8. Configure dependency injection in NestJS modules

References

  • references/examples.md - Complete code examples for all layers
  • references/best-practices.md - Comprehensive best practices and principles
  • references/constraints.md - Constraints, pitfalls, and warnings

© giuseppe-trisciuoglio, 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 5 other files (references) in plugins/developer-kit-typescript/skills/clean-architecture of giuseppe-trisciuoglio/developer-kit.

  • SKILL.md
  • references/best-practices.md
  • references/constraints.md
  • references/examples.md
  • references/nestjs-implementation.md
  • references/typescript-clean-architecture.md

Open the folder on GitHubat commit fe73fb3

Compare with similar skills

Clean Architecture 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 Architecture compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Clean Architecture this skillgiuseppe-trisciuoglio/developer-kit357—~2kAutomated safety check: NotesMIT
Evolutionary Modular Architecturetech-leads-club/agent-skills7k—~3.7kAutomated safety check: PassCC-BY-4.0
AST Visitor Pattern for Unionsprisma/orm48k—~830Automated safety check: PassApache-2.0
Dddswamp-club/swamp646—~1.4kAutomated safety check: PassCustom licence
Effect TSmattiacerutti/supernova185—~2.8kAutomated safety check: PassMIT
Scaffoldcodewithmukesh/dotnet-claude-kit756—~1.7kAutomated safety check: PassMIT

Similar skills

  • Evolutionary Modular Architecture

    tech-leads-club/agent-skills

    Guides design of modular-monolith platforms with DDD, flat-by-aggregate modules, anti-corruption layers, outbox events and resilience, plus an architecture document with SVG diagrams.

    7k GitHub stars~3.7k tokensUpdated 2 days ago
    DevelopmentAuto-check passed
  • Official

    Replaces a plain TypeScript union plus switch statements with frozen subclasses and a visitor interface when several places dispatch on the same variants.

    48k GitHub stars~830 tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Ddd

    swamp-club/swamp

    Domain Driven Design guidance for TypeScript/Deno codebases.

    646 GitHub stars~1.4k tokensUpdated today
    DevelopmentAuto-check passed
  • Effect TS

    mattiacerutti/supernova

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

    185 GitHub stars~2.8k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Scaffold

    codewithmukesh/dotnet-claude-kit

    Architecture-aware feature scaffolding for .NET 10 projects.

    756 GitHub stars~1.7k tokensUpdated 2 mo ago
    DevelopmentAuto-check passed
  • Architecture Advisor

    codewithmukesh/dotnet-claude-kit

    Architecture selection advisor for .NET applications. An agent skill from codewithmukesh/dotnet-claude-kit.

    756 GitHub starsUsed in 1 repo~2.9k tokens
    DevelopmentAuto-check passed

More from giuseppe-trisciuoglio/developer-kit

All 115 skills in this repo
  • Nestjs Drizzle Crud Generator

    giuseppe-trisciuoglio/developer-kit

    Generates complete CRUD modules for NestJS applications with Drizzle ORM.

    357 GitHub stars~1.3k tokensUpdated 1 mo ago
    Auto-check: notes
  • Spring Boot Actuator

    giuseppe-trisciuoglio/developer-kit

    Provides patterns to configure Spring Boot Actuator for production-grade monitoring, health probes, secured management endpoints, and Micrometer metrics across JVM services.

    357 GitHub stars~2.2k tokensUpdated 1 mo ago
    Auto-check: notes
  • Spring Boot Crud Patterns

    giuseppe-trisciuoglio/developer-kit

    Provides and generates complete CRUD workflows for Spring Boot 3 services.

    357 GitHub stars~2.5k tokensUpdated 1 mo ago
    Auto-check: notes
  • Spring Boot Security JWT

    giuseppe-trisciuoglio/developer-kit

    Provides JWT authentication and authorization patterns for Spring Boot 3.5.x covering token generation with JJWT, Bearer/cookie authentication, database/OAuth2 integration, and RBAC/permission-based…

    357 GitHub stars~3.9k tokensUpdated 1 mo ago
    Auto-check: notes
  • AWS CLI Beast

    giuseppe-trisciuoglio/developer-kit

    Provides advanced AWS CLI patterns for managing EC2, Lambda, S3, DynamoDB, RDS, VPC, IAM, and CloudWatch.

    357 GitHub stars~1.7k tokensUpdated 1 mo ago
    Auto-check: notes
  • PR Review Comments

    giuseppe-trisciuoglio/developer-kit

    Posts review findings from a JSON file as inline comments on a GitHub Pull Request, attaching each comment to its file and line.

    357 GitHub stars~1k tokensUpdated 1 mo ago
    Auto-check: notes

Categories

Questions about Clean Architecture

What does Clean Architecture do?

Provides implementation patterns for Clean Architecture, Domain-Driven Design (DDD), and Hexagonal Architecture (Ports & Adapters) in NestJS/TypeScript applications. Clean Architecture is an agent skill from giuseppe-trisciuoglio/developer-kit. Provides implementation patterns for Clean Architecture, Domain-Driven Design (DDD), and Hexagonal Architecture (Ports & Adapters) in NestJS/TypeScript applications.

When should I use Clean Architecture?

Clean Architecture fits situations like: structuring complex backend systems; designing domain layers with entities/value objects/aggregates; implementing ports and adapters; creating use cases.

How do I install Clean Architecture in Claude Code?

Run `npx skills add giuseppe-trisciuoglio/developer-kit --skill clean-architecture -a claude-code`. Or copy the skill folder (plugins/developer-kit-typescript/skills/clean-architecture in giuseppe-trisciuoglio/developer-kit) into .claude/skills/clean-architecture in your project. Claude Code loads it when a task matches its description.

How do I install Clean Architecture in Codex?

Run `npx skills add giuseppe-trisciuoglio/developer-kit --skill clean-architecture -a codex`. Or copy the skill folder (plugins/developer-kit-typescript/skills/clean-architecture in giuseppe-trisciuoglio/developer-kit) into .agents/skills/clean-architecture in your project. Codex loads it when a task matches its description.

Can I use Clean Architecture 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 giuseppe-trisciuoglio/developer-kit --skill clean-architecture -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-architecture, .gemini/skills/clean-architecture, .github/skills/clean-architecture and .opencode/skills/clean-architecture in your project.

What does Clean Architecture need to run?

SKILL.md names no scripts, command-line tools or credentials: Clean Architecture is instructions for the agent only. Its frontmatter pre-approves these tools: Read, Write, Edit, Bash, Glob, Grep.

Does Clean Architecture access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Clean Architecture safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Clean Architecture use?

Clean Architecture is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Clean Architecture use?

About 2k tokens (SKILL.md is roughly 8.1k 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 13k tokens, read only when the agent opens those files.

What are the alternatives to Clean Architecture?

Skills that share tags, products or a category with Clean Architecture: Evolutionary Modular Architecture (tech-leads-club/agent-skills, 7k stars), AST Visitor Pattern for Unions (prisma/orm, 48k stars), Ddd (swamp-club/swamp, 646 stars) and Effect TS (mattiacerutti/supernova, 185 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Clean Architecture?

giuseppe-trisciuoglio (a GitHub user) maintains it in giuseppe-trisciuoglio/developer-kit, which has 357 GitHub stars. The repository holds 115 skills in this directory. The repository was last updated on September 10, 2026.

Source: giuseppe-trisciuoglio/developer-kit on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.