跳到正文
Skillpedia
API 与服务器(后端)81k · #1615

ddd-context

它能做什么

这项技能为限界上下文(即代码库中一个独立的业务领域)创建标准的文件夹结构。适合把大型应用拆分成清晰模块的开发者。

适用场景

  • ✓当你在代码库中开始一个新的业务领域时。
  • ✓当你把大型应用拆分为边界清晰的独立部分时。
  • ✓当你希望新模块使用相同的领域、应用和基础设施结构时。

技能链接

https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-ddd/skills/ddd-context/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-ddd/skills/ddd-context/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请在我的代码库中用标准文件夹结构设置一个新的账单领域。”

每周 5 个新技能,1 分钟读完。

工作原理

这项技能检查名称是否为 kebab-case 格式且尚未被使用,然后为领域、应用和基础设施各层创建文件夹和索引文件。它还会把新领域记录到领域模型存储中。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Create a bounded context directory structure for the given context name.

Parse $ARGUMENTS as the context name (kebab-case). If empty, list existing contexts.

Steps

  1. Validate name: Ensure the context name is kebab-case and does not already exist under src/.

  2. Create directory structure:

    src/<context-name>/
      domain/
        entities/
        value-objects/
        events/
        services/
        repositories/
      application/
      infrastructure/
    
  3. Generate index files:

    • src/<context-name>/domain/entities/index.ts -- barrel export for entities
    • src/<context-name>/domain/value-objects/index.ts -- barrel export for value objects
    • src/<context-name>/domain/events/index.ts -- barrel export for domain events
    • src/<context-name>/domain/services/index.ts -- barrel export for domain services
    • src/<context-name>/domain/repositories/index.ts -- barrel export for repository interfaces
    • src/<context-name>/domain/index.ts -- re-export all domain submodules
    • src/<context-name>/application/index.ts -- barrel export for application services
    • src/<context-name>/infrastructure/index.ts -- barrel export for infrastructure implementations
    • src/<context-name>/index.ts -- public API of the bounded context (re-exports domain and application only, NOT infrastructure)
  4. Store in domain model graph:

    mcp__plugin_ruflo-core_ruflo__agentdb_hierarchical-store({ key: "domain/context-<context-name>", value: "Bounded context <context-name> (parent: domain)", tier: "semantic" })
    mcp__plugin_ruflo-core_ruflo__agentdb_causal-edge({ sourceId: "entity:domain", targetId: "entity:context-<context-name>", relation: "contains" })
    mcp__plugin_ruflo-core_ruflo__memory_store({ key: "ddd-context-<context-name>", value: "Created bounded context", namespace: "tasks" })
    
  5. Report: Confirm the context was created and list the generated files.

常见问题

应使用哪种名称格式?

使用 kebab-case,例如 billing-invoices,并确保不存在同名的文件夹。

公共索引公开什么?

它只重新导出领域层和应用层,不包括基础设施层。

如果不提供名称运行会怎样?

它会列出现有的上下文,而不是创建新的上下文。

详情

作者的原始描述

Create and manage a DDD bounded context with standard directory structure. Use when starting a new subdomain, splitting a monolith into bounded contexts, or scaffolding the domain/application/infrastructure layout for a fresh module.

repo: ruvnet/ruflo

热度

GitHub 星标
81k
排名
#1615
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能