$npx -y skills add spencermarx/open-code-review --skill v3-core-implementationCore module implementation for claude-flow v3. Implements DDD domains, clean architecture patterns, dependency injection, and modular TypeScript codebase with comprehensive testing.
| 1 | # V3 Core Implementation |
| 2 | |
| 3 | ## What This Skill Does |
| 4 | |
| 5 | Implements 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. |
| 6 | |
| 7 | ## Quick Start |
| 8 | |
| 9 | ```bash |
| 10 | # Initialize core implementation |
| 11 | Task("Core foundation", "Set up DDD domain structure and base classes", "core-implementer") |
| 12 | |
| 13 | # Domain implementation (parallel) |
| 14 | Task("Task domain", "Implement task management domain with entities and services", "core-implementer") |
| 15 | Task("Session domain", "Implement session management domain", "core-implementer") |
| 16 | Task("Health domain", "Implement health monitoring domain", "core-implementer") |
| 17 | ``` |
| 18 | |
| 19 | ## Core Implementation Architecture |
| 20 | |
| 21 | ### Domain Structure |
| 22 | ``` |
| 23 | src/ |
| 24 | ├── core/ |
| 25 | │ ├── kernel/ # Microkernel pattern |
| 26 | │ │ ├── claude-flow-kernel.ts |
| 27 | │ │ ├── domain-registry.ts |
| 28 | │ │ └── plugin-loader.ts |
| 29 | │ │ |
| 30 | │ ├── domains/ # DDD Bounded Contexts |
| 31 | │ │ ├── task-management/ |
| 32 | │ │ │ ├── entities/ |
| 33 | │ │ │ ├── value-objects/ |
| 34 | │ │ │ ├── services/ |
| 35 | │ │ │ ├── repositories/ |
| 36 | │ │ │ └── events/ |
| 37 | │ │ │ |
| 38 | │ │ ├── session-management/ |
| 39 | │ │ ├── health-monitoring/ |
| 40 | │ │ ├── lifecycle-management/ |
| 41 | │ │ └── event-coordination/ |
| 42 | │ │ |
| 43 | │ ├── shared/ # Shared kernel |
| 44 | │ │ ├── domain/ |
| 45 | │ │ │ ├── entity.ts |
| 46 | │ │ │ ├── value-object.ts |
| 47 | │ │ │ ├── domain-event.ts |
| 48 | │ │ │ └── aggregate-root.ts |
| 49 | │ │ │ |
| 50 | │ │ ├── infrastructure/ |
| 51 | │ │ │ ├── event-bus.ts |
| 52 | │ │ │ ├── dependency-container.ts |
| 53 | │ │ │ └── logger.ts |
| 54 | │ │ │ |
| 55 | │ │ └── types/ |
| 56 | │ │ ├── common.ts |
| 57 | │ │ ├── errors.ts |
| 58 | │ │ └── interfaces.ts |
| 59 | │ │ |
| 60 | │ └── application/ # Application services |
| 61 | │ ├── use-cases/ |
| 62 | │ ├── commands/ |
| 63 | │ ├── queries/ |
| 64 | │ └── handlers/ |
| 65 | ``` |
| 66 | |
| 67 | ## Base Domain Classes |
| 68 | |
| 69 | ### Entity Base Class |
| 70 | ```typescript |
| 71 | // src/core/shared/domain/entity.ts |
| 72 | export abstract class Entity<T> { |
| 73 | protected readonly _id: T; |
| 74 | private _domainEvents: DomainEvent[] = []; |
| 75 | |
| 76 | constructor(id: T) { |
| 77 | this._id = id; |
| 78 | } |
| 79 | |
| 80 | get id(): T { |
| 81 | return this._id; |
| 82 | } |
| 83 | |
| 84 | public equals(object?: Entity<T>): boolean { |
| 85 | if (object == null || object == undefined) { |
| 86 | return false; |
| 87 | } |
| 88 | |
| 89 | if (this === object) { |
| 90 | return true; |
| 91 | } |
| 92 | |
| 93 | if (!(object instanceof Entity)) { |
| 94 | return false; |
| 95 | } |
| 96 | |
| 97 | return this._id === object._id; |
| 98 | } |
| 99 | |
| 100 | protected addDomainEvent(domainEvent: DomainEvent): void { |
| 101 | this._domainEvents.push(domainEvent); |
| 102 | } |
| 103 | |
| 104 | public getUncommittedEvents(): DomainEvent[] { |
| 105 | return this._domainEvents; |
| 106 | } |
| 107 | |
| 108 | public markEventsAsCommitted(): void { |
| 109 | this._domainEvents = []; |
| 110 | } |
| 111 | } |
| 112 | ``` |
| 113 | |
| 114 | ### Value Object Base Class |
| 115 | ```typescript |
| 116 | // src/core/shared/domain/value-object.ts |
| 117 | export abstract class ValueObject<T> { |
| 118 | protected readonly props: T; |
| 119 | |
| 120 | constructor(props: T) { |
| 121 | this.props = Object.freeze(props); |
| 122 | } |
| 123 | |
| 124 | public equals(object?: ValueObject<T>): boolean { |
| 125 | if (object == null || object == undefined) { |
| 126 | return false; |
| 127 | } |
| 128 | |
| 129 | if (this === object) { |
| 130 | return true; |
| 131 | } |
| 132 | |
| 133 | return JSON.stringify(this.props) === JSON.stringify(object.props); |
| 134 | } |
| 135 | |
| 136 | get value(): T { |
| 137 | return this.props; |
| 138 | } |
| 139 | } |
| 140 | ``` |
| 141 | |
| 142 | ### Aggregate Root |
| 143 | ```typescript |
| 144 | // src/core/shared/domain/aggregate-root.ts |
| 145 | export abstract class AggregateRoot<T> extends Entity<T> { |
| 146 | private _version: number = 0; |
| 147 | |
| 148 | get version(): number { |
| 149 | return this._version; |
| 150 | } |
| 151 | |
| 152 | protected incrementVersion(): void { |
| 153 | this._version++; |
| 154 | } |
| 155 | |
| 156 | public applyEvent(event: DomainEvent): void { |
| 157 | this.addDomainEvent(event); |
| 158 | this.incrementVersion(); |
| 159 | } |
| 160 | } |
| 161 | ``` |
| 162 | |
| 163 | ## Task Management Domain Implementation |
| 164 | |
| 165 | ### Task Entity |
| 166 | ```typescript |
| 167 | // src/core/domains/task-management/entities/task.entity.ts |
| 168 | import { AggregateRoot } from '../../../shared/domain/aggregate-root'; |
| 169 | import { TaskId } from '../value-objects/task-id.vo'; |
| 170 | import { TaskStatus } from '../value-objects/task-status.vo'; |
| 171 | import { Priority } from '../value-objects/priority.vo'; |
| 172 | import { TaskAssignedEvent } from '../events/task-assigned.event'; |
| 173 | |
| 174 | interface TaskProps { |
| 175 | id: TaskId; |
| 176 | description: string; |
| 177 | priority: Priority; |
| 178 | status: TaskStatus; |
| 179 | assignedAgentId?: string; |
| 180 | createdAt: Date; |
| 181 | updatedAt: Date; |
| 182 | } |
| 183 | |
| 184 | export class Task extends AggregateRoot<TaskId> { |
| 185 | private props: TaskProps; |
| 186 | |
| 187 | private constructor(props: TaskProps) { |
| 188 | super(props.id); |
| 189 | this.props = props; |
| 190 | } |
| 191 | |
| 192 | static create(description: string, priority: Priority): Task { |
| 193 | const task = new Task({ |
| 194 | id: TaskId.create(), |
| 195 | description, |
| 196 | priority, |
| 197 | status: TaskStatus.pending(), |
| 198 | createdAt: new Date(), |
| 199 | updatedAt: new Date() |
| 200 | }); |
| 201 | |
| 202 | return |