Architecture Paradigm Domain Driven 标志

Architecture Paradigm Domain Driven

社区
athola
architecture-paradigm-domain-driven

Models a business in its own language. Use when the domain has real business rules to capture.

Add to TypingMind

概览

发布者athola
代码仓库claude-night-market
技能名称architecture-paradigm-domain-driven
星标数
343
复刻数
37
附带文件
仅含指令
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 指令自成一体

    模型所需的一切都包含在指令中,无需同步额外文件。

  • 开源

    由 athola 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Architecture Paradigm Domain Driven AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/athola/claude-night-market/tree/master/plugins/archetypes/skills/architecture-paradigm-domain-driven
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/athola/claude-night-market.git /tmp/claude-night-market
mkdir -p .claude/skills
cp -r /tmp/claude-night-market/plugins/archetypes/skills/architecture-paradigm-domain-driven .claude/skills/architecture-paradigm-domain-driven
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Architecture Paradigm Domain Driven,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Architecture Paradigm Domain Driven。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Architecture Paradigm Domain Driven 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

The Domain-Driven Design Paradigm

Design for the future, build for now.

DDD is modeling a business in the business's own language. The goal is not to avoid structure. It is to avoid structure you cannot back out of, and to defer structure you do not yet need.

What DDD Is

Ubiquitous language, bounded contexts, and a model built by talking to the people who do the work. The measure of a domain model is whether a person in the business would recognize their own job in it.

What DDD Is Not

Clean Architecture. Mandatory layering. A mapper between every tier. A count of design patterns applied before the first line of business logic is written.

These are DDD-adjacent choices. Each has its own justification, and none of them is entailed by DDD. Wanting to decouple an API from the domain is a good reason to add a DTO. "This is what DDD requires" is not, because it does not.

Strategic Design Is The Core

The building blocks are not the point, and this is not the repo's opinion. Evans said so himself, ten years after the book, about the book:

"things like the entities and value objects [..] [People] come away thinking that that's really the core of DDD, whereas, in fact, it's really not."

"I really think that the way I arranged the book gives people the wrong emphasis, so that's the biggest part of what I do is rearrange those things."

Source: SE-Radio Episode 226, "Eric Evans on Domain-Driven Design at 10 Years" (video). Quotes as transcribed by The Core of Domain-Driven Design, which also cites his DDD Europe 2016 keynote criticizing the "over-emphasis on building blocks."

What the core actually is: discovering subdomains and drawing bounded contexts, in language the business already speaks. Entities, value objects, and aggregates are how a model reaches code once it exists. They are the translation, not the thing being translated.

Read the rest of this skill in that light. Every mechanism below is optional machinery serving a model you found by talking to people.

When To Use

  • The domain has business rules a domain expert could argue about.
  • The team can talk to the people who do the work being modeled.
  • The system is expected to grow into complexity you cannot yet name.

When NOT To Use

  • Domains with no meaningful business rules (CRUD over a form).
  • Single-actor tools with no business vocabulary to share.
  • Anything where the model would be a database schema with a new name.

Build For Now

Once a domain exists, create the data store and one concrete data object. Pass that object from the repository into the business layer. At the start of a project, pass it out to the view as well.

That is a legitimate starting state, not technical debt. One object moving through every layer is the cheapest thing that can work, and it is the shape the divergence protocol below is designed to split.

The Divergence Protocol

The DTO arrives at the moment of divergence, not in anticipation of it.

Trigger: the view's response shape must hold for contract reasons while the domain model needs to change.

Move: the old data object becomes the view DTO. The new domain object gains a translation into it. Where fields differ, a copy constructor maps them, in either direction as needed.

That is the whole mechanism. It works because the starting state (one shared object) is the same shape as the ending state's DTO, so the split costs one rename and one translation function. This is why "we might need a DTO later" is not a reason to build one now: later is cheap.

Shared-Type Options When Shapes Overlap

Ordered by cost:

  1. Same type in every layer. The default. If the objects look the same everywhere, use the same object.
  2. Builder, when different contexts select different subsets of one fixed field set.
  3. Shared base class with per-context subclasses (entity, DTO, domain object, JSON representation). Each context adds its own fields on top of a shared core. This reduces duplication when several contexts genuinely share that core.

Option 3 carries a cost worth stating plainly: inheritance couples the layers. Changing the base changes every context at once, which is the opposite of the flexibility the divergence protocol buys. It also feeds straight into the boundary hazard below. Reach for it when duplication is the larger present pain, and reach for it knowing what it trades away.

The IO Boundary Rule

Do not reuse a data type across a network or other IO boundary without validating that you are not sharing something you should not.

This is the one non-negotiable constraint in this skill. Everything else here can be deferred, dropped, or added later. This cannot.

Option 3 is where it bites hardest: a field added to a shared base class appears silently in every serialized representation that inherits it, including the one crossing the wire. The convenience is real and so is the leak.

Request DTOs Earn Their Keep Here

When two or more systems exchange commands over a network and do not deploy atomically, a versioned request DTO lets you introduce a new shape while continuing to serve the old one, and migrate the systems one at a time. Without it, any change to the command shape requires every system to update simultaneously, which fails the moment one update fails or one release waits on an app store, an IT department, or another team.

That is a deployment constraint, not a DDD principle. Name it as such when you justify the DTO, so the next reader knows which force put it there and when it can go.

Strangling An Existing Application Into Domains

Never in one pass. A refactor that tries to do every layer at once does not land. Per domain, in order:

  1. Data layer. Split fetching into a reasonable domain boundary.
  2. Business layer. One business entity, responsible for one domain.
  3. Strangle existing call sites over to that domain.
  4. View layer. Last.

Then repeat for the next domain. Keep the implementation simple until a need for more appears.

Adoption Steps

  1. Build the language. Talk to the people in the business. Write down the terms they use, and use exactly those terms in code.
  2. Draw the bounded contexts. Name where one meaning of a term stops and another starts. A term meaning two things is two contexts.
  3. Create the store and one data object. Pass it through the layers.
  4. Wait for divergence. Apply the protocol above when the contract and the model actually pull apart, not before.
  5. Audit the boundaries. Every type crossing IO gets its fields read.

Key Deliverables

  • A glossary of domain terms that a domain expert would sign off on.
  • A context map naming each bounded context and its relationships.
  • An ADR recording which ceremony was adopted and which need drove it.
  • A field audit for every type crossing an IO boundary.

Risks and Mitigations

  • Ceremony without need:
    • Mitigation: Name the current need in the pull request that adds any DTO, mapper, command object, or layer boundary, and apply the ceremony-audit lens in Skill(pensive:architecture-review). A mapper whose fields are all 1:1 copies is a mapper with no job.
  • Anemic model:
    • Mitigation: If the domain objects carry no behavior and every rule lives in a service, the model is a schema with a new name. Move the rules onto the objects that own them, or accept that this domain does not need DDD.
  • Silent field leak across a boundary:
    • Mitigation: The IO boundary rule above. Treat shared base classes as a leak risk, not just a duplication fix.

Concrete Components

Vocabulary for the tools and abstractions an implementation of this paradigm tends to carry. Not dependencies, and not tools: frontmatter.

  • ubiquitous-language-glossary: the term list the business and the code both use, maintained as a first-class artifact
  • context-map: names each bounded context and the relationships between them, including where one term changes meaning
  • copy-constructor: the translation introduced at the moment of divergence, mapping fields between a domain object and its view DTO

Exit Criteria

  • The domain model uses terms a person in the business would recognize without translation.
  • Every mapper in the codebase has at least one field that is not a 1:1 copy, or a documented contract reason to exist.
  • Every type crossing an IO boundary has had its fields audited for what they expose.
  • A decomposition in progress names which domain is being strangled and which layer it has reached.

常见问题

Architecture Paradigm Domain Driven AI 技能有什么作用?

Models a business in its own language. Use when the domain has real business rules to capture.

为什么在 TypingMind 中使用 Architecture Paradigm Domain Driven?

因为您只需安装一次,就能搭配任何模型使用。Architecture Paradigm Domain Driven 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Architecture Paradigm Domain Driven?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/athola/claude-night-market/tree/master/plugins/archetypes/skills/architecture-paradigm-domain-driven。TypingMind 会读取其中的 SKILL.md,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Architecture Paradigm Domain Driven?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Architecture Paradigm Domain Driven 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Architecture Paradigm Domain Driven 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Architecture Paradigm Domain Driven AI 技能免费吗?

是的。athola 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇