Skip to content
arch-ddd logo

Arch Ddd

arch-ddd

Apply Domain-Driven Design (DDD) architecture to backend projects. Use for tasks like defining bounded contexts, aggregates and invariants, entities/value objects, domain services, repositories, domain events, application services, anti-corruption layers, and aligning code structure and APIs with...

SKILL.md

Full skill instructions

arch-ddd

Use this skill to design or refactor a backend system toward DDD (领域驱动设计) with clear boundaries and maintainable evolution.

Core principles (practical)

  • Ubiquitous Language: domain terms in code, APIs, and docs must match.
  • Bounded Contexts: separate subdomains with explicit boundaries; integrate via contracts.
  • Aggregate: the unit of consistency; enforce invariants inside the aggregate.
  • Application vs Domain: application services orchestrate; domain model owns rules.
  • Ports & Adapters: infrastructure depends on domain/​application, not the other way around.

Deliverables (what “good” looks like)

  • A list of bounded contexts + their responsibilities and integration points.
  • Aggregate definitions (root, entities, value objects) + invariants.
  • Command/​query use-cases mapped to application services.
  • Repository interfaces (in domain/​application) + infra implementations.
  • Domain events for cross-context integration (outbox if needed).

Workflow

  1. Understand the domain
  • Identify actors, key workflows, nouns/​verbs, and business constraints.
  • Extract invariants (must always be true) and policies (may change).
  1. Split bounded contexts
  • Group capabilities that change together.
  • Define context boundaries and “ownership” of data/​behaviors.
  • For each boundary: define integration style (sync API, async events, file/​batch).
  1. Define aggregates
  • Start from invariants and transactions, not tables.
  • Choose one aggregate root per consistency boundary.
  • Keep aggregates small; reference other aggregates by ID only.
  1. Define application services (use cases)
  • Each endpoint maps to a use-case (command/​query).
  • Commands: validate, load aggregate, execute domain behavior, persist, publish events.
  • Queries: read-optimized models (can be denormalized) and avoid domain coupling.
  1. Persistence strategy
  • Repository interface returns aggregates; hide ORM/​SQL details.
  • Avoid cross-aggregate joins in write paths; consider read models for queries.
  • Use domain IDs (string/​ULID/​UUID) consistently across layers.
  1. Integration patterns
  • Cross-context sync: explicit contract DTOs; add Anti-Corruption Layer (ACL) when mapping is non-trivial.
  • Cross-context async: domain events; versioned payloads; idempotent consumers.
  1. Testing approach
  • Domain: fast unit tests around invariants and behaviors.
  • Application: use-case tests with fakes for repositories/​outbox.
  • Integration: contract tests for APIs/​events; DB tests only where needed.

Anti-patterns to avoid

  • “Everything is a service”: domain logic scattered in application/​service layer.
  • Anemic domain model: entities are just getters/​setters.
  • Aggregate too large: one aggregate per table or “user” becomes god object.
  • Tight coupling to DB schema: domain types leak ORM annotations everywhere.

Code organization (suggested)

  • domain/: aggregates, entities, value objects, domain services, domain events, repository interfaces
  • application/: use-cases, command/​query handlers, DTOs, mappers, transaction boundary
  • infrastructure/: DB/​ORM, message bus, external clients, repository implementations
  • interfaces/ (or api/): controllers/​routers, request/​response models, auth

More DevOps & CI/CD skills

Project scaffolding, deployment configuration, and CI/CD setup for Google ADK agents.

6K 472.6K
View

Set up tracing, logging, and monitoring for deployed ADK agents across Cloud Trace, BigQuery, and third-party platforms.

6K 472.6K
View

Enterprise Azure infrastructure architect generating Bicep or Terraform from workload descriptions.

1.5K 454.3K
View
azure-kubernetes logo
DevOps & CI/CD

azure-kubernetes

Plan and configure production-ready Azure Kubernetes Service clusters with Day-0 and Day-1 best practices.

1.5K 447.1K
View

Raw mechanical interfaces fusing Swiss typographic print with military terminal aesthetics. Rigid grids, extreme type scale contrast, utilitarian color, analog degradation effects. For data-heavy dashboards, portfolios, or editorial sites that need to feel like declassified blueprints.

92.7K 354.9K
View
just-scrape logo
DevOps & CI/CD

just-scrape

Web search, scraping, extraction, crawling, and monitoring via ScrapeGraph AI CLI.

69 245K
View

Skill for working with Firebase Hosting (Classic). Use this when you want to deploy static web apps, Single Page Apps (SPAs), or simple microservices. Do NOT use for Firebase App Hosting.

462 159.7K
View

Deploy and manage web apps with Firebase App Hosting. Use this skill when deploying Next.js/Angular apps with backends.

462 159.1K
View
deploy-to-vercel logo
DevOps & CI/CD

deploy-to-vercel

Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".

31.9K 146.6K
View
programmatic-seo logo
DevOps & CI/CD

programmatic-seo

Build SEO-optimized pages at scale using templates, data, and proven playbook patterns.

53.3K 140.1K
View

Design and build isolated, reusable Convex backend components with clear boundaries and app-facing wrappers.

63 123.5K
View

Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".

31.9K 116.1K
View

Coding & apps AI tools

Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View
Imagica logo
Coding & apps

Imagica

Build a no-code AI app in minutes.

Freemium
View
E
Coding & apps

Emergent.sh

An IDE for code migration from legacy to modern frameworks through coding agents.

Freemium
View
Wonder Dynamics logo
Coding & apps

Wonder Dynamics

Automate CGI animation in live-action scenes

Paid
View
M
Coding & apps

Mixo

Launch a website in seconds with AI.

Paid
View
AI Code Convert logo
Coding & apps

AI Code Convert

Streamline Your Coding Experience with AI Code Helper

Free
View