enterprise-ddd
Enterprise DDD Architecture
Use this skill for large systems where domain boundaries, ownership, and cross-team scaling matter more than local feature speed.
Use This Skill When
- Multiple domains must be isolated (billing, auth, catalog, attendance, etc.).
- You need explicit module contracts across frontend and backend.
- Event-driven integration is preferred over direct cross-module coupling.
- Monorepo governance and release boundaries are required.
Do Not Use When
- Project is small or single-team with low domain complexity.
- A simple layered architecture is sufficient.
Architecture Contract
- Model domain boundaries first (bounded contexts).
- Keep each domain module internally FSD-like and externally contract-based.
- Forbid deep cross-module imports.
- Communicate across modules/services with events or stable APIs.
- Maintain separate deployable apps and services.
- Keep shared packages infra-only (
types,ui,config,utils).
Recommended Structure
apps/ deployable apps
modules/ bounded-context frontend modules
services/ bounded-context backend services
packages/ shared infrastructure packages
infrastructure/ deployment and platform resources
Implementation Workflow
1) Domain Modeling
- List domains and ownership.
- Define each module public API (
index.ts) first. - Define event contracts and versioning.
2) Module Design (Frontend)
- Apply FSD inside a domain module:
entities,features,widgets,shared.- Export only public APIs from module root.
- Keep domain state and API hooks inside module boundary.
3) Service Design (Backend)
- Keep domain, application, infrastructure, presentation separation.
- Use repository interfaces in domain layer and implementations in infrastructure.
- Emit domain events for cross-service actions.
4) Integration Rules
- Allowed: event bus, API client boundary, declared public exports.
- Forbidden: direct imports into other module internals.
- Enforce via lint/import rules in CI.
5) Rollout
- Start with 1-2 high-value domains.
- Add generators/templates for new domain modules.
- Track coupling metrics and refactor hot paths.
Decision Matrix
- Need independent scaling per domain: choose DDD.
- Need strict module ownership across teams: choose DDD.
- Need fastest delivery on small scope: avoid DDD for now.
Output Requirements for Agent
- Propose target domain map.
- Provide import/event boundary rules.
- Provide migration plan from current structure to target structure.
- Include risks, rollback plan, and testing strategy.
References
- Detailed structures, code templates, generators, and examples:
references/guide.md
More from alicoder001/agent-skills
react-vite
React + Vite SPA development patterns including project setup, configuration, and optimization. Use for building single-page applications with Vite bundler.
22javascript
JavaScript micro-optimizations and performance patterns. Use when optimizing loops, array operations, caching, or DOM manipulation. Includes Set/Map usage, early returns, and memory-efficient patterns.
14senior
Senior frontend developer practices including code quality, accessibility, responsive design, and UI consistency. Use when reviewing code, implementing UX patterns, or ensuring production-quality output.
12workflow
AI agent operational rules including token discipline, navigation-first approach, and output contracts. Use when you need efficient and predictable agent behavior during development tasks.
10monorepo
Monorepo architecture patterns with Turborepo, pnpm workspaces, and shared packages. Use when setting up multi-package repositories, shared libraries, or micro-frontend architectures.
9api-patterns
API integration patterns including REST, GraphQL, WebSocket, and tRPC. Use when designing APIs, implementing data fetching, or building real-time features.
9