skill-spec-ddd

Installation
SKILL.md

skill-spec-ddd

🎯 Phase 1: Requirements Elicitation (Discovery)

ROLE ACTIVATION: You are now operating as a Senior Stack Engineer with FANG-level expertise. Your mandate: Build systems that handle millions of requests, scale horizontally, and remain maintainable for years.

Step 1.1: Mandatory Discovery (Minimum 3)

INSTRUCTION: Before ANY analysis or solution, you MUST collect the following from the user. Ask clarifying questions until you have at least 3 items in EACH category.


πŸ“ SCOPE (Alcance - Es/En)

Define WHAT we are building. Boundaries of the system.

# Question (ES) Question (EN) Input
1 ΒΏCuΓ‘l es el objetivo principal del sistema? What is the primary goal of the system?
2 ΒΏQuΓ© funcionalidades estΓ‘n INCLUIDAS explΓ­citamente? What functionalities are EXPLICITLY INCLUDED?
3 ΒΏQuΓ© funcionalidades estΓ‘n EXCLUIDAS explΓ­citamente? What functionalities are EXPLICITLY EXCLUDED?
4 ΒΏCuΓ‘les son los lΓ­mites geogrΓ‘ficos/mercado objetivo? What are the geographic/market boundaries?
5 ΒΏQuΓ© integraciones externas son requeridas? What external integrations are required?

Minimum 3 scopes documented before proceeding.


πŸ“ ALCANCE TΓ‰CNICO / TECHNICAL SCOPE (Es/En)

Define the technical boundaries and constraints.

# Question (ES) Question (EN) Input
1 ΒΏCuΓ‘l es el volumen esperado de usuarios/transacciones? What is the expected user/transaction volume?
2 ΒΏCuΓ‘les son los requisitos de latencia/SLA? What are the latency/SLA requirements?
3 ΒΏHay restricciones tecnolΓ³gicas (stack obligatorio)? Are there mandatory technology stack constraints?
4 ΒΏCuΓ‘les son los requisitos de disponibilidad (uptime %)? What are the availability requirements (uptime %)?
5 ΒΏQuΓ© requisitos de compliance existen (GDPR, HIPAA, PCI)? What compliance requirements exist?
6 ΒΏCuΓ‘l es el presupuesto aproximado para infraestructura? What is the approximate infrastructure budget?

Minimum 3 technical scopes documented before proceeding.


😫 PUNTOS DE DOLOR / PAIN POINTS (Es/En)

Identify current or anticipated problems.

# Question (ES) Question (EN) Input
1 ΒΏQuΓ© problemas crΓ­ticos enfrenta actualmente el negocio? What critical business problems are currently faced?
2 ΒΏDΓ³nde se pierde mΓ‘s tiempo/recursos manualmente? Where is the most time/resources lost manually?
3 ΒΏQuΓ© errores recurrentes impactan operaciones/ingresos? What recurring errors impact operations/revenue?
4 ΒΏQuΓ© procesos no escalan con el crecimiento actual? What processes don't scale with current growth?
5 ΒΏCuΓ‘les son las quejas mΓ‘s frecuentes de usuarios/clientes? What are the most frequent user/customer complaints?
6 ΒΏQuΓ© competidores hacen mejor que ustedes actualmente? What do competitors do better than you currently?

Minimum 3 pain points documented before proceeding.


Step 1.2: Stakeholder Mapping

Map who cares about this system:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  STAKEHOLDER MAP                                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Primary Users:     [End users of the system]           β”‚
β”‚  Secondary Users:   [Internal staff, admins]          β”‚
β”‚  Decision Makers:   [Executives, product owners]      β”‚
β”‚  Blockers/Risks:    [Legal, compliance, security]      β”‚
β”‚  Integrators:       [External systems, partners]      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ Phase 1.3: User Stories Generation (Automated)

INSTRUCTION: After collecting requirements, IMMEDIATELY create user story specifications.

Automated Output

ALWAYS create the following structure after Phase 1:

File Naming Convention

spec-ddd/
β”œβ”€β”€ feat-001-discovery.yml          # Summary of discovery phase
β”œβ”€β”€ feat-002-scope-[name].yml       # Per scope item (min 3)
β”œβ”€β”€ feat-003-tech-[name].yml        # Per technical scope (min 3)
β”œβ”€β”€ feat-004-pain-[name].yml        # Per pain point (min 3)
└── feat-005-aggregate-[name].yml   # Per identified aggregate

Rules:

  • Use sequential numbering: feat-001, feat-002, etc.
  • Use kebab-case for descriptive names
  • Maximum 50 characters in filename

🌿 Git Naming Conventions

All user stories MUST include Git branch, commit, and PR naming conventions for traceability.

Branch Naming

Format:    <type>/feat-<XXX>-<short-description>

Examples:
  feat/feat-002-user-registration
  feat/feat-003-invoice-automation
  fix/feat-002-email-verification-bug
  refactor/feat-006-order-aggregate

Types:
  feat/     - New feature implementation
  fix/      - Bug fix related to a user story
  refactor/ - Code refactoring without behavior change
  test/     - Adding/updating tests for a user story
  docs/     - Documentation updates for a feature

Rules:

  • Always include the feature ID: feat-XXX
  • Keep description under 50 characters
  • Use kebab-case (hyphens between words)
  • No underscores, no camelCase in branch names

Commit Message Convention

Format:    <type>(feat-XXX): <description>

Examples:
  feat(feat-002): implement user registration aggregate
  feat(feat-002): add email verification service
  fix(feat-003): correct tax calculation for EU customers
  test(feat-002): add unit tests for User aggregate
  docs(feat-002): update API documentation

Types:
  feat(feat-XXX):     - New feature code
  fix(feat-XXX):      - Bug fix
  refactor(feat-XXX): - Code restructuring
  test(feat-XXX):     - Test addition/updates
  docs(feat-XXX):     - Documentation
  chore(feat-XXX):    - Maintenance, deps, etc.

Rules:

  • ALWAYS include feature ID in parentheses: (feat-XXX)
  • Use imperative mood: "add" not "added", "fix" not "fixed"
  • First letter lowercase
  • No period at the end
  • Maximum 72 characters in subject line

PR (Pull Request) Naming

Format:    <type>(feat-XXX): <Short Description>

Examples:
  feat(feat-002): User Registration with Email Verification
  feat(feat-003): Automated Invoice Generation from Orders
  fix(feat-002): Handle Duplicate Email Edge Case
  refactor(feat-006): Extract Payment Service from Order Aggregate

Template for PR Description:
  ## Related User Story
  Closes spec-ddd/feat-XXX.yml

  ## Changes
  - [List of changes]

  ## Acceptance Criteria Verified
  - [x] AC-01: [description]
  - [x] AC-02: [description]

  ## Testing
  - [How this was tested]

Full Traceability Example

User Story YAML: spec-ddd/feat-002-user-registration.yml
         β”‚
         β”œβ”€β”€ Branch:  feat/feat-002-user-registration
         β”‚            β”œβ”€β”€ Commit: feat(feat-002): implement User aggregate root
         β”‚            β”œβ”€β”€ Commit: feat(feat-002): add EmailVerification entity
         β”‚            β”œβ”€β”€ Commit: test(feat-002): add User aggregate unit tests
         β”‚            └── Commit: feat(feat-002): integrate with SendGrid email service
         β”‚
         β”œβ”€β”€ PR:      feat(feat-002): User Registration with Email Verification
         β”‚            └── Links to: spec-ddd/feat-002-user-registration.yml
         β”‚
         └── Merge:   Squash merge to main with PR title as commit
                      └── Commit on main: feat(feat-002): User Registration with Email Verification

Result: Full traceability from code commit β†’ PR β†’ User Story YAML β†’ Domain Context

Git Workflow Commands

# 1. Create branch from user story
git checkout -b feat/feat-002-user-registration

# 2. Make changes and commit with convention
git commit -m "feat(feat-002): implement User aggregate root"
git commit -m "test(feat-002): add unit tests for email verification"

# 3. Push and create PR
git push origin feat/feat-002-user-registration
# Create PR with title: feat(feat-002): User Registration with Email Verification
# Reference: spec-ddd/feat-002-user-registration.yml

# 4. After merge, update user story status
git checkout main
git pull origin main

Validation Checklist for Git Naming

  • Branch starts with type: feat/, fix/, refactor/, etc.
  • Branch includes feature ID: feat-XXX
  • Branch uses kebab-case, no underscores
  • Branch name under 50 characters
  • Commits include feature ID in parentheses: (feat-XXX)
  • Commit messages use imperative mood
  • Commit subject under 72 characters
  • PR title includes feature ID: (feat-XXX)
  • PR description links to YAML file: spec-ddd/feat-XXX.yml
  • PR includes acceptance criteria checklist

User Story YAML Schema

Each .yml file MUST follow this structure:

# spec-ddd/feat-XXX-name.yml
story:
  id: "feat-XXX"                    # Sequential ID
  type: "discovery|scope|technical|pain|aggregate|use-case"
  status: "draft|refined|ready|done"
  
  # User Story Statement
  as_a: "[role]"                    # Who
  i_want: "[goal/action]"         # What
  so_that: "[benefit/value]"      # Why
  
  # Dual Language
  description:
    es: "DescripciΓ³n en espaΓ±ol"
    en: "Description in English"
  
  # DDD Context
  domain:
    bounded_context: "[ContextName]"
    aggregate: "[AggregateName]"
    entities: ["Entity1", "Entity2"]
    value_objects: ["ValueObject1"]
    domain_events: ["Event1Occurred", "Event2Completed"]
  
  # Acceptance Criteria
  acceptance_criteria:
    - id: "ac-01"
      given: "[precondition]"
      when: "[action]"
      then: "[expected result]"
      es:
        dado: "[precondiciΓ³n]"
        cuando: "[acciΓ³n]"
        entonces: "[resultado esperado]"
    
  # Technical Scope
  technical:
    complexity: "low|medium|high|critical"
    effort_hours: "[estimated hours]"
    impact: "low|medium|high"
    risks:
      - id: "risk-01"
        description: "Risk description"
        mitigation: "How to mitigate"
    
  # Business Value
  business:
    priority: "P0|P1|P2|P3"
    kpis_impacted:
      - "[KPI name]"
    revenue_impact: "[estimate]"
    cost_savings: "[estimate]"
    
  # Dependencies
  dependencies:
    stories: ["feat-001", "feat-002"]  # IDs of dependent stories
    systems: ["External API", "Database"]
    teams: ["Team A", "Team B"]
  
  # Notes
  notes:
    - "[Additional context]"
    
  # Git / Version Control
  git:
    branch_name: "feat/feat-XXX-short-description"  # Branch naming convention
    commit_prefix: "feat(feat-XXX):"                  # Commit message prefix
    pr_title: "feat(feat-XXX): Short description"   # PR title format
    related_commits: []                              # Auto-populated during dev
  
  # Metadata
  metadata:
    created_at: "YYYY-MM-DD"
    updated_at: "YYYY-MM-DD"
    author: "[name]"
    source: "discovery|stakeholder|analysis"

Example User Story Files

Example 1: Discovery Summary

# spec-ddd/feat-001-discovery.yml
story:
  id: "feat-001"
  type: "discovery"
  status: "done"
  
  as_a: "System Architect"
  i_want: "Document all discovery findings"
  so_that: "We have a clear baseline for design decisions"
  
  description:
    es: "Resumen de la fase de descubrimiento con 3+ scopes, alcances tΓ©cnicos y puntos de dolor identificados"
    en: "Summary of discovery phase with 3+ scopes, technical scopes and pain points identified"
  
  domain:
    bounded_context: "N/A - Discovery Phase"
  
  acceptance_criteria:
    - id: "ac-01"
      given: "Discovery phase completed"
      when: "All stakeholders interviewed"
      then: "Minimum 3 scopes documented"
      es:
        dado: "Fase de descubrimiento completada"
        cuando: "Todos los stakeholders entrevistados"
        entonces: "MΓ­nimo 3 scopes documentados"
  
  metadata:
    created_at: "2024-01-15"
    author: "System"
    source: "discovery"

Example 2: Scope Item

# spec-ddd/feat-002-user-registration.yml
story:
  id: "feat-002"
  type: "scope"
  status: "refined"
  
  as_a: "New Customer"
  i_want: "Register for an account with email verification"
  so_that: "I can securely access the platform features"
  
  description:
    es: "Sistema de registro de usuarios con verificaciΓ³n por email, validaciΓ³n de datos y prevenciΓ³n de duplicados"
    en: "User registration system with email verification, data validation and duplicate prevention"
  
  domain:
    bounded_context: "IdentityManagement"
    aggregate: "User"
    entities: ["User", "EmailVerification"]
    value_objects: ["Email", "Password", "VerificationToken"]
    domain_events: ["UserRegistered", "EmailVerificationSent", "EmailVerified"]
  
  acceptance_criteria:
    - id: "ac-01"
      given: "Valid email and password provided"
      when: "User submits registration form"
      then: "Account is created and verification email sent"
      es:
        dado: "Email y contraseΓ±a vΓ‘lidos proporcionados"
        cuando: "Usuario envΓ­a formulario de registro"
        entonces: "Cuenta creada y email de verificaciΓ³n enviado"
    
    - id: "ac-02"
      given: "Email already exists in system"
      when: "User attempts registration"
      then: "System shows error without revealing existing account"
      es:
        dado: "Email ya existe en el sistema"
        cuando: "Usuario intenta registrarse"
        entonces: "Sistema muestra error sin revelar cuenta existente"
  
  technical:
    complexity: "medium"
    effort_hours: "24"
    impact: "high"
    risks:
      - id: "risk-01"
        description: "Email delivery failures"
        mitigation: "Implement retry logic and fallback SMS"
  
  business:
    priority: "P0"
    kpis_impacted: ["User Acquisition", "Activation Rate"]
    revenue_impact: "High - entry point for all users"
  
  dependencies:
    stories: ["feat-001"]
    systems: ["Email Service", "Database"]
  
  metadata:
    created_at: "2024-01-15"
    updated_at: "2024-01-15"
    author: "System"
    source: "discovery"

Example 3: Pain Point

# spec-ddd/feat-004-manual-invoicing.yml
story:
  id: "feat-004"
  type: "pain"
  status: "draft"
  
  as_a: "Finance Team Member"
  i_want: "Automated invoice generation from completed orders"
  so_that: "I can eliminate manual data entry errors and reduce processing time by 80%"
  
  description:
    es: "AutomatizaciΓ³n de facturaciΓ³n para eliminar procesos manuales que causan errores y retrasos"
    en: "Invoice automation to eliminate manual processes causing errors and delays"
  
  domain:
    bounded_context: "Billing"
    aggregate: "Invoice"
    entities: ["Invoice", "InvoiceLine"]
    value_objects: ["Money", "TaxRate", "InvoiceNumber"]
    domain_events: ["InvoiceGenerated", "InvoiceSent", "PaymentReceived"]
  
  acceptance_criteria:
    - id: "ac-01"
      given: "Order status changes to completed"
      when: "End of day batch runs"
      then: "Invoice is automatically generated and queued for sending"
      es:
        dado: "Estado de orden cambia a completado"
        cuando: "Batch de fin de dΓ­a ejecuta"
        entonces: "Factura generada automΓ‘ticamente y en cola de envΓ­o"
  
  business:
    priority: "P1"
    kpis_impacted: ["Processing Time", "Error Rate", "Cash Flow"]
    cost_savings: "$50K/year in manual labor"
  
  metadata:
    created_at: "2024-01-15"
    author: "System"
    source: "discovery"

🧠 Phase 2: Dual-Language Analysis (Es/En)

ROLE: Senior Systems Architect analyzing requirements for FANG-scale implementation.

Step 2.1: Scope Analysis Matrix

For EACH scope item collected, produce analysis in BOTH languages:

Template for each scope item:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  SCOPE ITEM #[N]: [Title]                                                  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                            β”‚
β”‚  πŸ‡ͺπŸ‡Έ ANÁLISIS (ES):                                                        β”‚
β”‚  ─────────────────                                                         β”‚
β”‚  β€’ Impacto en dominio: [ΒΏQuΓ© bounded contexts afecta?]                     β”‚
β”‚  β€’ Complejidad tΓ©cnica: [Baja/Media/Alta/CrΓ­tica]                          β”‚
β”‚  β€’ Riesgos identificados: [Lista de riesgos]                              β”‚
β”‚  β€’ Suposiciones clave: [Assumptions made]                                 β”‚
β”‚  β€’ MΓ©tricas de Γ©xito: [CΓ³mo medimos el cumplimiento]                      β”‚
β”‚                                                                            β”‚
β”‚  πŸ‡ΊπŸ‡Έ ANALYSIS (EN):                                                        β”‚
β”‚  ─────────────────                                                         β”‚
β”‚  β€’ Domain Impact: [Which bounded contexts are affected?]                   β”‚
β”‚  β€’ Technical Complexity: [Low/Medium/High/Critical]                      β”‚
β”‚  β€’ Identified Risks: [List of risks]                                       β”‚
β”‚  β€’ Key Assumptions: [Assumptions made]                                     β”‚
β”‚  β€’ Success Metrics: [How we measure fulfillment]                          β”‚
β”‚                                                                            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Step 2.2: Technical Scope Analysis Matrix

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  TECHNICAL ITEM #[N]: [Title]                                             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                            β”‚
β”‚  πŸ‡ͺπŸ‡Έ ANÁLISIS TΓ‰CNICO (ES):                                                β”‚
β”‚  ─────────────────────────                                                 β”‚
β”‚  β€’ Arquitectura recomendada: [Monolito modular/Microservicios/HΓ­brido]    β”‚
β”‚  β€’ Patrones aplicables: [CQRS, Event Sourcing, Saga, etc.]              β”‚
β”‚  β€’ Estrategia de escalado: [Vertical/Horizontal/Auto-scaling]             β”‚
β”‚  β€’ Trade-offs: [Compromisos aceptados]                                    β”‚
β”‚  β€’ Costo estimado: [Back-of-envelope calculation]                         β”‚
β”‚                                                                            β”‚
β”‚  πŸ‡ΊπŸ‡Έ TECHNICAL ANALYSIS (EN):                                             β”‚
β”‚  ─────────────────────────                                                 β”‚
β”‚  β€’ Recommended Architecture: [Modular monolith/Microservices/Hybrid]      β”‚
β”‚  β€’ Applicable Patterns: [CQRS, Event Sourcing, Saga, etc.]               β”‚
β”‚  β€’ Scaling Strategy: [Vertical/Horizontal/Auto-scaling]                 β”‚
β”‚  β€’ Trade-offs: [Accepted compromises]                                    β”‚
β”‚  β€’ Estimated Cost: [Back-of-envelope calculation]                         β”‚
β”‚                                                                            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Step 2.3: Pain Point Analysis Matrix

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  PAIN POINT #[N]: [Title]                                                 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                            β”‚
β”‚  πŸ‡ͺπŸ‡Έ ANÁLISIS DE DOLOR (ES):                                               β”‚
β”‚  ──────────────────────────                                                β”‚
β”‚  β€’ Severidad: [CrΓ­tica/Alta/Media/Baja]                                   β”‚
β”‚  β€’ Frecuencia: [Constante/Frecuente/Ocasional/Rara]                       β”‚
β”‚  β€’ Impacto financiero: [EstimaciΓ³n de pΓ©rdida/costo]                    β”‚
β”‚  β€’ Dominio afectado: [Bounded context relacionado]                      β”‚
β”‚  β€’ SoluciΓ³n DDD propuesta: [Aggregate/Entity/Service que resuelve]        β”‚
β”‚  β€’ Prioridad: [P0 (bloqueante) / P1 (alta) / P2 (media) / P3 (baja)]   β”‚
β”‚                                                                            β”‚
β”‚  πŸ‡ΊπŸ‡Έ PAIN POINT ANALYSIS (EN):                                            β”‚
β”‚  ──────────────────────────                                                β”‚
β”‚  β€’ Severity: [Critical/High/Medium/Low]                                   β”‚
β”‚  β€’ Frequency: [Constant/Frequent/Occasional/Rare]                         β”‚
β”‚  β€’ Financial Impact: [Estimated loss/cost]                              β”‚
β”‚  β€’ Affected Domain: [Related bounded context]                             β”‚
β”‚  β€’ Proposed DDD Solution: [Aggregate/Entity/Service that solves]          β”‚
β”‚  β€’ Priority: [P0 (blocking) / P1 (high) / P2 (medium) / P3 (low)]         β”‚
β”‚                                                                            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”¨ Phase 3: Problem Decomposition (Stack Engineer FANG Approach)

PRINCIPLE: "Divide and conquer. A problem well-defined is a problem half-solved."

Step 3.1: The FANG Problem Splitting Framework

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  πŸ”₯ FANG PROBLEM DECOMPOSITION                                               β”‚
β”‚                                                                              β”‚
β”‚  "How would Amazon handle this? How would Netflix scale this?"              β”‚
β”‚                                                                              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                              β”‚
β”‚  LAYER 1: STRATEGIC DECOMPOSITION (The "Why")                               β”‚
β”‚  ────────────────────────────────────────────                               β”‚
β”‚                                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  BUSINESS CAPABILITY MAPPING                                        β”‚   β”‚
β”‚  β”‚                                                                     β”‚   β”‚
β”‚  β”‚  [Capability 1] ───────┐                                            β”‚   β”‚
β”‚  β”‚  [Capability 2] ──────┼───> Core Domain                            β”‚   β”‚
β”‚  β”‚  [Capability 3] β”€β”€β”€β”€β”€β”€β”˜                                            β”‚   β”‚
β”‚  β”‚                                                                     β”‚   β”‚
β”‚  β”‚  [Capability 4] ───────┐                                            β”‚   β”‚
β”‚  β”‚  [Capability 5] ──────┼───> Supporting Domain                      β”‚   β”‚
β”‚  β”‚  [Capability 6] β”€β”€β”€β”€β”€β”€β”˜                                            β”‚   β”‚
β”‚  β”‚                                                                     β”‚   β”‚
β”‚  β”‚  [Capability 7] ───────┐                                            β”‚   β”‚
β”‚  β”‚  [Capability 8] ──────┼───> Generic Domain                         β”‚   β”‚
β”‚  β”‚  [Capability 9] β”€β”€β”€β”€β”€β”€β”˜                                            β”‚   β”‚
β”‚  β”‚                                                                     β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                                                                              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                              β”‚
β”‚  LAYER 2: TACTICAL DECOMPOSITION (The "What")                              β”‚
β”‚  ───────────────────────────────────────────                               β”‚
β”‚                                                                              β”‚
β”‚  For EACH Business Capability, decompose into:                              β”‚
β”‚                                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  BOUNDED CONTEXT IDENTIFICATION                                     β”‚   β”‚
β”‚  β”‚                                                                     β”‚   β”‚
β”‚  β”‚  Context: [Name]                                                    β”‚   β”‚
β”‚  β”‚  β”œβ”€β”€ Ubiquitous Language: [Domain-specific terms]                  β”‚   β”‚
β”‚  β”‚  β”œβ”€β”€ Aggregates: [Large consistency boundaries]                     β”‚   β”‚
β”‚  β”‚  β”œβ”€β”€ Entities: [Objects with identity]                             β”‚   β”‚
β”‚  β”‚  β”œβ”€β”€ Value Objects: [Immutable descriptors]                        β”‚   β”‚
β”‚  β”‚  β”œβ”€β”€ Domain Events: [Significant occurrences]                      β”‚   β”‚
β”‚  β”‚  └── Domain Services: [Operations not belonging to entities]       β”‚   β”‚
β”‚  β”‚                                                                     β”‚   β”‚
β”‚  β”‚  Integration Patterns: [API/Events/Shared Kernel]                  β”‚   β”‚
β”‚  β”‚  Team Ownership: [Which team owns this]                             β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                                                                              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                              β”‚
β”‚  LAYER 3: IMPLEMENTATION DECOMPOSITION (The "How")                          β”‚
β”‚  ────────────────────────────────────────────────                           β”‚
β”‚                                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  SUBDOMAIN ARCHITECTURE                                             β”‚   β”‚
β”‚  β”‚                                                                     β”‚   β”‚
β”‚  β”‚  [Subdomain A]                                                      β”‚   β”‚
β”‚  β”‚  β”œβ”€β”€ Module: [feature-module]                                       β”‚   β”‚
β”‚  β”‚  β”‚   β”œβ”€β”€ Application Layer                                         β”‚   β”‚
β”‚  β”‚  β”‚   β”‚   β”œβ”€β”€ Use Cases/Commands                                     β”‚   β”‚
β”‚  β”‚  β”‚   β”‚   β”œβ”€β”€ Queries (if CQRS)                                      β”‚   β”‚
β”‚  β”‚  β”‚   β”‚   └── DTOs                                                   β”‚   β”‚
β”‚  β”‚  β”‚   β”œβ”€β”€ Domain Layer                                               β”‚   β”‚
β”‚  β”‚  β”‚   β”‚   β”œβ”€β”€ Aggregates                                            β”‚   β”‚
β”‚  β”‚  β”‚   β”‚   β”œβ”€β”€ Entities                                              β”‚   β”‚
β”‚  β”‚  β”‚   β”‚   β”œβ”€β”€ Value Objects                                          β”‚   β”‚
β”‚  β”‚  β”‚   β”‚   β”œβ”€β”€ Domain Events                                          β”‚   β”‚
β”‚  β”‚  β”‚   β”‚   β”œβ”€β”€ Repositories (interfaces)                              β”‚   β”‚
β”‚  β”‚  β”‚   β”‚   └── Domain Services                                        β”‚   β”‚
β”‚  β”‚  β”‚   └── Infrastructure Layer                                       β”‚   β”‚
β”‚  β”‚  β”‚       β”œβ”€β”€ Repository Implementations                             β”‚   β”‚
β”‚  β”‚  β”‚       β”œβ”€β”€ External Services Clients                              β”‚   β”‚
β”‚  β”‚  β”‚       β”œβ”€β”€ Event Publishers/Subscribers                           β”‚   β”‚
β”‚  β”‚  β”‚       └── Persistence Mappers                                    β”‚   β”‚
β”‚  β”‚  └── Interface Layer                                                β”‚   β”‚
β”‚  β”‚      β”œβ”€β”€ Controllers/Handlers                                       β”‚   β”‚
β”‚  β”‚      β”œβ”€β”€ Presenters/ViewModels                                      β”‚   β”‚
β”‚  β”‚      └── Input Validators                                           β”‚   β”‚
β”‚  β”‚                                                                     β”‚   β”‚
β”‚  β”‚  [Subdomain B] ...                                                 β”‚   β”‚
β”‚  β”‚  [Subdomain C] ...                                                 β”‚   β”‚
β”‚  β”‚                                                                     β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Step 3.2: Dependency Analysis

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  DEPENDENCY GRAPH (Context Map)                                             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                              β”‚
β”‚     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         Customer/Supplier         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”‚
β”‚     β”‚ Context A │◄──────────────────────────────────►│ Context B β”‚         β”‚
β”‚     β”‚  (Upstream)β”‚                                    β”‚ (Downstream)β”‚       β”‚
β”‚     β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜                                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚
β”‚           β”‚                                                                  β”‚
β”‚           β”‚ Published Language                                               β”‚
β”‚           β–Ό                                                                  β”‚
β”‚     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         Shared Kernel          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”‚
β”‚     β”‚ Context C │◄═══════════════════════════════►│ Context D β”‚              β”‚
β”‚     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚
β”‚                                                                              β”‚
β”‚     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         Anti-Corruption Layer    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”            β”‚
β”‚     β”‚ Legacy E │◄────────────[ACL]─────────────────│ Context F β”‚            β”‚
β”‚     β”‚  System   β”‚                                  β”‚  (New)    β”‚            β”‚
β”‚     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜            β”‚
β”‚                                                                              β”‚
β”‚     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         Open Host Service        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”            β”‚
β”‚     β”‚ Context G │◄───────────[OHS]────────────────│ Context H β”‚            β”‚
β”‚     β”‚  (Generic)β”‚         (Standard Protocol)      β”‚ (Consumer)β”‚            β”‚
β”‚     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜            β”‚
β”‚                                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Step 3.3: Event Storming Summary

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  DOMAIN EVENT CHAIN (Chronological)                                       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                              β”‚
β”‚  Actor          Command              Aggregate          Event              β”‚
β”‚  ─────────────────────────────────────────────────────────────────────────  β”‚
β”‚  [User]    ──> [Action]   ──> [Entity]   ──> [DomainEvent]                 β”‚
β”‚                                                                              β”‚
β”‚  Timeline:                                                                  β”‚
β”‚                                                                              β”‚
β”‚  Time ─────────────────────────────────────────────────────────────►      β”‚
β”‚                                                                              β”‚
β”‚  [Event 1] ──► [Event 2] ──► [Event 3] ──► [Event 4] ──► [Event 5]          β”‚
β”‚     β”‚            β”‚            β”‚            β”‚            β”‚                    β”‚
β”‚     β–Ό            β–Ό            β–Ό            β–Ό            β–Ό                    β”‚
β”‚  Policy 1    Policy 2    External      Read      External                 β”‚
β”‚  Trigger     Trigger     System        Model       System                  β”‚
β”‚                          Update        Update      Notification             β”‚
β”‚                                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ—οΈ Phase 4: Architecture Decision Records (ADRs)

FANG Principle: "Decisions must be documented, reversible, and evidence-based."

ADR Template (Mandatory for each major decision)

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  ADR #[NNN]: [Title]                                                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                              β”‚
β”‚  Status: [PROPOSED | ACCEPTED | DEPRECATED | SUPERSEDED]                   β”‚
β”‚  Date: [YYYY-MM-DD]                                                         β”‚
β”‚  Deciders: [Names/Teams]                                                    β”‚
β”‚                                                                              β”‚
β”‚  ─────────────────────────────────────────────────────────────────────────  β”‚
β”‚                                                                              β”‚
β”‚  CONTEXT (The problem we're solving)                                        β”‚
β”‚  ────────                                                                   β”‚
β”‚  [What is the issue that we're seeing that is motivating this decision?]   β”‚
β”‚                                                                              β”‚
β”‚  DECISION (What we're doing)                                                β”‚
β”‚  ──────────                                                                 β”‚
β”‚  [What is the change that we're proposing or have agreed to implement?]    β”‚
β”‚                                                                              β”‚
β”‚  CONSEQUENCES (What happens as a result)                                    β”‚
β”‚  ────────────                                                               β”‚
β”‚  β€’ Positive: [Benefits]                                                      β”‚
β”‚  β€’ Negative: [Trade-offs and costs]                                        β”‚
β”‚  β€’ Neutral: [Other effects]                                                  β”‚
β”‚                                                                              β”‚
β”‚  ALTERNATIVES CONSIDERED (Why not X?)                                       β”‚
β”‚  ──────────────────────────                                                 β”‚
β”‚  β€’ [Alternative 1]: [Why rejected]                                          β”‚
β”‚  β€’ [Alternative 2]: [Why rejected]                                          β”‚
β”‚                                                                              β”‚
β”‚  EVIDENCE (Data backing this decision)                                      β”‚
β”‚  ────────                                                                   β”‚
β”‚  β€’ [Load testing results]                                                   β”‚
β”‚  β€’ [Proof of concept outcome]                                               β”‚
β”‚  β€’ [Industry benchmarks]                                                    β”‚
β”‚                                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Required ADRs for DDD Projects

# ADR Topic Trigger Condition
001 Architecture Style (Monolith vs Microservices) Always required
002 Data Persistence Strategy If database involved
003 Communication Patterns (Sync vs Async) If multiple contexts
004 Event Sourcing vs State Storage If domain events critical
005 CQRS Implementation If read/write patterns differ
006 API Style (REST vs GraphQL vs gRPC) If external API exposed
007 Authentication/Authorization Strategy Always required
008 Testing Strategy Always required

πŸ“‹ Phase 5: Implementation Checklist (FANG Standards)

Pre-Implementation Verification

β–‘ Discovery Phase Complete
  β–‘ Minimum 3 scopes documented
  β–‘ Minimum 3 technical scopes documented  
  β–‘ Minimum 3 pain points documented
  β–‘ Stakeholder map created
  β–‘ User Story YAML files created in spec-ddd/

β–‘ Analysis Phase Complete
  β–‘ All scopes analyzed (ES/EN)
  β–‘ All technical scopes analyzed (ES/EN)
  β–‘ All pain points analyzed (ES/EN)
  β–‘ User stories refined with acceptance criteria

β–‘ Decomposition Phase Complete
  β–‘ Business capabilities mapped
  β–‘ Bounded contexts identified
  β–‘ Ubiquitous language defined per context
  β–‘ Aggregates designed
  β–‘ Domain events catalogued
  β–‘ Context map drawn
  β–‘ User stories mapped to aggregates

β–‘ Architecture Phase Complete
  β–‘ ADRs written for major decisions
  β–‘ Technology stack selected
  β–‘ Infrastructure requirements defined
  β–‘ Security model designed
  β–‘ Observability strategy defined (logs/metrics/traces)

β–‘ Planning Phase Complete
  β–‘ Milestones defined
  β–‘ MVP scope identified
  β–‘ Risk mitigation plans documented
  β–‘ Rollback strategy defined
  β–‘ User stories prioritized (P0-P3)

🎯 Quick Reference: DDD Tactics

Aggregate Rules (Non-Negotiable)

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  AGGREGATE DESIGN PRINCIPLES                                                β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                              β”‚
β”‚  1. TRANSACTION BOUNDARY                                                     β”‚
β”‚     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                                      β”‚
β”‚     β”‚   AGGREGATE     β”‚  One transaction = One aggregate save               β”‚
β”‚     β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚                                                      β”‚
β”‚     β”‚  β”‚  Root     β”‚  β”‚  Root Entity: Has global identity                  β”‚
β”‚     β”‚  β”‚  Entity   β”‚  β”‚                                                      β”‚
β”‚     β”‚  β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β”‚  Invariants enforced across entire boundary       β”‚
β”‚     β”‚  β”Œβ”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”  β”‚                                                      β”‚
β”‚     β”‚  β”‚ Entities  β”‚  β”‚  Child Entities: Local identity only             β”‚
β”‚     β”‚  β”‚  (1..*)   β”‚  β”‚                                                      β”‚
β”‚     β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚  Value Objects: Immutable, replace not modify       β”‚
β”‚     β”‚  β”‚ Value Obj β”‚  β”‚                                                      β”‚
β”‚     β”‚  β”‚  (0..*)   β”‚  β”‚                                                      β”‚
β”‚     β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚                                                      β”‚
β”‚     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                                      β”‚
β”‚                                                                              β”‚
β”‚  2. REFERENCE RULE                                                           β”‚
β”‚     β€’ Inside aggregate: Reference by object                                   β”‚
β”‚     β€’ Outside aggregate: Reference by ID only                               β”‚
β”‚                                                                              β”‚
β”‚  3. DELETE RULE                                                              β”‚
β”‚     β€’ Delete aggregate = Delete everything inside                           β”‚
β”‚     β€’ Orphaned entities should not exist                                    β”‚
β”‚                                                                              β”‚
β”‚  4. SIZE RULE                                                                β”‚
β”‚     β€’ Small aggregates: Better performance, less contention                 β”‚
β”‚     β€’ Large aggregates: More consistency, more locking                      β”‚
β”‚     β€’ "FANG Rule": Start small, expand only when data proves need          β”‚
β”‚                                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Domain Event Best Practices

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  DOMAIN EVENT GUIDELINES                                                    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                              β”‚
β”‚  NAMING: [Entity][Action]Occurred / [Entity][Action]Completed             β”‚
β”‚                                                                              β”‚
β”‚  β€’ OrderPlaced                                                              β”‚
β”‚  β€’ PaymentReceived                                                          β”‚
β”‚  β€’ InventoryReserved                                                        β”‚
β”‚  β€’ ShipmentDispatched                                                       β”‚
β”‚                                                                              β”‚
β”‚  CONTENT:                                                                   β”‚
β”‚  β€’ Event ID (UUID)                                                          β”‚
β”‚  β€’ Aggregate ID                                                             β”‚
β”‚  β€’ Timestamp (UTC)                                                          β”‚
β”‚  β€’ Version/Schema version                                                   β”‚
β”‚  β€’ Payload (minimal, event-specific data)                                   β”‚
β”‚  β€’ Correlation ID (for distributed tracing)                                 β”‚
β”‚                                                                              β”‚
β”‚  FANG PRINCIPLES:                                                           β”‚
β”‚  β€’ Events are facts - immutable and append-only                             β”‚
β”‚  β€’ Event schema evolution: Additive only (never delete fields)              β”‚
β”‚  β€’ Include just enough data - consumers shouldn't query for context         β”‚
β”‚  β€’ Idempotency keys for all handlers                                        β”‚
β”‚                                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Phase 6: Execution Framework

Sprint 0: Foundation

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  SPRINT 0: ARCHITECTURE FOUNDATION (Weeks 1-2)                              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                              β”‚
β”‚  Week 1: Setup & Discovery                                                   β”‚
β”‚  β”œβ”€β”€ Day 1-2: Stakeholder interviews (collect 3+ scopes/pains/tech)        β”‚
β”‚  β”œβ”€β”€ Day 3-4: Event Storming workshop                                       β”‚
β”‚  β”œβ”€β”€ Day 5: Domain analysis documentation                                   β”‚
β”‚  └── Deliverable: User Story YAML files (spec-ddd/feat-*.yml)               β”‚
β”‚                                                                              β”‚
β”‚  Week 2: Design & Planning                                                   β”‚
β”‚  β”œβ”€β”€ Day 1-2: Bounded context identification                              β”‚
β”‚  β”œβ”€β”€ Day 3: Context mapping & integration design                            β”‚
β”‚  β”œβ”€β”€ Day 4: ADR writing (Architecture Decision Records)                     β”‚
β”‚  └── Day 5: Technical setup (CI/CD, repo structure, base libs)            β”‚
β”‚                                                                              β”‚
β”‚  Deliverables:                                                               β”‚
β”‚  β–‘ Discovery document (ES/EN analysis complete)                            β”‚
β”‚  β–‘ User Story YAML files in spec-ddd/                                       β”‚
β”‚  β–‘ Event storming board                                                    β”‚
β”‚  β–‘ Context map diagram                                                       β”‚
β”‚  β–‘ ADR documents (minimum 3)                                               β”‚
β”‚  β–‘ Repository structure with working CI/CD                                 β”‚
β”‚                                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Development Sprints

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  PER-SPRINT DELIVERABLES                                                    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                              β”‚
β”‚  Each sprint delivers ONE complete vertical slice:                          β”‚
β”‚                                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚
β”‚  β”‚  VERTICAL SLICE PATTERN                                             β”‚     β”‚
β”‚  β”‚                                                                     β”‚     β”‚
β”‚  β”‚  Feature: [User Story from spec-ddd/]                               β”‚     β”‚
β”‚  β”‚                                                                     β”‚     β”‚
β”‚  β”‚  UI/CLI ──► Controller ──► Use Case ──► Domain ──► Repository    β”‚     β”‚
β”‚  β”‚     β”‚         β”‚           β”‚           β”‚           β”‚                 β”‚     β”‚
β”‚  β”‚     β”‚         β”‚           β”‚           β”‚           β–Ό                 β”‚     β”‚
β”‚  β”‚     β”‚         β”‚           β”‚           β”‚        Database             β”‚     β”‚
β”‚  β”‚     β”‚         β”‚           β”‚           β”‚                             β”‚     β”‚
β”‚  β”‚     β”‚         β”‚           β”‚           β–Ό                             β”‚     β”‚
β”‚  β”‚     β”‚         β”‚           β”‚      Domain Events ──► Event Bus       β”‚     β”‚
β”‚  β”‚     β”‚         β”‚           β”‚                             β”‚          β”‚     β”‚
β”‚  β”‚     β”‚         β”‚           β”‚                             β–Ό          β”‚     β”‚
β”‚  β”‚     β”‚         β”‚           β”‚                        Event Handlers   β”‚     β”‚
β”‚  β”‚     β”‚         β”‚           β”‚                             β”‚          β”‚     β”‚
β”‚  β”‚     β”‚         β”‚           β–Ό                             β–Ό          β”‚     β”‚
β”‚  β”‚     β”‚         β–Ό      Integration                    External      β”‚     β”‚
β”‚  β”‚     β–Ό    Tests/Contract    Tests                    Systems         β”‚     β”‚
β”‚  β”‚  E2E Tests                                                     β—„β”€β”€β”€β”€β”˜     β”‚
β”‚  β”‚                                                                     β”‚     β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚
β”‚                                                                              β”‚
β”‚  Definition of Done:                                                         β”‚
β”‚  β–‘ User Story completed per YAML specification                               β”‚
β”‚  β–‘ Acceptance criteria verified                                              β”‚
β”‚  β–‘ Unit tests (domain logic) - 80%+ coverage                               β”‚
β”‚  β–‘ Integration tests (repositories, external services)                       β”‚
β”‚  β–‘ API contract tests (OpenAPI/gRPC spec)                                    β”‚
β”‚  β–‘ Observability (metrics, logs, traces)                                    β”‚
β”‚  β–‘ Documentation updated                                                     β”‚
β”‚                                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“Š Phase 7: Observability & Monitoring (FANG Grade)

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  THE THREE PILLARS OF OBSERVABILITY                                         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                              β”‚
β”‚  1. METRICS (The "What")                                                    β”‚
β”‚  ─────────────────────                                                       β”‚
β”‚                                                                              β”‚
β”‚  Business Metrics:                                                           β”‚
β”‚  β€’ Orders per minute                                                         β”‚
β”‚  β€’ Revenue per hour                                                          β”‚
β”‚  β€’ Conversion rate                                                           β”‚
β”‚                                                                              β”‚
β”‚  Domain Metrics:                                                             β”‚
β”‚  β€’ Aggregate creation rate                                                   β”‚
β”‚  β€’ Domain event frequency by type                                            β”‚
β”‚  β€’ Command handling time                                                       β”‚
β”‚                                                                              β”‚
β”‚  Technical Metrics:                                                          β”‚
β”‚  β€’ Request rate, latency (p50, p95, p99), error rate                         β”‚
β”‚  β€’ DB connection pool utilization                                            β”‚
β”‚  β€’ Queue depth                                                               β”‚
β”‚                                                                              β”‚
β”‚  2. LOGS (The "Why")                                                        β”‚
β”‚  ──────────────────                                                          β”‚
β”‚                                                                              β”‚
β”‚  Structured JSON logging with:                                               β”‚
β”‚  β€’ trace_id (distributed request tracking)                                   β”‚
β”‚  β€’ span_id (operation within request)                                        β”‚
β”‚  β€’ aggregate_id (DDD-specific tracking)                                      β”‚
β”‚  β€’ correlation_id (business process tracking)                                β”‚
β”‚  β€’ story_id (links to spec-ddd/ user story)                                 β”‚
β”‚                                                                              β”‚
β”‚  Log Levels:                                                                 β”‚
β”‚  β€’ ERROR: Aggregates in invalid state, invariant violations                  β”‚
β”‚  β€’ WARN: Retryable failures, deprecated API usage                            β”‚
β”‚  β€’ INFO: Domain events published, significant state changes                  β”‚
β”‚  β€’ DEBUG: Command handling details, query execution                            β”‚
β”‚                                                                              β”‚
β”‚  3. TRACES (The "Where")                                                    β”‚
β”‚  ─────────────────────                                                       β”‚
β”‚                                                                              β”‚
β”‚  Distributed tracing across:                                                 β”‚
β”‚  β€’ API Gateway β†’ Controller β†’ Use Case β†’ Domain β†’ Repository β†’ DB            β”‚
β”‚  β€’ Event Publisher β†’ Message Bus β†’ Event Handler β†’ Downstream Actions        β”‚
β”‚                                                                              β”‚
β”‚  Critical Spans:                                                             β”‚
β”‚  β€’ Aggregate load/save                                                       β”‚
β”‚  β€’ Domain event processing                                                   β”‚
β”‚  β€’ External service calls                                                    β”‚
β”‚  β€’ User story execution (from spec-ddd/)                                    β”‚
β”‚                                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸŽ“ DDD Pattern Library

Strategic Patterns

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  STRATEGIC PATTERNS QUICK REFERENCE                                         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                              β”‚
β”‚  PATTERN              β”‚ USE WHEN                              β”‚ EXAMPLE     β”‚
β”‚  ─────────────────────┼───────────────────────────────────────┼────────────│
β”‚  BOUNDED CONTEXT      β”‚ Clear linguistic boundaries exist     β”‚ Catalog vs  β”‚
β”‚                       β”‚                                       β”‚ Inventory   β”‚
β”‚  ─────────────────────┼───────────────────────────────────────┼────────────│
β”‚  CONTEXT MAP          β”‚ Multiple contexts interact            β”‚ Sales ↔     β”‚
β”‚                       β”‚                                       β”‚ Shipping    β”‚
β”‚  ─────────────────────┼───────────────────────────────────────┼────────────│
β”‚  SHARED KERNEL        β”‚ Teams collaborate closely             β”‚ Common      β”‚
β”‚                       β”‚                                       β”‚ types lib   β”‚
β”‚  ─────────────────────┼───────────────────────────────────────┼────────────│
β”‚  CUSTOMER/SUPPLIER    β”‚ Clear upstream/downstream             β”‚ Pricing API β”‚
β”‚                       β”‚                                       β”‚ (upstream)  β”‚
β”‚  ─────────────────────┼───────────────────────────────────────┼────────────│
β”‚  CONFORMIST           β”‚ Can't influence upstream                β”‚ Using       β”‚
β”‚                       β”‚                                       β”‚ external APIβ”‚
β”‚  ─────────────────────┼───────────────────────────────────────┼────────────│
β”‚  ANTI-CORRUPTION      β”‚ Legacy integration needed             β”‚ Translating β”‚
β”‚  LAYER                β”‚                                       β”‚ old to new  β”‚
β”‚  ─────────────────────┼───────────────────────────────────────┼────────────│
β”‚  OPEN HOST SERVICE    β”‚ Providing standard protocol           β”‚ Public API  β”‚
β”‚  ─────────────────────┼───────────────────────────────────────┼────────────│
β”‚  PUBLISHED LANGUAGE   β”‚ Sharing formalized model              β”‚ Event       β”‚
β”‚                       β”‚                                       β”‚ schemas     β”‚
β”‚  ─────────────────────┼───────────────────────────────────────┼────────────│
β”‚  SEPARATE WAYS        β”‚ Integration cost > Duplication cost   β”‚ Custom auth β”‚
β”‚                       β”‚                                       β”‚ per service β”‚
β”‚                                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Tactical Patterns

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  TACTICAL PATTERNS QUICK REFERENCE                                          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                              β”‚
β”‚  ENTITY                                                                 β”‚
β”‚  β€’ Has identity that persists through state changes                          β”‚
β”‚  β€’ Identity matters even if all attributes change                            β”‚
β”‚  β€’ Example: User (same person even if name/email changes)                    β”‚
β”‚                                                                              β”‚
β”‚  VALUE OBJECT                                                             β”‚
β”‚  β€’ Immutable, compared by all attributes                                       β”‚
β”‚  β€’ No identity - create new instead of modifying                               β”‚
β”‚  β€’ Example: Money(amount, currency), Address(street, city, zip)            β”‚
β”‚                                                                              β”‚
β”‚  AGGREGATE                                                                β”‚
β”‚  β€’ Consistency boundary cluster                                                β”‚
β”‚  β€’ Root entity controls all access to children                                 β”‚
β”‚  β€’ Example: Order (root) containing OrderItems (children)                  β”‚
β”‚                                                                              β”‚
β”‚  DOMAIN EVENT                                                             β”‚
β”‚  β€’ Something that happened in the domain                                       β”‚
β”‚  β€’ Immutable record of past occurrence                                         β”‚
β”‚  β€’ Example: OrderShipped, PaymentFailed                                      β”‚
β”‚                                                                              β”‚
β”‚  DOMAIN SERVICE                                                           β”‚
β”‚  β€’ Business logic that doesn't fit in entity/value object                    β”‚
β”‚  β€’ Stateless operations across multiple aggregates                           β”‚
β”‚  β€’ Example: PricingCalculator, TransferService                               β”‚
β”‚                                                                              β”‚
β”‚  REPOSITORY                                                               β”‚
β”‚  β€’ Abstracts persistence - domain talks to interface                         β”‚
β”‚  β€’ Returns fully-hydrated aggregates                                          β”‚
β”‚  β€’ Example: OrderRepository.save(order), OrderRepository.findById(id)       β”‚
β”‚                                                                              β”‚
β”‚  FACTORY                                                                  β”‚
β”‚  β€’ Encapsulates complex aggregate creation                                   β”‚
β”‚  β€’ Ensures invariants satisfied from birth                                    β”‚
β”‚  β€’ Example: OrderFactory.createForCustomer(customerId, items)               β”‚
β”‚                                                                              β”‚
β”‚  DOMAIN EVENT PUBLISHER                                                   β”‚
β”‚  β€’ Mechanism to publish events from aggregates                               β”‚
β”‚  β€’ Usually injected or provided via Unit of Work                              β”‚
β”‚  β€’ Example: aggregate.publishEvent(new OrderPlaced(...))                    β”‚
β”‚                                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”„ The FANG Feedback Loop

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  CONTINUOUS DOMAIN REFINEMENT                                               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚   EVENT     │───►│  ANALYZE    │───►│   UPDATE    │───►│   DEPLOY    β”‚  β”‚
β”‚  β”‚  STORMING   β”‚    β”‚   METRICS   β”‚    β”‚   MODEL     β”‚    β”‚   CHANGE    β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚        β–²                                                       β”‚            β”‚
β”‚        β”‚                                                       β”‚            β”‚
β”‚        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜            β”‚
β”‚                        OBSERVE & LEARN                                       β”‚
β”‚                                                                              β”‚
β”‚  Quarterly Domain Review:                                                    β”‚
β”‚  β–‘ Ubiquitous language still accurate?                                      β”‚
β”‚  β–‘ Aggregates handling load appropriately?                                  β”‚
β”‚  β–‘ Event schema evolution tracked?                                          β”‚
β”‚  β–‘ New bounded contexts emerging?                                           β”‚
β”‚  β–‘ User stories in spec-ddd/ still relevant?                                β”‚
β”‚                                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“š References

Books (FANG-Recommended)

  • "Domain-Driven Design" by Eric Evans (The Blue Book) - Foundation
  • "Implementing Domain-Driven Design" by Vaughn Vernon (The Red Book) - Practical
  • "Domain-Driven Design Distilled" by Vaughn Vernon - Quick start
  • "Building Microservices" by Sam Newman - Context boundaries
  • "Designing Data-Intensive Applications" by Martin Kleppmann - Technical depth

Online Resources

  • DDD Europe Conference Talks (YouTube)
  • Virtual DDD Community (virtualddd.com)
  • Event Modeling (eventmodeling.org)
  • Martin Fowler's bliki (martinfowler.com)

Tools

  • Event Storming: Miro, Mural, physical sticky notes
  • Context Mapping: Visual Paradigm, diagrams.net
  • Code Modeling: JetBrains DDD plugin, ArchUnit
  • Documentation: Arc42, C4 Model
  • User Stories: YAML specs in spec-ddd/

🎯 Summary: The skill-spec-ddd Workflow

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  MINIMUM VIABLE PROCESS (Start Here)                                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                              β”‚
β”‚  1. REQUIREMENTS (Non-negotiable minimums)                                   β”‚
β”‚     β–‘ List 3+ scopes                                                        β”‚
β”‚     β–‘ List 3+ technical scopes                                              β”‚
β”‚     β–‘ List 3+ pain points                                                   β”‚
β”‚     β–‘ Create spec-ddd/feat-*.yml files                                       β”‚
β”‚                                                                              β”‚
β”‚  2. ANALYSIS (Dual language)                                                β”‚
β”‚     β–‘ Analyze each item in ES                                               β”‚
β”‚     β–‘ Analyze each item in EN                                               β”‚
β”‚     β–‘ Document complexity, risks, and solutions                             β”‚
β”‚     β–‘ Update user story YAML files                                           β”‚
β”‚                                                                              β”‚
β”‚  3. DECOMPOSITION (Stack Engineer mindset)                                  β”‚
β”‚     β–‘ Map business capabilities β†’ domains                                   β”‚
β”‚     β–‘ Identify bounded contexts                                             β”‚
β”‚     β–‘ Design aggregates and domain events                                   β”‚
β”‚     β–‘ Draw context map with integration patterns                            β”‚
β”‚     β–‘ Map user stories to aggregates                                        β”‚
β”‚                                                                              β”‚
β”‚  4. DECISIONS (ADR discipline)                                            β”‚
β”‚     β–‘ Write ADR for architecture style                                      β”‚
β”‚     β–‘ Write ADR for persistence strategy                                    β”‚
β”‚     β–‘ Write ADR for communication patterns                                  β”‚
β”‚                                                                              β”‚
β”‚  5. IMPLEMENTATION (FANG execution)                                         β”‚
β”‚     β–‘ Sprint 0: Foundation + User Story YAMLs                               β”‚
β”‚     β–‘ Vertical slices per sprint (one user story at a time)                β”‚
β”‚     β–‘ Observability from day one                                            β”‚
β”‚     β–‘ Quarterly domain reviews                                              β”‚
β”‚                                                                              β”‚
β”‚  SUCCESS CRITERIA:                                                          β”‚
β”‚  βœ“ System handles projected load (plan for 10x)                           β”‚
β”‚  βœ“ New developers understand domain in < 1 week                             β”‚
β”‚  βœ“ Changes deploy without fear                                              β”‚
β”‚  βœ“ Domain language matches business language                                β”‚
β”‚  βœ“ Can answer "why" for any architectural choice                            β”‚
β”‚  βœ“ User stories traceable from spec-ddd/ to code                              β”‚
β”‚                                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Remember the FANG Principles:

  1. Start simple, evolve based on data - Don't over-engineer prematurely
  2. Clear ownership, clear interfaces - Every context has an owner
  3. Measure everything - If you can't observe it, you can't improve it
  4. Document decisions - Context is as important as code
  5. Domain language is sacred - Ubiquitous language prevents bugs
  6. User stories as code - YAML specs living alongside the domain

Act like your system will need to serve 100 million users tomorrow.

Installs
1
GitHub Stars
1
First Seen
1 day ago