[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71S41FTSWFZTD6JG2HW2P8T":3,"skill-same:01M71S41FTSWFZTD6JG2HW2P8T":64},{"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":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":43,"commitSha":44,"skillDirectory":45,"forksCount":46,"repositoryHtmlUrl":47,"repositoryHomepageUrl":6,"ownerHtmlUrl":48,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":49,"install":50,"resources":63},"01M71S41FTSWFZTD6JG2HW2P8T","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.","manykarim\u002Frobotframework-agentguard","manykarim","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F61293164?v=4","01M71S15ZAXR15JHKM1N7BHT21","Many Kasiriha","01M71S160CWQXETSCYWXDVNYJ2",1,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fmanykarim\u002Frobotframework-agentguard\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fv3-ddd-architecture\u002FSKILL.md",[],[19,20,5,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"architecture","ddd","v3","bounded","design","for","with","separation","separation of concerns","driven","pattern","domain","clean","context","microkernel","context architecture","flow","design architecture","modular","2026-11-10 13:02:02",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","63caf799a0409377ce4fd434e24e9eac7c05c6fa",".claude\u002Fskills\u002Fv3-ddd-architecture",0,"https:\u002F\u002Fgithub.com\u002Fmanykarim\u002Frobotframework-agentguard","https:\u002F\u002Fgithub.com\u002Fmanykarim","2026-07-27 14:20:37",{"source":8,"skillName":5,"commands":51,"prompt":61,"zipAvailable":62},[52,55,58],{"tool":53,"command":54},"npx","npx skills add manykarim\u002Frobotframework-agentguard --skill \"V3 DDD Architecture\"",{"tool":56,"command":57},"bunx","bunx skills add manykarim\u002Frobotframework-agentguard --skill \"V3 DDD Architecture\"",{"tool":59,"command":60},"pnpm","pnpm dlx skills add manykarim\u002Frobotframework-agentguard --skill \"V3 DDD Architecture\"","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmanykarim\u002Frobotframework-agentguard\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fv3-ddd-architecture\u002FSKILL.md",true,[],[65,87,95,113,127,142],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":76,"publishedAt":38},"01M71S584X6G22VN1KZ42DZ33K","good-example","Demonstrate a minimal valid Agent Skill used by AgentGuard's own tests.","https:\u002F\u002Fgithub.com\u002Fmanykarim\u002Frobotframework-agentguard\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fskills\u002Fgood-skill\u002FSKILL.md",[71],{"categoryNo":72,"categoryName":73,"taxonomyType":74,"taxonomyTypeDesc":75},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[77,78,79,80,81,82,83,84,85,86],"good example","good","example","valid","agentguard","read","write","minimal","tests","agent skill",{"skillNo":88,"name":89,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":38},"01M71S55P2APRSAC0S9F5X556A","bad-example","https:\u002F\u002Fgithub.com\u002Fmanykarim\u002Frobotframework-agentguard\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fskills\u002Fbad-skill\u002FSKILL.md",[],[93,79,94,82],"bad","bad example",{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":102,"publishedAt":38},"01M71S53FGWCB5XXX4QGW3RF4P","injection-skill","Demonstrates a prompt-injection payload embedded in the body.","https:\u002F\u002Fgithub.com\u002Fmanykarim\u002Frobotframework-agentguard\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fsecurity\u002Finjection-skill\u002FSKILL.md",[101],{"categoryNo":72,"categoryName":73,"taxonomyType":74,"taxonomyTypeDesc":75},[103,104,82,105,106,107,108,109,110,111,112],"injection skill","injection","payload","body","prompt","unknown","Bash","prompt-injection","author","embedded",{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":120,"publishedAt":38},"01M71S518MA1JN7F1DZ5XVRH06","curl-pipe-skill","Skill whose installer script demonstrates the `curl ... | sh` antipattern.","https:\u002F\u002Fgithub.com\u002Fmanykarim\u002Frobotframework-agentguard\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fsecurity\u002Fcurl-pipe-skill\u002FSKILL.md",[119],{"categoryNo":72,"categoryName":73,"taxonomyType":74,"taxonomyTypeDesc":75},[121,122,123,124,125,108,109,111,126],"curl","pipe","curl pipe skill","installer","antipattern","script",{"skillNo":128,"name":129,"nameZh":6,"description":130,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":131,"categories":132,"keywords":134,"publishedAt":38},"01M71S4YYFE3HJKDEQR5Z944ZW","clean-skill","A minimal, well-formed skill used as the security-scanner happy path.","https:\u002F\u002Fgithub.com\u002Fmanykarim\u002Frobotframework-agentguard\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fsecurity\u002Fclean-skill\u002FSKILL.md",[133],{"categoryNo":72,"categoryName":73,"taxonomyType":74,"taxonomyTypeDesc":75},[135,31,81,136,84,137,138,139,140,82,141],"clean skill","scanner","grep","true","as","security","path",{"skillNo":143,"name":144,"nameZh":6,"description":145,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":146,"categories":147,"keywords":148,"publishedAt":38},"01M71S4W60AZYGA57HJWYBQZMJ","rf-libdoc-search","Search Robot Framework library\u002Fresource\u002Fsuite documentation to find matching keywords for a use case. Use when asked to find keywords, search libdoc, match a use case to keywords, or scan multiple libraries\u002Fresources for relevant keywords.","https:\u002F\u002Fgithub.com\u002Fmanykarim\u002Frobotframework-agentguard\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fintegrations\u002Fskills\u002Frf-libdoc-search\u002FSKILL.md",[],[149,150,151,24,152,153,154,155,156,157,158,159,160,161,162,163,164,165],"search","rf libdoc search","case","resources","relevant","scan","libraries","documentation","robot","when","framework","use","match","library","suite","matching","find"]