ddd-context
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCreate a bounded context directory structure for the given context name.
Parse as the context name (kebab-case). If empty, list existing contexts.
$ARGUMENTS为给定的上下文名称创建限界上下文目录结构。
将解析为上下文名称(kebab-case格式)。如果为空,则列出已有的上下文。
$ARGUMENTSSteps
步骤
-
Validate name: Ensure the context name is kebab-case and does not already exist under.
src/ -
Create directory structure:
src/<context-name>/ domain/ entities/ value-objects/ events/ services/ repositories/ application/ infrastructure/ -
Generate index files:
- -- barrel export for entities
src/<context-name>/domain/entities/index.ts - -- barrel export for value objects
src/<context-name>/domain/value-objects/index.ts - -- barrel export for domain events
src/<context-name>/domain/events/index.ts - -- barrel export for domain services
src/<context-name>/domain/services/index.ts - -- barrel export for repository interfaces
src/<context-name>/domain/repositories/index.ts - -- re-export all domain submodules
src/<context-name>/domain/index.ts - -- barrel export for application services
src/<context-name>/application/index.ts - -- barrel export for infrastructure implementations
src/<context-name>/infrastructure/index.ts - -- public API of the bounded context (re-exports domain and application only, NOT infrastructure)
src/<context-name>/index.ts
-
Store in domain model graph:
mcp__claude-flow__agentdb_hierarchical-store --parent "domain" --child "context:<context-name>" --relation "contains" mcp__claude-flow__memory_store --key "ddd-context-<context-name>" --value "Created bounded context" --namespace tasks -
Report: Confirm the context was created and list the generated files.
-
验证名称:确保上下文名称为kebab-case格式,且在目录下不存在。
src/ -
创建目录结构:
src/<context-name>/ domain/ entities/ value-objects/ events/ services/ repositories/ application/ infrastructure/ -
生成索引文件:
- -- 实体的桶式导出文件
src/<context-name>/domain/entities/index.ts - -- 值对象的桶式导出文件
src/<context-name>/domain/value-objects/index.ts - -- 领域事件的桶式导出文件
src/<context-name>/domain/events/index.ts - -- 领域服务的桶式导出文件
src/<context-name>/domain/services/index.ts - -- 仓库接口的桶式导出文件
src/<context-name>/domain/repositories/index.ts - -- 重新导出所有领域子模块
src/<context-name>/domain/index.ts - -- 应用服务的桶式导出文件
src/<context-name>/application/index.ts - -- 基础设施实现的桶式导出文件
src/<context-name>/infrastructure/index.ts - -- 限界上下文的公开API(仅重新导出领域层和应用层,不包含基础设施层)
src/<context-name>/index.ts
-
存储到领域模型图:
mcp__claude-flow__agentdb_hierarchical-store --parent "domain" --child "context:<context-name>" --relation "contains" mcp__claude-flow__memory_store --key "ddd-context-<context-name>" --value "Created bounded context" --namespace tasks -
报告:确认上下文已创建,并列出生成的文件。