[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M74B0EE6RHGHSXWP84FX0ZNV":3,"skill-same:01M74B0EE6RHGHSXWP84FX0ZNV":43},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":13,"repositoryHtmlUrl":26,"repositoryHomepageUrl":6,"ownerHtmlUrl":27,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":28,"install":29,"resources":42},"01M74B0EE6RHGHSXWP84FX0ZNV","V3 Core Implementation",null,"Core module implementation for claude-flow v3. Implements DDD domains, clean architecture patterns, dependency injection, and modular TypeScript codebase with comprehensive testing.","aicreator350\u002FaurionOFFICIELLE","aicreator350","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F217751428?v=4","01M731QVHB22WCM6PDX5VFN1RV","01M731QVJ0TAD058M1SW9MY548",0,"MIT","https:\u002F\u002Fgithub.com\u002Faicreator350\u002FaurionOFFICIELLE\u002Fblob\u002Fmain\u002F.claude\u002F_archive\u002Fskills\u002Fv3-core-implementation\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: \"V3 Core Implementation\"\ndescription: \"Core module implementation for claude-flow v3. Implements DDD domains, clean architecture patterns, dependency injection, and modular TypeScript codebase with comprehensive testing.\"\n---\n\n# V3 Core Implementation\n\n## What This Skill Does\n\nImplements the core TypeScript modules for claude-flow v3 following Domain-Driven Design principles, clean architecture patterns, and modern TypeScript best practices with comprehensive test coverage.\n\n## Quick Start\n\n```bash\n# Initialize core implementation\nTask(\"Core foundation\", \"Set up DDD domain structure and base classes\", \"core-implementer\")\n\n# Domain implementation (parallel)\nTask(\"Task domain\", \"Implement task management domain with entities and services\", \"core-implementer\")\nTask(\"Session domain\", \"Implement session management domain\", \"core-implementer\")\nTask(\"Health domain\", \"Implement health monitoring domain\", \"core-implementer\")\n```\n\n## Core Implementation Architecture\n\n### Domain Structure\n```\nsrc\u002F\n├── core\u002F\n│   ├── kernel\u002F                     # Microkernel pattern\n│   │   ├── claude-flow-kernel.ts\n│   │   ├── domain-registry.ts\n│   │   └── plugin-loader.ts\n│   │\n│   ├── domains\u002F                    # DDD Bounded Contexts\n│   │   ├── task-management\u002F\n│   │   │   ├── entities\u002F\n│   │   │   ├── value-objects\u002F\n│   │   │   ├── services\u002F\n│   │   │   ├── repositories\u002F\n│   │   │   └── events\u002F\n│   │   │\n│   │   ├── session-management\u002F\n│   │   ├── health-monitoring\u002F\n│   │   ├── lifecycle-management\u002F\n│   │   └── event-coordination\u002F\n│   │\n│   ├── shared\u002F                     # Shared kernel\n│   │   ├── domain\u002F\n│   │   │   ├── entity.ts\n│   │   │   ├── value-object.ts\n│   │   │   ├── domain-event.ts\n│   │   │   └── aggregate-root.ts\n│   │   │\n│   │   ├── infrastructure\u002F\n│   │   │   ├── event-bus.ts\n│   │   │   ├── dependency-container.ts\n│   │   │   └── logger.ts\n│   │   │\n│   │   └── types\u002F\n│   │       ├── common.ts\n│   │       ├── errors.ts\n│   │       └── interfaces.ts\n│   │\n│   └── application\u002F                # Application services\n│       ├── use-cases\u002F\n│       ├── commands\u002F\n│       ├── queries\u002F\n│       └── handlers\u002F\n```\n\n## Base Domain Classes\n\n### Entity Base Class\n```typescript\n\u002F\u002F src\u002Fcore\u002Fshared\u002Fdomain\u002Fentity.ts\nexport abstract class Entity\u003CT> {\n  protected readonly _id: T;\n  private _domainEvents: DomainEvent[] = [];\n\n  constructor(id: T) {\n    this._id = id;\n  }\n\n  get id(): T {\n    return this._id;\n  }\n\n  public equals(object?: Entity\u003CT>): boolean {\n    if (object == null || object == undefined) {\n      return false;\n    }\n\n    if (this === object) {\n      return true;\n    }\n\n    if (!(object instanceof Entity)) {\n      return false;\n    }\n\n    return this._id === object._id;\n  }\n\n  protected addDomainEvent(domainEvent: DomainEvent): void {\n    this._domainEvents.push(domainEvent);\n  }\n\n  public getUncommittedEvents(): DomainEvent[] {\n    return this._domainEvents;\n  }\n\n  public markEventsAsCommitted(): void {\n    this._domainEvents = [];\n  }\n}\n```\n\n### Value Object Base Class\n```typescript\n\u002F\u002F src\u002Fcore\u002Fshared\u002Fdomain\u002Fvalue-object.ts\nexport abstract class ValueObject\u003CT> {\n  protected readonly props: T;\n\n  constructor(props: T) {\n    this.props = Object.freeze(props);\n  }\n\n  public equals(object?: ValueObject\u003CT>): boolean {\n    if (object == null || object == undefined) {\n      return false;\n    }\n\n    if (this === object) {\n      return true;\n    }\n\n    return JSON.stringify(this.props) === JSON.stringify(object.props);\n  }\n\n  get value(): T {\n    return this.props;\n  }\n}\n```\n\n### Aggregate Root\n```typescript\n\u002F\u002F src\u002Fcore\u002Fshared\u002Fdomain\u002Faggregate-root.ts\nexport abstract class AggregateRoot\u003CT> extends Entity\u003CT> {\n  private _version: number = 0;\n\n  get version(): number {\n    return this._version;\n  }\n\n  protected incrementVersion(): void {\n    this._version++;\n  }\n\n  public applyEvent(event: DomainEvent): void {\n    this.addDomainEvent(event);\n    this.incrementVersion();\n  }\n}\n```\n\n## Task Management Domain Implementation\n\n### Task Entity\n```typescript\n\u002F\u002F src\u002Fcore\u002Fdomains\u002Ftask-management\u002Fentities\u002Ftask.entity.ts\nimport { AggregateRoot } from '..\u002F..\u002F..\u002Fshared\u002Fdomain\u002Faggregate-root';\nimport { TaskId } from '..\u002Fvalue-objects\u002Ftask-id.vo';\nimport { TaskStatus } from '..\u002Fvalue-objects\u002Ftask-status.vo';\nimport { Priority } from '..\u002Fvalue-objects\u002Fpriority.vo';\nimport { TaskAssignedEvent } from '..\u002Fevents\u002Ftask-assigned.event';\n\ninterface TaskProps {\n  id: TaskId;\n  description: string;\n  priority: Priority;\n  status: TaskStatus;\n  assignedAgentId?: string;\n  createdAt: Date;\n  updatedAt: Date;\n}\n\nexport class Task extends AggregateRoot\u003CTaskId> {\n  private props: TaskProps;\n\n  private constructor(props: TaskProps) {\n    super(props.id);\n    this.props = props;\n  }\n\n  static create(description: string, priority: Priority): Task {\n    const task = new Task({\n      id: TaskId.create(),\n      description,\n      priority,\n      status: TaskStatus.pending(),\n      createdAt: new Date(),\n      updatedAt: new Date()\n    });\n\n    return task;\n  }\n\n  static reconstitute(props: TaskProps): Task {\n    return new Task(props);\n  }\n\n  public assignTo(agentId: string): void {\n    if (this.props.status.equals(TaskStatus.completed())) {\n      throw new Error('Cannot assign completed task');\n    }\n\n    this.props.assignedAgentId = agentId;\n    this.props.status = TaskStatus.assigned();\n    this.props.updatedAt = new Date();\n\n    this.applyEvent(new TaskAssignedEvent(\n      this.id.value,\n      agentId,\n      this.props.priority\n    ));\n  }\n\n  public complete(result: TaskResult): void {\n    if (!this.props.assignedAgentId) {\n      throw new Error('Cannot complete unassigned task');\n    }\n\n    this.props.status = TaskStatus.completed();\n    this.props.updatedAt = new Date();\n\n    this.applyEvent(new TaskCompletedEvent(\n      this.id.value,\n      result,\n      this.calculateDuration()\n    ));\n  }\n\n  \u002F\u002F Getters\n  get description(): string { return this.props.description; }\n  get priority(): Priority { return this.props.priority; }\n  get status(): TaskStatus { return this.props.status; }\n  get assignedAgentId(): string | undefined { return this.props.assignedAgentId; }\n  get createdAt(): Date { return this.props.createdAt; }\n  get updatedAt(): Date { return this.props.updatedAt; }\n\n  private calculateDuration(): number {\n    return this.props.updatedAt.getTime() - this.props.createdAt.getTime();\n  }\n}\n```\n\n### Task Value Objects\n```typescript\n\u002F\u002F src\u002Fcore\u002Fdomains\u002Ftask-management\u002Fvalue-objects\u002Ftask-id.vo.ts\nexport class TaskId extends ValueObject\u003Cstring> {\n  private constructor(value: string) {\n    super({ value });\n  }\n\n  static create(): TaskId {\n    return new TaskId(crypto.randomUUID());\n  }\n\n  static fromString(id: string): TaskId {\n    if (!id || id.length === 0) {\n      throw new Error('TaskId cannot be empty');\n    }\n    return new TaskId(id);\n  }\n\n  get value(): string {\n    return this.props.value;\n  }\n}\n\n\u002F\u002F src\u002Fcore\u002Fdomains\u002Ftask-management\u002Fvalue-objects\u002Ftask-status.vo.ts\ntype TaskStatusType = 'pending' | 'assigned' | 'in_progress' | 'completed' | 'failed';\n\nexport class TaskStatus extends ValueObject\u003CTaskStatusType> {\n  private constructor(status: TaskStatusType) {\n    super({ value: status });\n  }\n\n  static pending(): TaskStatus { return new TaskStatus('pending'); }\n  static assigned(): TaskStatus { return new TaskStatus('assigned'); }\n  static inProgress(): TaskStatus { return new TaskStatus('in_progress'); }\n  static completed(): TaskStatus { return new TaskStatus('completed'); }\n  static failed(): TaskStatus { return new TaskStatus('failed'); }\n\n  get value(): TaskStatusType {\n    return this.props.value;\n  }\n\n  public isPending(): boolean { return this.value === 'pending'; }\n  public isAssigned(): boolean { return this.value === 'assigned'; }\n  public isInProgress(): boolean { return this.value === 'in_progress'; }\n  public isCompleted(): boolean { return this.value === 'completed'; }\n  public isFailed(): boolean { return this.value === 'failed'; }\n}\n\n\u002F\u002F src\u002Fcore\u002Fdomains\u002Ftask-management\u002Fvalue-objects\u002Fpriority.vo.ts\ntype PriorityLevel = 'low' | 'medium' | 'high' | 'critical';\n\nexport class Priority extends ValueObject\u003CPriorityLevel> {\n  private constructor(level: PriorityLevel) {\n    super({ value: level });\n  }\n\n  static low(): Priority { return new Priority('low'); }\n  static medium(): Priority { return new Priority('medium'); }\n  static high(): Priority { return new Priority('high'); }\n  static critical(): Priority { return new Priority('critical'); }\n\n  get value(): PriorityLevel {\n    return this.props.value;\n  }\n\n  public getNumericValue(): number {\n    const priorities = { low: 1, medium: 2, high: 3, critical: 4 };\n    return priorities[this.value];\n  }\n}\n```\n\n## Domain Services\n\n### Task Scheduling Service\n```typescript\n\u002F\u002F src\u002Fcore\u002Fdomains\u002Ftask-management\u002Fservices\u002Ftask-scheduling.service.ts\nimport { Injectable } from '..\u002F..\u002F..\u002Fshared\u002Finfrastructure\u002Fdependency-container';\nimport { Task } from '..\u002Fentities\u002Ftask.entity';\nimport { Priority } from '..\u002Fvalue-objects\u002Fpriority.vo';\n\n@Injectable()\nexport class TaskSchedulingService {\n  public prioritizeTasks(tasks: Task[]): Task[] {\n    return tasks.sort((a, b) =>\n      b.priority.getNumericValue() - a.priority.getNumericValue()\n    );\n  }\n\n  public canSchedule(task: Task, agentCapacity: number): boolean {\n    if (agentCapacity \u003C= 0) return false;\n\n    \u002F\u002F Critical tasks always schedulable\n    if (task.priority.equals(Priority.critical())) return true;\n\n    \u002F\u002F Other logic based on capacity\n    return true;\n  }\n\n  public calculateEstimatedDuration(task: Task): number {\n    \u002F\u002F Simple heuristic - would use ML in real implementation\n    const baseTime = 300000; \u002F\u002F 5 minutes\n    const priorityMultiplier = {\n      low: 0.5,\n      medium: 1.0,\n      high: 1.5,\n      critical: 2.0\n    };\n\n    return baseTime * priorityMultiplier[task.priority.value];\n  }\n}\n```\n\n## Repository Interfaces & Implementations\n\n### Task Repository Interface\n```typescript\n\u002F\u002F src\u002Fcore\u002Fdomains\u002Ftask-management\u002Frepositories\u002Ftask.repository.ts\nexport interface ITaskRepository {\n  save(task: Task): Promise\u003Cvoid>;\n  findById(id: TaskId): Promise\u003CTask | null>;\n  findByAgentId(agentId: string): Promise\u003CTask[]>;\n  findByStatus(status: TaskStatus): Promise\u003CTask[]>;\n  findPendingTasks(): Promise\u003CTask[]>;\n  delete(id: TaskId): Promise\u003Cvoid>;\n}\n```\n\n### SQLite Implementation\n```typescript\n\u002F\u002F src\u002Fcore\u002Fdomains\u002Ftask-management\u002Frepositories\u002Fsqlite-task.repository.ts\n@Injectable()\nexport class SqliteTaskRepository implements ITaskRepository {\n  constructor(\n    @Inject('Database') private db: Database,\n    @Inject('Logger') private logger: ILogger\n  ) {}\n\n  async save(task: Task): Promise\u003Cvoid> {\n    const sql = `\n      INSERT OR REPLACE INTO tasks (\n        id, description, priority, status, assigned_agent_id, created_at, updated_at\n      ) VALUES (?, ?, ?, ?, ?, ?, ?)\n    `;\n\n    await this.db.run(sql, [\n      task.id.value,\n      task.description,\n      task.priority.value,\n      task.status.value,\n      task.assignedAgentId,\n      task.createdAt.toISOString(),\n      task.updatedAt.toISOString()\n    ]);\n\n    this.logger.debug(`Task saved: ${task.id.value}`);\n  }\n\n  async findById(id: TaskId): Promise\u003CTask | null> {\n    const sql = 'SELECT * FROM tasks WHERE id = ?';\n    const row = await this.db.get(sql, [id.value]);\n\n    return row ? this.mapRowToTask(row) : null;\n  }\n\n  async findPendingTasks(): Promise\u003CTask[]> {\n    const sql = 'SELECT * FROM tasks WHERE status = ? ORDER BY priority DESC, created_at ASC';\n    const rows = await this.db.all(sql, ['pending']);\n\n    return rows.map(row => this.mapRowToTask(row));\n  }\n\n  private mapRowToTask(row: any): Task {\n    return Task.reconstitute({\n      id: TaskId.fromString(row.id),\n      description: row.description,\n      priority: Priority.fromString(row.priority),\n      status: TaskStatus.fromString(row.status),\n      assignedAgentId: row.assigned_agent_id,\n      createdAt: new Date(row.created_at),\n      updatedAt: new Date(row.updated_at)\n    });\n  }\n}\n```\n\n## Application Layer\n\n### Use Case Implementation\n```typescript\n\u002F\u002F src\u002Fcore\u002Fapplication\u002Fuse-cases\u002Fassign-task.use-case.ts\n@Injectable()\nexport class AssignTaskUseCase {\n  constructor(\n    @Inject('TaskRepository') private taskRepository: ITaskRepository,\n    @Inject('AgentRepository') private agentRepository: IAgentRepository,\n    @Inject('DomainEventBus') private eventBus: DomainEventBus,\n    @Inject('Logger') private logger: ILogger\n  ) {}\n\n  async execute(command: AssignTaskCommand): Promise\u003CAssignTaskResult> {\n    try {\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      if (!task) {\n        throw new TaskNotFoundError(command.taskId);\n      }\n\n      const agent = await this.agentRepository.findById(command.agentId);\n      if (!agent) {\n        throw new AgentNotFoundError(command.agentId);\n      }\n\n      \u002F\u002F 3. Business logic\n      if (!agent.canAcceptTask(task)) {\n        throw new AgentCannotAcceptTaskError(command.agentId, command.taskId);\n      }\n\n      task.assignTo(command.agentId);\n      agent.acceptTask(task.id);\n\n      \u002F\u002F 4. Persist changes\n      await Promise.all([\n        this.taskRepository.save(task),\n        this.agentRepository.save(agent)\n      ]);\n\n      \u002F\u002F 5. Publish domain events\n      const events = [\n        ...task.getUncommittedEvents(),\n        ...agent.getUncommittedEvents()\n      ];\n\n      for (const event of events) {\n        await this.eventBus.publish(event);\n      }\n\n      task.markEventsAsCommitted();\n      agent.markEventsAsCommitted();\n\n      \u002F\u002F 6. Return result\n      this.logger.info(`Task ${command.taskId.value} assigned to agent ${command.agentId}`);\n\n      return AssignTaskResult.success({\n        taskId: task.id,\n        agentId: command.agentId,\n        assignedAt: new Date()\n      });\n\n    } catch (error) {\n      this.logger.error(`Failed to assign task ${command.taskId.value}:`, error);\n      return AssignTaskResult.failure(error);\n    }\n  }\n\n  private async validateCommand(command: AssignTaskCommand): Promise\u003Cvoid> {\n    if (!command.taskId) {\n      throw new ValidationError('Task ID is required');\n    }\n    if (!command.agentId) {\n      throw new ValidationError('Agent ID is required');\n    }\n  }\n}\n```\n\n## Dependency Injection Setup\n\n### Container Configuration\n```typescript\n\u002F\u002F src\u002Fcore\u002Fshared\u002Finfrastructure\u002Fdependency-container.ts\nimport { Container } from 'inversify';\nimport { TYPES } from '.\u002Ftypes';\n\nexport class DependencyContainer {\n  private container: Container;\n\n  constructor() {\n    this.container = new Container();\n    this.setupBindings();\n  }\n\n  private setupBindings(): void {\n    \u002F\u002F Repositories\n    this.container.bind\u003CITaskRepository>(TYPES.TaskRepository)\n      .to(SqliteTaskRepository)\n      .inSingletonScope();\n\n    this.container.bind\u003CIAgentRepository>(TYPES.AgentRepository)\n      .to(SqliteAgentRepository)\n      .inSingletonScope();\n\n    \u002F\u002F Services\n    this.container.bind\u003CTaskSchedulingService>(TYPES.TaskSchedulingService)\n      .to(TaskSchedulingService)\n      .inSingletonScope();\n\n    \u002F\u002F Use Cases\n    this.container.bind\u003CAssignTaskUseCase>(TYPES.AssignTaskUseCase)\n      .to(AssignTaskUseCase)\n      .inSingletonScope();\n\n    \u002F\u002F Infrastructure\n    this.container.bind\u003CILogger>(TYPES.Logger)\n      .to(ConsoleLogger)\n      .inSingletonScope();\n\n    this.container.bind\u003CDomainEventBus>(TYPES.DomainEventBus)\n      .to(InMemoryDomainEventBus)\n      .inSingletonScope();\n  }\n\n  get\u003CT>(serviceIdentifier: symbol): T {\n    return this.container.get\u003CT>(serviceIdentifier);\n  }\n\n  bind\u003CT>(serviceIdentifier: symbol): BindingToSyntax\u003CT> {\n    return this.container.bind\u003CT>(serviceIdentifier);\n  }\n}\n```\n\n## Modern TypeScript Configuration\n\n### Strict TypeScript Setup\n```json\n\u002F\u002F tsconfig.json\n{\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"lib\": [\"ES2022\"],\n    \"module\": \"NodeNext\",\n    \"moduleResolution\": \"NodeNext\",\n    \"declaration\": true,\n    \"outDir\": \".\u002Fdist\",\n    \"strict\": true,\n    \"exactOptionalPropertyTypes\": true,\n    \"noImplicitReturns\": true,\n    \"noFallthroughCasesInSwitch\": true,\n    \"noUncheckedIndexedAccess\": true,\n    \"noImplicitOverride\": true,\n    \"experimentalDecorators\": true,\n    \"emitDecoratorMetadata\": true,\n    \"skipLibCheck\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"resolveJsonModule\": true,\n    \"esModuleInterop\": true,\n    \"allowSyntheticDefaultImports\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"@\u002F*\": [\"src\u002F*\"],\n      \"@core\u002F*\": [\"src\u002Fcore\u002F*\"],\n      \"@shared\u002F*\": [\"src\u002Fcore\u002Fshared\u002F*\"],\n      \"@domains\u002F*\": [\"src\u002Fcore\u002Fdomains\u002F*\"]\n    }\n  },\n  \"include\": [\"src\u002F**\u002F*\"],\n  \"exclude\": [\"node_modules\", \"dist\", \"**\u002F*.test.ts\", \"**\u002F*.spec.ts\"]\n}\n```\n\n## Testing Implementation\n\n### Domain Unit Tests\n```typescript\n\u002F\u002F src\u002Fcore\u002Fdomains\u002Ftask-management\u002F__tests__\u002Fentities\u002Ftask.entity.test.ts\ndescribe('Task Entity', () => {\n  let task: Task;\n\n  beforeEach(() => {\n    task = Task.create('Test task', Priority.medium());\n  });\n\n  describe('creation', () => {\n    it('should create task with pending status', () => {\n      expect(task.status.isPending()).toBe(true);\n      expect(task.description).toBe('Test task');\n      expect(task.priority.equals(Priority.medium())).toBe(true);\n    });\n\n    it('should generate unique ID', () => {\n      const task1 = Task.create('Task 1', Priority.low());\n      const task2 = Task.create('Task 2', Priority.low());\n\n      expect(task1.id.equals(task2.id)).toBe(false);\n    });\n  });\n\n  describe('assignment', () => {\n    it('should assign to agent and change status', () => {\n      const agentId = 'agent-123';\n\n      task.assignTo(agentId);\n\n      expect(task.assignedAgentId).toBe(agentId);\n      expect(task.status.isAssigned()).toBe(true);\n    });\n\n    it('should emit TaskAssignedEvent when assigned', () => {\n      const agentId = 'agent-123';\n\n      task.assignTo(agentId);\n\n      const events = task.getUncommittedEvents();\n      expect(events).toHaveLength(1);\n      expect(events[0]).toBeInstanceOf(TaskAssignedEvent);\n    });\n\n    it('should not allow assignment of completed task', () => {\n      task.assignTo('agent-123');\n      task.complete(TaskResult.success('done'));\n\n      expect(() => task.assignTo('agent-456'))\n        .toThrow('Cannot assign completed task');\n    });\n  });\n});\n```\n\n### Integration Tests\n```typescript\n\u002F\u002F src\u002Fcore\u002Fdomains\u002Ftask-management\u002F__tests__\u002Fintegration\u002Ftask-repository.integration.test.ts\ndescribe('TaskRepository Integration', () => {\n  let repository: SqliteTaskRepository;\n  let db: Database;\n\n  beforeEach(async () => {\n    db = new Database(':memory:');\n    await setupTasksTable(db);\n    repository = new SqliteTaskRepository(db, new ConsoleLogger());\n  });\n\n  afterEach(async () => {\n    await db.close();\n  });\n\n  it('should save and retrieve task', async () => {\n    const task = Task.create('Test task', Priority.high());\n\n    await repository.save(task);\n    const retrieved = await repository.findById(task.id);\n\n    expect(retrieved).toBeDefined();\n    expect(retrieved!.id.equals(task.id)).toBe(true);\n    expect(retrieved!.description).toBe('Test task');\n    expect(retrieved!.priority.equals(Priority.high())).toBe(true);\n  });\n\n  it('should find pending tasks ordered by priority', async () => {\n    const lowTask = Task.create('Low priority', Priority.low());\n    const highTask = Task.create('High priority', Priority.high());\n\n    await repository.save(lowTask);\n    await repository.save(highTask);\n\n    const pending = await repository.findPendingTasks();\n\n    expect(pending).toHaveLength(2);\n    expect(pending[0].id.equals(highTask.id)).toBe(true); \u002F\u002F High priority first\n    expect(pending[1].id.equals(lowTask.id)).toBe(true);\n  });\n});\n```\n\n## Performance Optimizations\n\n### Entity Caching\n```typescript\n\u002F\u002F src\u002Fcore\u002Fshared\u002Finfrastructure\u002Fentity-cache.ts\n@Injectable()\nexport class EntityCache\u003CT extends Entity\u003Cany>> {\n  private cache = new Map\u003Cstring, { entity: T; timestamp: number }>();\n  private readonly ttl: number = 300000; \u002F\u002F 5 minutes\n\n  set(id: string, entity: T): void {\n    this.cache.set(id, { entity, timestamp: Date.now() });\n  }\n\n  get(id: string): T | null {\n    const cached = this.cache.get(id);\n    if (!cached) return null;\n\n    \u002F\u002F Check TTL\n    if (Date.now() - cached.timestamp > this.ttl) {\n      this.cache.delete(id);\n      return null;\n    }\n\n    return cached.entity;\n  }\n\n  invalidate(id: string): void {\n    this.cache.delete(id);\n  }\n\n  clear(): void {\n    this.cache.clear();\n  }\n}\n```\n\n## Success Metrics\n\n- [ ] **Domain Isolation**: 100% clean dependency boundaries\n- [ ] **Test Coverage**: >90% unit test coverage for domain logic\n- [ ] **Type Safety**: Strict TypeScript compilation with zero any types\n- [ ] **Performance**: \u003C50ms average use case execution time\n- [ ] **Memory Efficiency**: \u003C100MB heap usage for core domains\n- [ ] **Plugin Architecture**: Modular domain loading capability\n\n## Related V3 Skills\n\n- `v3-ddd-architecture` - DDD architectural design\n- `v3-mcp-optimization` - MCP server integration\n- `v3-memory-unification` - AgentDB repository integration\n- `v3-swarm-coordination` - Swarm domain implementation\n\n## Usage Examples\n\n### Complete Core Implementation\n```bash\n# Full core module implementation\nTask(\"Core implementation\",\n     \"Implement all core domains with DDD patterns and comprehensive testing\",\n     \"core-implementer\")\n```\n\n### Domain-Specific Implementation\n```bash\n# Single domain implementation\nTask(\"Task domain implementation\",\n     \"Implement task management domain with entities, services, and repositories\",\n     \"core-implementer\")\n```","# V3 Core Implementation\n\n## What This Skill Does\n\nImplements the core TypeScript modules for claude-flow v3 following Domain-Driven Design principles, clean architecture patterns, and modern TypeScript best practices with comprehensive test coverage.\n\n## Quick Start\n\n```bash\n# Initialize core implementation\nTask(\"Core foundation\", \"Set up DDD domain structure and base classes\", \"core-implementer\")\n\n# Domain implementation (parallel)\nTask(\"Task domain\", \"Implement task management domain with entities and services\", \"core-implementer\")\nTask(\"Session domain\", \"Implement session management domain\", \"core-implementer\")\nTask(\"Health domain\", \"Implement health monitoring domain\", \"core-implementer\")\n```\n\n## Core Implementation Architecture\n\n### Domain Structure\n```\nsrc\u002F\n├── core\u002F\n│   ├── kernel\u002F                     # Microkernel pattern\n│   │   ├── claude-flow-kernel.ts\n│   │   ├── domain-registry.ts\n│   │   └── plugin-loader.ts\n│   │\n│   ├── domains\u002F                    # DDD Bounded Contexts\n│   │   ├── task-management\u002F\n│   │   │   ├── entities\u002F\n│   │   │   ├── value-objects\u002F\n│   │   │   ├── services\u002F\n│   │   │   ├── repositories\u002F\n│   │   │   └── events\u002F\n│   │   │\n│   │   ├── session-management\u002F\n│   │   ├── health-monitoring\u002F\n│   │   ├── lifecycle-management\u002F\n│   │   └── event-coordination\u002F\n│   │\n│   ├── shared\u002F                     # Shared kernel\n│   │   ├── domain\u002F\n│   │   │   ├── entity.ts\n│   │   │   ├── value-object.ts\n│   │   │   ├── domain-event.ts\n│   │   │   └── aggregate-root.ts\n│   │   │\n│   │   ├── infrastructure\u002F\n│   │   │   ├── event-bus.ts\n│   │   │   ├── dependency-container.ts\n│   │   │   └── logger.ts\n│   │   │\n│   │   └── types\u002F\n│   │       ├── common.ts\n│   │       ├── errors.ts\n│   │       └── interfaces.ts\n│   │\n│   └── application\u002F                # Application services\n│       ├── use-cases\u002F\n│       ├── commands\u002F\n│       ├── queries\u002F\n│       └── handlers\u002F\n```\n\n## Base Domain Classes\n\n### Entity Base Class\n```typescript\n\u002F\u002F src\u002Fcore\u002Fshared\u002Fdomain\u002Fentity.ts\nexport abstract class Entity\u003CT> {\n  protected readonly _id: T;\n  private _domainEvents: DomainEvent[] = [];\n\n  constructor(id: T) {\n    this._id = id;\n  }\n\n  get id(): T {\n    return this._id;\n  }\n\n  public equals(object?: Entity\u003CT>): boolean {\n    if (object == null || object == undefined) {\n      return false;\n    }\n\n    if (this === object) {\n      return true;\n    }\n\n    if (!(object instanceof Entity)) {\n      return false;\n    }\n\n    return this._id === object._id;\n  }\n\n  protected addDomainEvent(domainEvent: DomainEvent): void {\n    this._domainEvents.push(domainEvent);\n  }\n\n  public getUncommittedEvents(): DomainEvent[] {\n    return this._domainEvents;\n  }\n\n  public markEventsAsCommitted(): void {\n    this._domainEvents = [];\n  }\n}\n```\n\n### Value Object Base Class\n```typescript\n\u002F\u002F src\u002Fcore\u002Fshared\u002Fdomain\u002Fvalue-object.ts\nexport abstract class ValueObject\u003CT> {\n  protected readonly props: T;\n\n  constructor(props: T) {\n    this.props = Object.freeze(props);\n  }\n\n  public equals(object?: ValueObject\u003CT>): boolean {\n    if (object == null || object == undefined) {\n      return false;\n    }\n\n    if (this === object) {\n      return true;\n    }\n\n    return JSON.stringify(this.props) === JSON.stringify(object.props);\n  }\n\n  get value(): T {\n    return this.props;\n  }\n}\n```\n\n### Aggregate Root\n```typescript\n\u002F\u002F src\u002Fcore\u002Fshared\u002Fdomain\u002Faggregate-root.ts\nexport abstract class AggregateRoot\u003CT> extends Entity\u003CT> {\n  private _version: number = 0;\n\n  get version(): number {\n    return this._version;\n  }\n\n  protected incrementVersion(): void {\n    this._version++;\n  }\n\n  public applyEvent(event: DomainEvent): void {\n    this.addDomainEvent(event);\n    this.incrementVersion();\n  }\n}\n```\n\n## Task Management Domain Implementation\n\n### Task Entity\n```typescript\n\u002F\u002F src\u002Fcore\u002Fdomains\u002Ftask-management\u002Fentities\u002Ftask.entity.ts\nimport { AggregateRoot } from '..\u002F..\u002F..\u002Fshared\u002Fdomain\u002Faggregate-root';\nimport { TaskId } from '..\u002Fvalue-objects\u002Ftask-id.vo';\nimport { TaskStatus } from '..\u002Fvalue-objects\u002Ftask-status.vo';\nimport { Priority } from '..\u002Fvalue-objects\u002Fpriority.vo';\nimport { TaskAssignedEvent } from '..\u002Fevents\u002Ftask-assigned.event';\n\ninterface TaskProps {\n  id: TaskId;\n  description: string;\n  priority: Priority;\n  status: TaskStatus;\n  assignedAgentId?: string;\n  createdAt: Date;\n  updatedAt: Date;\n}\n\nexport class Task extends AggregateRoot\u003CTaskId> {\n  private props: TaskProps;\n\n  private constructor(props: TaskProps) {\n    super(props.id);\n    this.props = props;\n  }\n\n  static create(description: string, priority: Priority): Task {\n    const task = new Task({\n      id: TaskId.create(),\n      description,\n      priority,\n      status: TaskStatus.pending(),\n      createdAt: new Date(),\n      updatedAt: new Date()\n    });\n\n    return task;\n  }\n\n  static reconstitute(props: TaskProps): Task {\n    return new Task(props);\n  }\n\n  public assignTo(agentId: string): void {\n    if (this.props.status.equals(TaskStatus.completed())) {\n      throw new Error('Cannot assign completed task');\n    }\n\n    this.props.assignedAgentId = agentId;\n    this.props.status = TaskStatus.assigned();\n    this.props.updatedAt = new Date();\n\n    this.applyEvent(new TaskAssignedEvent(\n      this.id.value,\n      agentId,\n      this.props.priority\n    ));\n  }\n\n  public complete(result: TaskResult): void {\n    if (!this.props.assignedAgentId) {\n      throw new Error('Cannot complete unassigned task');\n    }\n\n    this.props.status = TaskStatus.completed();\n    this.props.updatedAt = new Date();\n\n    this.applyEvent(new TaskCompletedEvent(\n      this.id.value,\n      result,\n      this.calculateDuration()\n    ));\n  }\n\n  \u002F\u002F Getters\n  get description(): string { return this.props.description; }\n  get priority(): Priority { return this.props.priority; }\n  get status(): TaskStatus { return this.props.status; }\n  get assignedAgentId(): string | undefined { return this.props.assignedAgentId; }\n  get createdAt(): Date { return this.props.createdAt; }\n  get updatedAt(): Date { return this.props.updatedAt; }\n\n  private calculateDuration(): number {\n    return this.props.updatedAt.getTime() - this.props.createdAt.getTime();\n  }\n}\n```\n\n### Task Value Objects\n```typescript\n\u002F\u002F src\u002Fcore\u002Fdomains\u002Ftask-management\u002Fvalue-objects\u002Ftask-id.vo.ts\nexport class TaskId extends ValueObject\u003Cstring> {\n  private constructor(value: string) {\n    super({ value });\n  }\n\n  static create(): TaskId {\n    return new TaskId(crypto.randomUUID());\n  }\n\n  static fromString(id: string): TaskId {\n    if (!id || id.length === 0) {\n      throw new Error('TaskId cannot be empty');\n    }\n    return new TaskId(id);\n  }\n\n  get value(): string {\n    return this.props.value;\n  }\n}\n\n\u002F\u002F src\u002Fcore\u002Fdomains\u002Ftask-management\u002Fvalue-objects\u002Ftask-status.vo.ts\ntype TaskStatusType = 'pending' | 'assigned' | 'in_progress' | 'completed' | 'failed';\n\nexport class TaskStatus extends ValueObject\u003CTaskStatusType> {\n  private constructor(status: TaskStatusType) {\n    super({ value: status });\n  }\n\n  static pending(): TaskStatus { return new TaskStatus('pending'); }\n  static assigned(): TaskStatus { return new TaskStatus('assigned'); }\n  static inProgress(): TaskStatus { return new TaskStatus('in_progress'); }\n  static completed(): TaskStatus { return new TaskStatus('completed'); }\n  static failed(): TaskStatus { return new TaskStatus('failed'); }\n\n  get value(): TaskStatusType {\n    return this.props.value;\n  }\n\n  public isPending(): boolean { return this.value === 'pending'; }\n  public isAssigned(): boolean { return this.value === 'assigned'; }\n  public isInProgress(): boolean { return this.value === 'in_progress'; }\n  public isCompleted(): boolean { return this.value === 'completed'; }\n  public isFailed(): boolean { return this.value === 'failed'; }\n}\n\n\u002F\u002F src\u002Fcore\u002Fdomains\u002Ftask-management\u002Fvalue-objects\u002Fpriority.vo.ts\ntype PriorityLevel = 'low' | 'medium' | 'high' | 'critical';\n\nexport class Priority extends ValueObject\u003CPriorityLevel> {\n  private constructor(level: PriorityLevel) {\n    super({ value: level });\n  }\n\n  static low(): Priority { return new Priority('low'); }\n  static medium(): Priority { return new Priority('medium'); }\n  static high(): Priority { return new Priority('high'); }\n  static critical(): Priority { return new Priority('critical'); }\n\n  get value(): PriorityLevel {\n    return this.props.value;\n  }\n\n  public getNumericValue(): number {\n    const priorities = { low: 1, medium: 2, high: 3, critical: 4 };\n    return priorities[this.value];\n  }\n}\n```\n\n## Domain Services\n\n### Task Scheduling Service\n```typescript\n\u002F\u002F src\u002Fcore\u002Fdomains\u002Ftask-management\u002Fservices\u002Ftask-scheduling.service.ts\nimport { Injectable } from '..\u002F..\u002F..\u002Fshared\u002Finfrastructure\u002Fdependency-container';\nimport { Task } from '..\u002Fentities\u002Ftask.entity';\nimport { Priority } from '..\u002Fvalue-objects\u002Fpriority.vo';\n\n@Injectable()\nexport class TaskSchedulingService {\n  public prioritizeTasks(tasks: Task[]): Task[] {\n    return tasks.sort((a, b) =>\n      b.priority.getNumericValue() - a.priority.getNumericValue()\n    );\n  }\n\n  public canSchedule(task: Task, agentCapacity: number): boolean {\n    if (agentCapacity \u003C= 0) return false;\n\n    \u002F\u002F Critical tasks always schedulable\n    if (task.priority.equals(Priority.critical())) return true;\n\n    \u002F\u002F Other logic based on capacity\n    return true;\n  }\n\n  public calculateEstimatedDuration(task: Task): number {\n    \u002F\u002F Simple heuristic - would use ML in real implementation\n    const baseTime = 300000; \u002F\u002F 5 minutes\n    const priorityMultiplier = {\n      low: 0.5,\n      medium: 1.0,\n      high: 1.5,\n      critical: 2.0\n    };\n\n    return baseTime * priorityMultiplier[task.priority.value];\n  }\n}\n```\n\n## Repository Interfaces & Implementations\n\n### Task Repository Interface\n```typescript\n\u002F\u002F src\u002Fcore\u002Fdomains\u002Ftask-management\u002Frepositories\u002Ftask.repository.ts\nexport interface ITaskRepository {\n  save(task: Task): Promise\u003Cvoid>;\n  findById(id: TaskId): Promise\u003CTask | null>;\n  findByAgentId(agentId: string): Promise\u003CTask[]>;\n  findByStatus(status: TaskStatus): Promise\u003CTask[]>;\n  findPendingTasks(): Promise\u003CTask[]>;\n  delete(id: TaskId): Promise\u003Cvoid>;\n}\n```\n\n### SQLite Implementation\n```typescript\n\u002F\u002F src\u002Fcore\u002Fdomains\u002Ftask-management\u002Frepositories\u002Fsqlite-task.repository.ts\n@Injectable()\nexport class SqliteTaskRepository implements ITaskRepository {\n  constructor(\n    @Inject('Database') private db: Database,\n    @Inject('Logger') private logger: ILogger\n  ) {}\n\n  async save(task: Task): Promise\u003Cvoid> {\n    const sql = `\n      INSERT OR REPLACE INTO tasks (\n        id, description, priority, status, assigned_agent_id, created_at, updated_at\n      ) VALUES (?, ?, ?, ?, ?, ?, ?)\n    `;\n\n    await this.db.run(sql, [\n      task.id.value,\n      task.description,\n      task.priority.value,\n      task.status.value,\n      task.assignedAgentId,\n      task.createdAt.toISOString(),\n      task.updatedAt.toISOString()\n    ]);\n\n    this.logger.debug(`Task saved: ${task.id.value}`);\n  }\n\n  async findById(id: TaskId): Promise\u003CTask | null> {\n    const sql = 'SELECT * FROM tasks WHERE id = ?';\n    const row = await this.db.get(sql, [id.value]);\n\n    return row ? this.mapRowToTask(row) : null;\n  }\n\n  async findPendingTasks(): Promise\u003CTask[]> {\n    const sql = 'SELECT * FROM tasks WHERE status = ? ORDER BY priority DESC, created_at ASC';\n    const rows = await this.db.all(sql, ['pending']);\n\n    return rows.map(row => this.mapRowToTask(row));\n  }\n\n  private mapRowToTask(row: any): Task {\n    return Task.reconstitute({\n      id: TaskId.fromString(row.id),\n      description: row.description,\n      priority: Priority.fromString(row.priority),\n      status: TaskStatus.fromString(row.status),\n      assignedAgentId: row.assigned_agent_id,\n      createdAt: new Date(row.created_at),\n      updatedAt: new Date(row.updated_at)\n    });\n  }\n}\n```\n\n## Application Layer\n\n### Use Case Implementation\n```typescript\n\u002F\u002F src\u002Fcore\u002Fapplication\u002Fuse-cases\u002Fassign-task.use-case.ts\n@Injectable()\nexport class AssignTaskUseCase {\n  constructor(\n    @Inject('TaskRepository') private taskRepository: ITaskRepository,\n    @Inject('AgentRepository') private agentRepository: IAgentRepository,\n    @Inject('DomainEventBus') private eventBus: DomainEventBus,\n    @Inject('Logger') private logger: ILogger\n  ) {}\n\n  async execute(command: AssignTaskCommand): Promise\u003CAssignTaskResult> {\n    try {\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      if (!task) {\n        throw new TaskNotFoundError(command.taskId);\n      }\n\n      const agent = await this.agentRepository.findById(command.agentId);\n      if (!agent) {\n        throw new AgentNotFoundError(command.agentId);\n      }\n\n      \u002F\u002F 3. Business logic\n      if (!agent.canAcceptTask(task)) {\n        throw new AgentCannotAcceptTaskError(command.agentId, command.taskId);\n      }\n\n      task.assignTo(command.agentId);\n      agent.acceptTask(task.id);\n\n      \u002F\u002F 4. Persist changes\n      await Promise.all([\n        this.taskRepository.save(task),\n        this.agentRepository.save(agent)\n      ]);\n\n      \u002F\u002F 5. Publish domain events\n      const events = [\n        ...task.getUncommittedEvents(),\n        ...agent.getUncommittedEvents()\n      ];\n\n      for (const event of events) {\n        await this.eventBus.publish(event);\n      }\n\n      task.markEventsAsCommitted();\n      agent.markEventsAsCommitted();\n\n      \u002F\u002F 6. Return result\n      this.logger.info(`Task ${command.taskId.value} assigned to agent ${command.agentId}`);\n\n      return AssignTaskResult.success({\n        taskId: task.id,\n        agentId: command.agentId,\n        assignedAt: new Date()\n      });\n\n    } catch (error) {\n      this.logger.error(`Failed to assign task ${command.taskId.value}:`, error);\n      return AssignTaskResult.failure(error);\n    }\n  }\n\n  private async validateCommand(command: AssignTaskCommand): Promise\u003Cvoid> {\n    if (!command.taskId) {\n      throw new ValidationError('Task ID is required');\n    }\n    if (!command.agentId) {\n      throw new ValidationError('Agent ID is required');\n    }\n  }\n}\n```\n\n## Dependency Injection Setup\n\n### Container Configuration\n```typescript\n\u002F\u002F src\u002Fcore\u002Fshared\u002Finfrastructure\u002Fdependency-container.ts\nimport { Container } from 'inversify';\nimport { TYPES } from '.\u002Ftypes';\n\nexport class DependencyContainer {\n  private container: Container;\n\n  constructor() {\n    this.container = new Container();\n    this.setupBindings();\n  }\n\n  private setupBindings(): void {\n    \u002F\u002F Repositories\n    this.container.bind\u003CITaskRepository>(TYPES.TaskRepository)\n      .to(SqliteTaskRepository)\n      .inSingletonScope();\n\n    this.container.bind\u003CIAgentRepository>(TYPES.AgentRepository)\n      .to(SqliteAgentRepository)\n      .inSingletonScope();\n\n    \u002F\u002F Services\n    this.container.bind\u003CTaskSchedulingService>(TYPES.TaskSchedulingService)\n      .to(TaskSchedulingService)\n      .inSingletonScope();\n\n    \u002F\u002F Use Cases\n    this.container.bind\u003CAssignTaskUseCase>(TYPES.AssignTaskUseCase)\n      .to(AssignTaskUseCase)\n      .inSingletonScope();\n\n    \u002F\u002F Infrastructure\n    this.container.bind\u003CILogger>(TYPES.Logger)\n      .to(ConsoleLogger)\n      .inSingletonScope();\n\n    this.container.bind\u003CDomainEventBus>(TYPES.DomainEventBus)\n      .to(InMemoryDomainEventBus)\n      .inSingletonScope();\n  }\n\n  get\u003CT>(serviceIdentifier: symbol): T {\n    return this.container.get\u003CT>(serviceIdentifier);\n  }\n\n  bind\u003CT>(serviceIdentifier: symbol): BindingToSyntax\u003CT> {\n    return this.container.bind\u003CT>(serviceIdentifier);\n  }\n}\n```\n\n## Modern TypeScript Configuration\n\n### Strict TypeScript Setup\n```json\n\u002F\u002F tsconfig.json\n{\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"lib\": [\"ES2022\"],\n    \"module\": \"NodeNext\",\n    \"moduleResolution\": \"NodeNext\",\n    \"declaration\": true,\n    \"outDir\": \".\u002Fdist\",\n    \"strict\": true,\n    \"exactOptionalPropertyTypes\": true,\n    \"noImplicitReturns\": true,\n    \"noFallthroughCasesInSwitch\": true,\n    \"noUncheckedIndexedAccess\": true,\n    \"noImplicitOverride\": true,\n    \"experimentalDecorators\": true,\n    \"emitDecoratorMetadata\": true,\n    \"skipLibCheck\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"resolveJsonModule\": true,\n    \"esModuleInterop\": true,\n    \"allowSyntheticDefaultImports\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"@\u002F*\": [\"src\u002F*\"],\n      \"@core\u002F*\": [\"src\u002Fcore\u002F*\"],\n      \"@shared\u002F*\": [\"src\u002Fcore\u002Fshared\u002F*\"],\n      \"@domains\u002F*\": [\"src\u002Fcore\u002Fdomains\u002F*\"]\n    }\n  },\n  \"include\": [\"src\u002F**\u002F*\"],\n  \"exclude\": [\"node_modules\", \"dist\", \"**\u002F*.test.ts\", \"**\u002F*.spec.ts\"]\n}\n```\n\n## Testing Implementation\n\n### Domain Unit Tests\n```typescript\n\u002F\u002F src\u002Fcore\u002Fdomains\u002Ftask-management\u002F__tests__\u002Fentities\u002Ftask.entity.test.ts\ndescribe('Task Entity', () => {\n  let task: Task;\n\n  beforeEach(() => {\n    task = Task.create('Test task', Priority.medium());\n  });\n\n  describe('creation', () => {\n    it('should create task with pending status', () => {\n      expect(task.status.isPending()).toBe(true);\n      expect(task.description).toBe('Test task');\n      expect(task.priority.equals(Priority.medium())).toBe(true);\n    });\n\n    it('should generate unique ID', () => {\n      const task1 = Task.create('Task 1', Priority.low());\n      const task2 = Task.create('Task 2', Priority.low());\n\n      expect(task1.id.equals(task2.id)).toBe(false);\n    });\n  });\n\n  describe('assignment', () => {\n    it('should assign to agent and change status', () => {\n      const agentId = 'agent-123';\n\n      task.assignTo(agentId);\n\n      expect(task.assignedAgentId).toBe(agentId);\n      expect(task.status.isAssigned()).toBe(true);\n    });\n\n    it('should emit TaskAssignedEvent when assigned', () => {\n      const agentId = 'agent-123';\n\n      task.assignTo(agentId);\n\n      const events = task.getUncommittedEvents();\n      expect(events).toHaveLength(1);\n      expect(events[0]).toBeInstanceOf(TaskAssignedEvent);\n    });\n\n    it('should not allow assignment of completed task', () => {\n      task.assignTo('agent-123');\n      task.complete(TaskResult.success('done'));\n\n      expect(() => task.assignTo('agent-456'))\n        .toThrow('Cannot assign completed task');\n    });\n  });\n});\n```\n\n### Integration Tests\n```typescript\n\u002F\u002F src\u002Fcore\u002Fdomains\u002Ftask-management\u002F__tests__\u002Fintegration\u002Ftask-repository.integration.test.ts\ndescribe('TaskRepository Integration', () => {\n  let repository: SqliteTaskRepository;\n  let db: Database;\n\n  beforeEach(async () => {\n    db = new Database(':memory:');\n    await setupTasksTable(db);\n    repository = new SqliteTaskRepository(db, new ConsoleLogger());\n  });\n\n  afterEach(async () => {\n    await db.close();\n  });\n\n  it('should save and retrieve task', async () => {\n    const task = Task.create('Test task', Priority.high());\n\n    await repository.save(task);\n    const retrieved = await repository.findById(task.id);\n\n    expect(retrieved).toBeDefined();\n    expect(retrieved!.id.equals(task.id)).toBe(true);\n    expect(retrieved!.description).toBe('Test task');\n    expect(retrieved!.priority.equals(Priority.high())).toBe(true);\n  });\n\n  it('should find pending tasks ordered by priority', async () => {\n    const lowTask = Task.create('Low priority', Priority.low());\n    const highTask = Task.create('High priority', Priority.high());\n\n    await repository.save(lowTask);\n    await repository.save(highTask);\n\n    const pending = await repository.findPendingTasks();\n\n    expect(pending).toHaveLength(2);\n    expect(pending[0].id.equals(highTask.id)).toBe(true); \u002F\u002F High priority first\n    expect(pending[1].id.equals(lowTask.id)).toBe(true);\n  });\n});\n```\n\n## Performance Optimizations\n\n### Entity Caching\n```typescript\n\u002F\u002F src\u002Fcore\u002Fshared\u002Finfrastructure\u002Fentity-cache.ts\n@Injectable()\nexport class EntityCache\u003CT extends Entity\u003Cany>> {\n  private cache = new Map\u003Cstring, { entity: T; timestamp: number }>();\n  private readonly ttl: number = 300000; \u002F\u002F 5 minutes\n\n  set(id: string, entity: T): void {\n    this.cache.set(id, { entity, timestamp: Date.now() });\n  }\n\n  get(id: string): T | null {\n    const cached = this.cache.get(id);\n    if (!cached) return null;\n\n    \u002F\u002F Check TTL\n    if (Date.now() - cached.timestamp > this.ttl) {\n      this.cache.delete(id);\n      return null;\n    }\n\n    return cached.entity;\n  }\n\n  invalidate(id: string): void {\n    this.cache.delete(id);\n  }\n\n  clear(): void {\n    this.cache.clear();\n  }\n}\n```\n\n## Success Metrics\n\n- [ ] **Domain Isolation**: 100% clean dependency boundaries\n- [ ] **Test Coverage**: >90% unit test coverage for domain logic\n- [ ] **Type Safety**: Strict TypeScript compilation with zero any types\n- [ ] **Performance**: \u003C50ms average use case execution time\n- [ ] **Memory Efficiency**: \u003C100MB heap usage for core domains\n- [ ] **Plugin Architecture**: Modular domain loading capability\n\n## Related V3 Skills\n\n- `v3-ddd-architecture` - DDD architectural design\n- `v3-mcp-optimization` - MCP server integration\n- `v3-memory-unification` - AgentDB repository integration\n- `v3-swarm-coordination` - Swarm domain implementation\n\n## Usage Examples\n\n### Complete Core Implementation\n```bash\n# Full core module implementation\nTask(\"Core implementation\",\n     \"Implement all core domains with DDD patterns and comprehensive testing\",\n     \"core-implementer\")\n```\n\n### Domain-Specific Implementation\n```bash\n# Single domain implementation\nTask(\"Task domain implementation\",\n     \"Implement task management domain with entities, services, and repositories\",\n     \"core-implementer\")\n```",{"name":5,"description":7},"main","5593cf3c72898ea9fc67225d452fe38f866ba6dd",".claude\u002F_archive\u002Fskills\u002Fv3-core-implementation","https:\u002F\u002Fgithub.com\u002Faicreator350\u002FaurionOFFICIELLE","https:\u002F\u002Fgithub.com\u002Faicreator350","2026-05-18 03:39:30",{"source":8,"skillName":5,"commands":30,"prompt":40,"zipAvailable":41},[31,34,37],{"tool":32,"command":33},"npx","npx skills add aicreator350\u002FaurionOFFICIELLE --skill \"V3 Core Implementation\"",{"tool":35,"command":36},"bunx","bunx skills add aicreator350\u002FaurionOFFICIELLE --skill \"V3 Core Implementation\"",{"tool":38,"command":39},"pnpm","pnpm dlx skills add aicreator350\u002FaurionOFFICIELLE --skill \"V3 Core Implementation\"","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Faicreator350\u002FaurionOFFICIELLE\u002Fblob\u002Fmain\u002F.claude\u002F_archive\u002Fskills\u002Fv3-core-implementation\u002FSKILL.md",true,[],[44,53,60,67,74,81],{"skillNo":45,"name":46,"nameZh":6,"description":47,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":48,"licenseFileUrl":49,"sourceHtmlUrl":50,"categories":51,"keywords":52,"publishedAt":18},"01M74CAJWR9WB6DX1HF2V461Y0","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Faicreator350\u002FaurionOFFICIELLE\u002Fblob\u002Fmain\u002Fskills\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Faicreator350\u002FaurionOFFICIELLE\u002Fblob\u002Fmain\u002Fskills\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":18},"01M74CAFWC2H75GJ81B39C9RSW","web-design-guidelines","Review UI code for Web Interface Guidelines compliance. Use when asked to \"review my UI\", \"check accessibility\", \"audit design\", \"review UX\", or \"check my site against best practices\".","https:\u002F\u002Fgithub.com\u002Faicreator350\u002FaurionOFFICIELLE\u002Fblob\u002Fmain\u002Fskills\u002Fweb-design-guidelines\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":18},"01M74CA9N2HTGCKJ93AE9NQMHA","vercel-react-view-transitions","Guide for implementing smooth, native-feeling animations using React's View Transition API (`\u003CViewTransition>` component, `addTransitionType`, and CSS view transition pseudo-elements). Use this skill whenever the user wants to add page transitions, animate route changes, create shared element animations, animate enter\u002Fexit of components, animate list reorder, implement directional (forward\u002Fback) navigation animations, or integrate view transitions in Next.js. Also use when the user mentions view transitions, `startViewTransition`, `ViewTransition`, transition types, or asks about animating between UI states in React without third-party animation libraries.","https:\u002F\u002Fgithub.com\u002Faicreator350\u002FaurionOFFICIELLE\u002Fblob\u002Fmain\u002Fskills\u002Fvercel-react-view-transitions\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":18},"01M74CA364D4EVDXZZQRVK1Z73","vercel-react-best-practices","React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React\u002FNext.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.","https:\u002F\u002Fgithub.com\u002Faicreator350\u002FaurionOFFICIELLE\u002Fblob\u002Fmain\u002Fskills\u002Fvercel-react-best-practices\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":18},"01M74C9YQZX1GVS18V0AYCYPZE","vercel-composition-patterns","React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing reusable APIs. Triggers on tasks involving compound components, render props, context providers, or component architecture. Includes React 19 API changes.","https:\u002F\u002Fgithub.com\u002Faicreator350\u002FaurionOFFICIELLE\u002Fblob\u002Fmain\u002Fskills\u002Fvercel-composition-patterns\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":18},"01M74C9SEYD6F764Q1JACZX3A6","vercel-cli-with-tokens","Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. \"deploy to vercel\", \"set up vercel\", \"add environment variables to vercel\".","https:\u002F\u002Fgithub.com\u002Faicreator350\u002FaurionOFFICIELLE\u002Fblob\u002Fmain\u002Fskills\u002Fvercel-cli-with-tokens\u002FSKILL.md",[],[]]