[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6BXMBJ6ZWNGMBEMCVTCM4VW":3,"skill-same:01M6BXMBJ6ZWNGMBEMCVTCM4VW":54},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":26,"linkOnly":27,"markdownContent":28,"markdownBody":29,"frontMatter":30,"refName":31,"commitSha":32,"skillDirectory":33,"forksCount":34,"repositoryHtmlUrl":35,"repositoryHomepageUrl":6,"ownerHtmlUrl":36,"ownerBlogUrl":37,"ownerDescription":38,"updatedAt":39,"install":40,"resources":53},"01M6BXMBJ6ZWNGMBEMCVTCM4VW","V3 DDD Architecture",null,"Domain-Driven Design architecture for claude-flow v3. Implements modular, bounded context architecture with clean separation of concerns and microkernel pattern.","diegopacheco\u002Fai-playground","diegopacheco","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F121278?v=4","01M6BXCP8P7GGSJ8M1W2MFDTGT","Diego Pacheco","01M6BXCPD3WM51H465XW9YM4BV",21,"Unlicense","https:\u002F\u002Fgithub.com\u002Fdiegopacheco\u002Fai-playground\u002Fblob\u002Fmain\u002Fpocs\u002Fclaude-flow-fun\u002F.claude\u002Fskills\u002Fv3-ddd-architecture\u002FSKILL.md",[],[19,20,5,21,22,23,24,25],"architecture","ddd","design","modular","design architecture","flow","context architecture","2026-11-10 10:12:30",false,"---\nname: \"V3 DDD Architecture\"\ndescription: \"Domain-Driven Design architecture for claude-flow v3. Implements modular, bounded context architecture with clean separation of concerns and microkernel pattern.\"\n---\n\n# V3 DDD Architecture\n\n## What This Skill Does\n\nDesigns and implements Domain-Driven Design (DDD) architecture for claude-flow v3, decomposing god objects into bounded contexts, implementing clean architecture patterns, and enabling modular, testable code structure.\n\n## Quick Start\n\n```bash\n# Initialize DDD architecture analysis\nTask(\"Architecture analysis\", \"Analyze current architecture and design DDD boundaries\", \"core-architect\")\n\n# Domain modeling (parallel)\nTask(\"Domain decomposition\", \"Break down orchestrator god object into domains\", \"core-architect\")\nTask(\"Context mapping\", \"Map bounded contexts and relationships\", \"core-architect\")\nTask(\"Interface design\", \"Design clean domain interfaces\", \"core-architect\")\n```\n\n## DDD Implementation Strategy\n\n### Current Architecture Analysis\n```\n├── PROBLEMATIC: core\u002Forchestrator.ts (1,440 lines - GOD OBJECT)\n│   ├── Task management responsibilities\n│   ├── Session management responsibilities\n│   ├── Health monitoring responsibilities\n│   ├── Lifecycle management responsibilities\n│   └── Event coordination responsibilities\n│\n└── TARGET: Modular DDD Architecture\n    ├── core\u002Fdomains\u002F\n    │   ├── task-management\u002F\n    │   ├── session-management\u002F\n    │   ├── health-monitoring\u002F\n    │   ├── lifecycle-management\u002F\n    │   └── event-coordination\u002F\n    └── core\u002Fshared\u002F\n        ├── interfaces\u002F\n        ├── value-objects\u002F\n        └── domain-events\u002F\n```\n\n### Domain Boundaries\n\n#### 1. Task Management Domain\n```typescript\n\u002F\u002F core\u002Fdomains\u002Ftask-management\u002F\ninterface TaskManagementDomain {\n  \u002F\u002F Entities\n  Task: TaskEntity;\n  TaskQueue: TaskQueueEntity;\n\n  \u002F\u002F Value Objects\n  TaskId: TaskIdVO;\n  TaskStatus: TaskStatusVO;\n  Priority: PriorityVO;\n\n  \u002F\u002F Services\n  TaskScheduler: TaskSchedulingService;\n  TaskValidator: TaskValidationService;\n\n  \u002F\u002F Repository\n  TaskRepository: ITaskRepository;\n}\n```\n\n#### 2. Session Management Domain\n```typescript\n\u002F\u002F core\u002Fdomains\u002Fsession-management\u002F\ninterface SessionManagementDomain {\n  \u002F\u002F Entities\n  Session: SessionEntity;\n  SessionState: SessionStateEntity;\n\n  \u002F\u002F Value Objects\n  SessionId: SessionIdVO;\n  SessionStatus: SessionStatusVO;\n\n  \u002F\u002F Services\n  SessionLifecycle: SessionLifecycleService;\n  SessionPersistence: SessionPersistenceService;\n\n  \u002F\u002F Repository\n  SessionRepository: ISessionRepository;\n}\n```\n\n#### 3. Health Monitoring Domain\n```typescript\n\u002F\u002F core\u002Fdomains\u002Fhealth-monitoring\u002F\ninterface HealthMonitoringDomain {\n  \u002F\u002F Entities\n  HealthCheck: HealthCheckEntity;\n  Metric: MetricEntity;\n\n  \u002F\u002F Value Objects\n  HealthStatus: HealthStatusVO;\n  Threshold: ThresholdVO;\n\n  \u002F\u002F Services\n  HealthCollector: HealthCollectionService;\n  AlertManager: AlertManagementService;\n\n  \u002F\u002F Repository\n  MetricsRepository: IMetricsRepository;\n}\n```\n\n## Microkernel Architecture Pattern\n\n### Core Kernel\n```typescript\n\u002F\u002F core\u002Fkernel\u002Fclaude-flow-kernel.ts\nexport class ClaudeFlowKernel {\n  private domains: Map\u003Cstring, Domain> = new Map();\n  private eventBus: DomainEventBus;\n  private dependencyContainer: Container;\n\n  async initialize(): Promise\u003Cvoid> {\n    \u002F\u002F Load core domains\n    await this.loadDomain('task-management', new TaskManagementDomain());\n    await this.loadDomain('session-management', new SessionManagementDomain());\n    await this.loadDomain('health-monitoring', new HealthMonitoringDomain());\n\n    \u002F\u002F Wire up domain events\n    this.setupDomainEventHandlers();\n  }\n\n  async loadDomain(name: string, domain: Domain): Promise\u003Cvoid> {\n    await domain.initialize(this.dependencyContainer);\n    this.domains.set(name, domain);\n  }\n\n  getDomain\u003CT extends Domain>(name: string): T {\n    const domain = this.domains.get(name);\n    if (!domain) {\n      throw new DomainNotLoadedError(name);\n    }\n    return domain as T;\n  }\n}\n```\n\n### Plugin Architecture\n```typescript\n\u002F\u002F core\u002Fplugins\u002F\ninterface DomainPlugin {\n  name: string;\n  version: string;\n  dependencies: string[];\n\n  initialize(kernel: ClaudeFlowKernel): Promise\u003Cvoid>;\n  shutdown(): Promise\u003Cvoid>;\n}\n\n\u002F\u002F Example: Swarm Coordination Plugin\nexport class SwarmCoordinationPlugin implements DomainPlugin {\n  name = 'swarm-coordination';\n  version = '3.0.0';\n  dependencies = ['task-management', 'session-management'];\n\n  async initialize(kernel: ClaudeFlowKernel): Promise\u003Cvoid> {\n    const taskDomain = kernel.getDomain\u003CTaskManagementDomain>('task-management');\n    const sessionDomain = kernel.getDomain\u003CSessionManagementDomain>('session-management');\n\n    \u002F\u002F Register swarm coordination services\n    this.swarmCoordinator = new UnifiedSwarmCoordinator(taskDomain, sessionDomain);\n    kernel.registerService('swarm-coordinator', this.swarmCoordinator);\n  }\n}\n```\n\n## Domain Events & Integration\n\n### Event-Driven Communication\n```typescript\n\u002F\u002F core\u002Fshared\u002Fdomain-events\u002F\nabstract class DomainEvent {\n  public readonly eventId: string;\n  public readonly aggregateId: string;\n  public readonly occurredOn: Date;\n  public readonly eventVersion: number;\n\n  constructor(aggregateId: string) {\n    this.eventId = crypto.randomUUID();\n    this.aggregateId = aggregateId;\n    this.occurredOn = new Date();\n    this.eventVersion = 1;\n  }\n}\n\n\u002F\u002F Task domain events\nexport class TaskAssignedEvent extends DomainEvent {\n  constructor(\n    taskId: string,\n    public readonly agentId: string,\n    public readonly priority: Priority\n  ) {\n    super(taskId);\n  }\n}\n\nexport class TaskCompletedEvent extends DomainEvent {\n  constructor(\n    taskId: string,\n    public readonly result: TaskResult,\n    public readonly duration: number\n  ) {\n    super(taskId);\n  }\n}\n\n\u002F\u002F Event handlers\n@EventHandler(TaskCompletedEvent)\nexport class TaskCompletedHandler {\n  constructor(\n    private metricsRepository: IMetricsRepository,\n    private sessionService: SessionLifecycleService\n  ) {}\n\n  async handle(event: TaskCompletedEvent): Promise\u003Cvoid> {\n    \u002F\u002F Update metrics\n    await this.metricsRepository.recordTaskCompletion(\n      event.aggregateId,\n      event.duration\n    );\n\n    \u002F\u002F Update session state\n    await this.sessionService.markTaskCompleted(\n      event.aggregateId,\n      event.result\n    );\n  }\n}\n```\n\n## Clean Architecture Layers\n\n```typescript\n\u002F\u002F Architecture layers\n┌─────────────────────────────────────────┐\n│              Presentation               │  ← CLI, API, UI\n├─────────────────────────────────────────┤\n│              Application                │  ← Use Cases, Commands\n├─────────────────────────────────────────┤\n│               Domain                    │  ← Entities, Services, Events\n├─────────────────────────────────────────┤\n│            Infrastructure               │  ← DB, MCP, External APIs\n└─────────────────────────────────────────┘\n\n\u002F\u002F Dependency direction: Outside → Inside\n\u002F\u002F Domain layer has NO external dependencies\n```\n\n### Application Layer (Use Cases)\n```typescript\n\u002F\u002F core\u002Fapplication\u002Fuse-cases\u002F\nexport class AssignTaskUseCase {\n  constructor(\n    private taskRepository: ITaskRepository,\n    private agentRepository: IAgentRepository,\n    private eventBus: DomainEventBus\n  ) {}\n\n  async execute(command: AssignTaskCommand): Promise\u003CTaskResult> {\n    \u002F\u002F 1. Validate command\n    await this.validateCommand(command);\n\n    \u002F\u002F 2. Load aggregates\n    const task = await this.taskRepository.findById(command.taskId);\n    const agent = await this.agentRepository.findById(command.agentId);\n\n    \u002F\u002F 3. Business logic (in domain)\n    task.assignTo(agent);\n\n    \u002F\u002F 4. Persist changes\n    await this.taskRepository.save(task);\n\n    \u002F\u002F 5. Publish domain events\n    task.getUncommittedEvents().forEach(event =>\n      this.eventBus.publish(event)\n    );\n\n    \u002F\u002F 6. Return result\n    return TaskResult.success(task);\n  }\n}\n```\n\n## Module Configuration\n\n### Bounded Context Modules\n```typescript\n\u002F\u002F core\u002Fdomains\u002Ftask-management\u002Fmodule.ts\nexport const taskManagementModule = {\n  name: 'task-management',\n\n  entities: [\n    TaskEntity,\n    TaskQueueEntity\n  ],\n\n  valueObjects: [\n    TaskIdVO,\n    TaskStatusVO,\n    PriorityVO\n  ],\n\n  services: [\n    TaskSchedulingService,\n    TaskValidationService\n  ],\n\n  repositories: [\n    { provide: ITaskRepository, useClass: SqliteTaskRepository }\n  ],\n\n  eventHandlers: [\n    TaskAssignedHandler,\n    TaskCompletedHandler\n  ]\n};\n```\n\n## Migration Strategy\n\n### Phase 1: Extract Domain Services\n```typescript\n\u002F\u002F Extract services from orchestrator.ts\nconst extractionPlan = {\n  week1: [\n    'TaskManager → task-management domain',\n    'SessionManager → session-management domain'\n  ],\n  week2: [\n    'HealthMonitor → health-monitoring domain',\n    'LifecycleManager → lifecycle-management domain'\n  ],\n  week3: [\n    'EventCoordinator → event-coordination domain',\n    'Wire up domain events'\n  ]\n};\n```\n\n### Phase 2: Implement Clean Interfaces\n```typescript\n\u002F\u002F Clean separation with dependency injection\nexport class TaskController {\n  constructor(\n    @Inject('AssignTaskUseCase') private assignTask: AssignTaskUseCase,\n    @Inject('CompleteTaskUseCase') private completeTask: CompleteTaskUseCase\n  ) {}\n\n  async assign(request: AssignTaskRequest): Promise\u003CTaskResponse> {\n    const command = AssignTaskCommand.fromRequest(request);\n    const result = await this.assignTask.execute(command);\n    return TaskResponse.fromResult(result);\n  }\n}\n```\n\n### Phase 3: Plugin System\n```typescript\n\u002F\u002F Enable plugin-based extensions\nconst pluginSystem = {\n  core: ['task-management', 'session-management', 'health-monitoring'],\n  optional: ['swarm-coordination', 'learning-integration', 'performance-monitoring']\n};\n```\n\n## Testing Strategy\n\n### Domain Testing (London School TDD)\n```typescript\n\u002F\u002F Pure domain logic testing\ndescribe('Task Entity', () => {\n  let task: TaskEntity;\n  let mockAgent: jest.Mocked\u003CAgentEntity>;\n\n  beforeEach(() => {\n    task = new TaskEntity(TaskId.create(), 'Test task');\n    mockAgent = createMock\u003CAgentEntity>();\n  });\n\n  it('should assign to agent when valid', () => {\n    mockAgent.canAcceptTask.mockReturnValue(true);\n\n    task.assignTo(mockAgent);\n\n    expect(task.assignedAgent).toBe(mockAgent);\n    expect(task.status.value).toBe('assigned');\n  });\n\n  it('should emit TaskAssignedEvent when assigned', () => {\n    mockAgent.canAcceptTask.mockReturnValue(true);\n\n    task.assignTo(mockAgent);\n\n    const events = task.getUncommittedEvents();\n    expect(events).toHaveLength(1);\n    expect(events[0]).toBeInstanceOf(TaskAssignedEvent);\n  });\n});\n```\n\n## Success Metrics\n\n- [ ] **God Object Elimination**: orchestrator.ts (1,440 lines) → 5 focused domains (\u003C300 lines each)\n- [ ] **Bounded Context Isolation**: 100% domain independence\n- [ ] **Plugin Architecture**: Core + optional modules loading\n- [ ] **Clean Architecture**: Dependency inversion maintained\n- [ ] **Event-Driven Communication**: Loose coupling between domains\n- [ ] **Test Coverage**: >90% domain logic coverage\n\n## Related V3 Skills\n\n- `v3-core-implementation` - Implementation of DDD domains\n- `v3-memory-unification` - AgentDB integration within bounded contexts\n- `v3-swarm-coordination` - Swarm coordination as domain plugin\n- `v3-performance-optimization` - Performance optimization across domains\n\n## Usage Examples\n\n### Complete Domain Extraction\n```bash\n# Full DDD architecture implementation\nTask(\"DDD architecture implementation\",\n     \"Extract orchestrator into DDD domains with clean architecture\",\n     \"core-architect\")\n```\n\n### Plugin Development\n```bash\n# Create domain plugin\nnpm run create:plugin -- --name swarm-coordination --template domain\n```","# V3 DDD Architecture\n\n## What This Skill Does\n\nDesigns and implements Domain-Driven Design (DDD) architecture for claude-flow v3, decomposing god objects into bounded contexts, implementing clean architecture patterns, and enabling modular, testable code structure.\n\n## Quick Start\n\n```bash\n# Initialize DDD architecture analysis\nTask(\"Architecture analysis\", \"Analyze current architecture and design DDD boundaries\", \"core-architect\")\n\n# Domain modeling (parallel)\nTask(\"Domain decomposition\", \"Break down orchestrator god object into domains\", \"core-architect\")\nTask(\"Context mapping\", \"Map bounded contexts and relationships\", \"core-architect\")\nTask(\"Interface design\", \"Design clean domain interfaces\", \"core-architect\")\n```\n\n## DDD Implementation Strategy\n\n### Current Architecture Analysis\n```\n├── PROBLEMATIC: core\u002Forchestrator.ts (1,440 lines - GOD OBJECT)\n│   ├── Task management responsibilities\n│   ├── Session management responsibilities\n│   ├── Health monitoring responsibilities\n│   ├── Lifecycle management responsibilities\n│   └── Event coordination responsibilities\n│\n└── TARGET: Modular DDD Architecture\n    ├── core\u002Fdomains\u002F\n    │   ├── task-management\u002F\n    │   ├── session-management\u002F\n    │   ├── health-monitoring\u002F\n    │   ├── lifecycle-management\u002F\n    │   └── event-coordination\u002F\n    └── core\u002Fshared\u002F\n        ├── interfaces\u002F\n        ├── value-objects\u002F\n        └── domain-events\u002F\n```\n\n### Domain Boundaries\n\n#### 1. Task Management Domain\n```typescript\n\u002F\u002F core\u002Fdomains\u002Ftask-management\u002F\ninterface TaskManagementDomain {\n  \u002F\u002F Entities\n  Task: TaskEntity;\n  TaskQueue: TaskQueueEntity;\n\n  \u002F\u002F Value Objects\n  TaskId: TaskIdVO;\n  TaskStatus: TaskStatusVO;\n  Priority: PriorityVO;\n\n  \u002F\u002F Services\n  TaskScheduler: TaskSchedulingService;\n  TaskValidator: TaskValidationService;\n\n  \u002F\u002F Repository\n  TaskRepository: ITaskRepository;\n}\n```\n\n#### 2. Session Management Domain\n```typescript\n\u002F\u002F core\u002Fdomains\u002Fsession-management\u002F\ninterface SessionManagementDomain {\n  \u002F\u002F Entities\n  Session: SessionEntity;\n  SessionState: SessionStateEntity;\n\n  \u002F\u002F Value Objects\n  SessionId: SessionIdVO;\n  SessionStatus: SessionStatusVO;\n\n  \u002F\u002F Services\n  SessionLifecycle: SessionLifecycleService;\n  SessionPersistence: SessionPersistenceService;\n\n  \u002F\u002F Repository\n  SessionRepository: ISessionRepository;\n}\n```\n\n#### 3. Health Monitoring Domain\n```typescript\n\u002F\u002F core\u002Fdomains\u002Fhealth-monitoring\u002F\ninterface HealthMonitoringDomain {\n  \u002F\u002F Entities\n  HealthCheck: HealthCheckEntity;\n  Metric: MetricEntity;\n\n  \u002F\u002F Value Objects\n  HealthStatus: HealthStatusVO;\n  Threshold: ThresholdVO;\n\n  \u002F\u002F Services\n  HealthCollector: HealthCollectionService;\n  AlertManager: AlertManagementService;\n\n  \u002F\u002F Repository\n  MetricsRepository: IMetricsRepository;\n}\n```\n\n## Microkernel Architecture Pattern\n\n### Core Kernel\n```typescript\n\u002F\u002F core\u002Fkernel\u002Fclaude-flow-kernel.ts\nexport class ClaudeFlowKernel {\n  private domains: Map\u003Cstring, Domain> = new Map();\n  private eventBus: DomainEventBus;\n  private dependencyContainer: Container;\n\n  async initialize(): Promise\u003Cvoid> {\n    \u002F\u002F Load core domains\n    await this.loadDomain('task-management', new TaskManagementDomain());\n    await this.loadDomain('session-management', new SessionManagementDomain());\n    await this.loadDomain('health-monitoring', new HealthMonitoringDomain());\n\n    \u002F\u002F Wire up domain events\n    this.setupDomainEventHandlers();\n  }\n\n  async loadDomain(name: string, domain: Domain): Promise\u003Cvoid> {\n    await domain.initialize(this.dependencyContainer);\n    this.domains.set(name, domain);\n  }\n\n  getDomain\u003CT extends Domain>(name: string): T {\n    const domain = this.domains.get(name);\n    if (!domain) {\n      throw new DomainNotLoadedError(name);\n    }\n    return domain as T;\n  }\n}\n```\n\n### Plugin Architecture\n```typescript\n\u002F\u002F core\u002Fplugins\u002F\ninterface DomainPlugin {\n  name: string;\n  version: string;\n  dependencies: string[];\n\n  initialize(kernel: ClaudeFlowKernel): Promise\u003Cvoid>;\n  shutdown(): Promise\u003Cvoid>;\n}\n\n\u002F\u002F Example: Swarm Coordination Plugin\nexport class SwarmCoordinationPlugin implements DomainPlugin {\n  name = 'swarm-coordination';\n  version = '3.0.0';\n  dependencies = ['task-management', 'session-management'];\n\n  async initialize(kernel: ClaudeFlowKernel): Promise\u003Cvoid> {\n    const taskDomain = kernel.getDomain\u003CTaskManagementDomain>('task-management');\n    const sessionDomain = kernel.getDomain\u003CSessionManagementDomain>('session-management');\n\n    \u002F\u002F Register swarm coordination services\n    this.swarmCoordinator = new UnifiedSwarmCoordinator(taskDomain, sessionDomain);\n    kernel.registerService('swarm-coordinator', this.swarmCoordinator);\n  }\n}\n```\n\n## Domain Events & Integration\n\n### Event-Driven Communication\n```typescript\n\u002F\u002F core\u002Fshared\u002Fdomain-events\u002F\nabstract class DomainEvent {\n  public readonly eventId: string;\n  public readonly aggregateId: string;\n  public readonly occurredOn: Date;\n  public readonly eventVersion: number;\n\n  constructor(aggregateId: string) {\n    this.eventId = crypto.randomUUID();\n    this.aggregateId = aggregateId;\n    this.occurredOn = new Date();\n    this.eventVersion = 1;\n  }\n}\n\n\u002F\u002F Task domain events\nexport class TaskAssignedEvent extends DomainEvent {\n  constructor(\n    taskId: string,\n    public readonly agentId: string,\n    public readonly priority: Priority\n  ) {\n    super(taskId);\n  }\n}\n\nexport class TaskCompletedEvent extends DomainEvent {\n  constructor(\n    taskId: string,\n    public readonly result: TaskResult,\n    public readonly duration: number\n  ) {\n    super(taskId);\n  }\n}\n\n\u002F\u002F Event handlers\n@EventHandler(TaskCompletedEvent)\nexport class TaskCompletedHandler {\n  constructor(\n    private metricsRepository: IMetricsRepository,\n    private sessionService: SessionLifecycleService\n  ) {}\n\n  async handle(event: TaskCompletedEvent): Promise\u003Cvoid> {\n    \u002F\u002F Update metrics\n    await this.metricsRepository.recordTaskCompletion(\n      event.aggregateId,\n      event.duration\n    );\n\n    \u002F\u002F Update session state\n    await this.sessionService.markTaskCompleted(\n      event.aggregateId,\n      event.result\n    );\n  }\n}\n```\n\n## Clean Architecture Layers\n\n```typescript\n\u002F\u002F Architecture layers\n┌─────────────────────────────────────────┐\n│              Presentation               │  ← CLI, API, UI\n├─────────────────────────────────────────┤\n│              Application                │  ← Use Cases, Commands\n├─────────────────────────────────────────┤\n│               Domain                    │  ← Entities, Services, Events\n├─────────────────────────────────────────┤\n│            Infrastructure               │  ← DB, MCP, External APIs\n└─────────────────────────────────────────┘\n\n\u002F\u002F Dependency direction: Outside → Inside\n\u002F\u002F Domain layer has NO external dependencies\n```\n\n### Application Layer (Use Cases)\n```typescript\n\u002F\u002F core\u002Fapplication\u002Fuse-cases\u002F\nexport class AssignTaskUseCase {\n  constructor(\n    private taskRepository: ITaskRepository,\n    private agentRepository: IAgentRepository,\n    private eventBus: DomainEventBus\n  ) {}\n\n  async execute(command: AssignTaskCommand): Promise\u003CTaskResult> {\n    \u002F\u002F 1. Validate command\n    await this.validateCommand(command);\n\n    \u002F\u002F 2. Load aggregates\n    const task = await this.taskRepository.findById(command.taskId);\n    const agent = await this.agentRepository.findById(command.agentId);\n\n    \u002F\u002F 3. Business logic (in domain)\n    task.assignTo(agent);\n\n    \u002F\u002F 4. Persist changes\n    await this.taskRepository.save(task);\n\n    \u002F\u002F 5. Publish domain events\n    task.getUncommittedEvents().forEach(event =>\n      this.eventBus.publish(event)\n    );\n\n    \u002F\u002F 6. Return result\n    return TaskResult.success(task);\n  }\n}\n```\n\n## Module Configuration\n\n### Bounded Context Modules\n```typescript\n\u002F\u002F core\u002Fdomains\u002Ftask-management\u002Fmodule.ts\nexport const taskManagementModule = {\n  name: 'task-management',\n\n  entities: [\n    TaskEntity,\n    TaskQueueEntity\n  ],\n\n  valueObjects: [\n    TaskIdVO,\n    TaskStatusVO,\n    PriorityVO\n  ],\n\n  services: [\n    TaskSchedulingService,\n    TaskValidationService\n  ],\n\n  repositories: [\n    { provide: ITaskRepository, useClass: SqliteTaskRepository }\n  ],\n\n  eventHandlers: [\n    TaskAssignedHandler,\n    TaskCompletedHandler\n  ]\n};\n```\n\n## Migration Strategy\n\n### Phase 1: Extract Domain Services\n```typescript\n\u002F\u002F Extract services from orchestrator.ts\nconst extractionPlan = {\n  week1: [\n    'TaskManager → task-management domain',\n    'SessionManager → session-management domain'\n  ],\n  week2: [\n    'HealthMonitor → health-monitoring domain',\n    'LifecycleManager → lifecycle-management domain'\n  ],\n  week3: [\n    'EventCoordinator → event-coordination domain',\n    'Wire up domain events'\n  ]\n};\n```\n\n### Phase 2: Implement Clean Interfaces\n```typescript\n\u002F\u002F Clean separation with dependency injection\nexport class TaskController {\n  constructor(\n    @Inject('AssignTaskUseCase') private assignTask: AssignTaskUseCase,\n    @Inject('CompleteTaskUseCase') private completeTask: CompleteTaskUseCase\n  ) {}\n\n  async assign(request: AssignTaskRequest): Promise\u003CTaskResponse> {\n    const command = AssignTaskCommand.fromRequest(request);\n    const result = await this.assignTask.execute(command);\n    return TaskResponse.fromResult(result);\n  }\n}\n```\n\n### Phase 3: Plugin System\n```typescript\n\u002F\u002F Enable plugin-based extensions\nconst pluginSystem = {\n  core: ['task-management', 'session-management', 'health-monitoring'],\n  optional: ['swarm-coordination', 'learning-integration', 'performance-monitoring']\n};\n```\n\n## Testing Strategy\n\n### Domain Testing (London School TDD)\n```typescript\n\u002F\u002F Pure domain logic testing\ndescribe('Task Entity', () => {\n  let task: TaskEntity;\n  let mockAgent: jest.Mocked\u003CAgentEntity>;\n\n  beforeEach(() => {\n    task = new TaskEntity(TaskId.create(), 'Test task');\n    mockAgent = createMock\u003CAgentEntity>();\n  });\n\n  it('should assign to agent when valid', () => {\n    mockAgent.canAcceptTask.mockReturnValue(true);\n\n    task.assignTo(mockAgent);\n\n    expect(task.assignedAgent).toBe(mockAgent);\n    expect(task.status.value).toBe('assigned');\n  });\n\n  it('should emit TaskAssignedEvent when assigned', () => {\n    mockAgent.canAcceptTask.mockReturnValue(true);\n\n    task.assignTo(mockAgent);\n\n    const events = task.getUncommittedEvents();\n    expect(events).toHaveLength(1);\n    expect(events[0]).toBeInstanceOf(TaskAssignedEvent);\n  });\n});\n```\n\n## Success Metrics\n\n- [ ] **God Object Elimination**: orchestrator.ts (1,440 lines) → 5 focused domains (\u003C300 lines each)\n- [ ] **Bounded Context Isolation**: 100% domain independence\n- [ ] **Plugin Architecture**: Core + optional modules loading\n- [ ] **Clean Architecture**: Dependency inversion maintained\n- [ ] **Event-Driven Communication**: Loose coupling between domains\n- [ ] **Test Coverage**: >90% domain logic coverage\n\n## Related V3 Skills\n\n- `v3-core-implementation` - Implementation of DDD domains\n- `v3-memory-unification` - AgentDB integration within bounded contexts\n- `v3-swarm-coordination` - Swarm coordination as domain plugin\n- `v3-performance-optimization` - Performance optimization across domains\n\n## Usage Examples\n\n### Complete Domain Extraction\n```bash\n# Full DDD architecture implementation\nTask(\"DDD architecture implementation\",\n     \"Extract orchestrator into DDD domains with clean architecture\",\n     \"core-architect\")\n```\n\n### Plugin Development\n```bash\n# Create domain plugin\nnpm run create:plugin -- --name swarm-coordination --template domain\n```",{"name":5,"description":7},"main","90d379e95fcc23dd9759654c345424e1752b0f3a","pocs\u002Fclaude-flow-fun\u002F.claude\u002Fskills\u002Fv3-ddd-architecture",9,"https:\u002F\u002Fgithub.com\u002Fdiegopacheco\u002Fai-playground","https:\u002F\u002Fgithub.com\u002Fdiegopacheco","http:\u002F\u002Fdiego-pacheco.blogspot.com","Brazilian Hands-on Software Architect | 20+ years in Tech | Author | Father. Opinions are my own!","2026-11-13 23:52:43",{"source":8,"skillName":5,"commands":41,"prompt":51,"zipAvailable":52},[42,45,48],{"tool":43,"command":44},"npx","npx skills add diegopacheco\u002Fai-playground --skill \"V3 DDD Architecture\"",{"tool":46,"command":47},"bunx","bunx skills add diegopacheco\u002Fai-playground --skill \"V3 DDD Architecture\"",{"tool":49,"command":50},"pnpm","pnpm dlx skills add diegopacheco\u002Fai-playground --skill \"V3 DDD Architecture\"","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdiegopacheco\u002Fai-playground\u002Fblob\u002Fmain\u002Fpocs\u002Fclaude-flow-fun\u002F.claude\u002Fskills\u002Fv3-ddd-architecture\u002FSKILL.md",true,[],[55,73,83,96,112,131],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":66,"publishedAt":26},"01M6WJ537DN520XY8MSW9ZV0RP","word-count","Counts the words, lines and characters of a text or a file.","https:\u002F\u002Fgithub.com\u002Fdiegopacheco\u002Fai-playground\u002Fblob\u002Fmain\u002Fpocs\u002Fskills-gateway-router\u002Fupstream-skills\u002Ftext-skills\u002Fword-count\u002FSKILL.md",[61],{"categoryNo":62,"categoryName":63,"taxonomyType":64,"taxonomyTypeDesc":65},"01JBSEEDCAT000000000000002","文档处理","SCENARIO","使用场景",[67,68,69,70,71,72],"count","word count","Word","characters","text","file",{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":26},"01M6WJ4Y2GT5SECWAKKYHGES4F","slugify","Turns a title or a sentence into a URL slug, lowercase words joined by hyphens with accents removed.","https:\u002F\u002Fgithub.com\u002Fdiegopacheco\u002Fai-playground\u002Fblob\u002Fmain\u002Fpocs\u002Fskills-gateway-router\u002Fupstream-skills\u002Ftext-skills\u002Fslugify\u002FSKILL.md",[],[75,80,81,82],"title","with","URL",{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":26},"01M6WJ4V9CWHT9NVCD441VK5MH","json-format","Validates a JSON file and pretty prints it with two space indentation, or reports where the JSON is invalid.","https:\u002F\u002Fgithub.com\u002Fdiegopacheco\u002Fai-playground\u002Fblob\u002Fmain\u002Fpocs\u002Fskills-gateway-router\u002Fupstream-skills\u002Fdev-skills\u002Fjson-format\u002FSKILL.md",[],[90,91,92,72,93,94,95,81],"json","format","json format","reports","invalid","it",{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":26},"01M6WJ4QMRKW8EFP71F4KS2DHE","commit-message","Writes a conventional commit message for the staged git changes.","https:\u002F\u002Fgithub.com\u002Fdiegopacheco\u002Fai-playground\u002Fblob\u002Fmain\u002Fpocs\u002Fskills-gateway-router\u002Fupstream-skills\u002Fdev-skills\u002Fcommit-message\u002FSKILL.md",[],[103,104,105,106,107,108,109,110,111],"commit","commit message","message","git","conventional commit","for","changes","staged","conventional commit message",{"skillNo":113,"name":114,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":116,"categories":117,"keywords":118,"publishedAt":26},"01M6WJ4MAM2CJH0GWYXFBB9GQC","skills-gateway","Gateway and router to a catalog of skills that are not registered directly. Use it before any task a specialized skill could handle, such as text, JSON or git chores. It finds the right skill and loads its instructions.","https:\u002F\u002Fgithub.com\u002Fdiegopacheco\u002Fai-playground\u002Fblob\u002Fmain\u002Fpocs\u002Fskills-gateway-router\u002F.claude\u002Fskills\u002Fskills-gateway\u002FSKILL.md",[],[119,120,95,121,122,106,123,90,71,124,125,126,127,128,129,130],"skills gateway","gateway","task","loads","Bash","node","specialized","instructions","catalog","use","router","as",{"skillNo":132,"name":133,"nameZh":6,"description":134,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":135,"categories":136,"keywords":137,"publishedAt":26},"01M6M2PYJJQKMWGX7XT7ZJK0H3","decision-log","Record, list, show and supersede architecture decisions that persist across sessions in the shared agent infra state store. Use when the user says \"record this decision\", \"log an ADR\", \"what did we decide about\", \"list decisions\", or \"supersede decision\".","https:\u002F\u002Fgithub.com\u002Fdiegopacheco\u002Fai-playground\u002Fblob\u002Fmain\u002Fpocs\u002Fagent-skills-infra-poc\u002Fskills\u002Fdecision-log\u002FSKILL.md",[],[138,139,140,141,19,142,143,144,145,146,128,147,148,149,150,151,152,153,154,155],"decision log","log","decision","persist","state","adr","decide","decisions","list","show","infra","record","across","shared","store","about","supersede","sessions"]