Token导航 LogoToken导航

Agent Skill · 研究检索

domain-driven-design(领域驱动设计)

用于辅助界面设计、视觉规范、排版、配色、布局和交互体验优化。它适合让 Agent 根据产品场景整理页面结构、生成 UI 方案、检查视觉一致性或改进组件层级。使用时需要结合现有品牌、设计系统和用户任务,不应只堆装饰元素;涉及真实页面改动时,应通过截图或浏览器预览检查文本溢出、对齐和响应式表现。

domain-driven-design 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证为 MIT,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 41,429。

总安装 1,175周安装 48GitHub Stars 44下载 380核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:domain-driven-design(领域驱动设计)
来源仓库:https://github.com/bfollington/terma
仓库路径:skills/domain-driven-design
安装命令:
npx skills add https://github.com/bfollington/terma --skill domain-driven-design
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/bfollington/terma --skill domain-driven-design

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

该技能用于辅助界面设计、视觉规范和交互体验优化,适合生成 UI 方案或检查组件层级一致性。适用于需要结合品牌系统、用户任务进行页面结构整理的场景。使用时需避免堆砌装饰元素,应聚焦功能与布局合理性。涉及真实页面改动时,建议通过截图或浏览器预览验证文本溢出和对齐表现。

domain-driven-design 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/domain-driven-design

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/bfollington/terma --skill domain-driven-design;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

domain-driven-design 怎么安装?

在终端执行 npx skills add https://github.com/bfollington/terma --skill domain-driven-design。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

domain-driven-design 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

domain-driven-design 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

domain-driven-design 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

domain-driven-design 用的人多吗?

公开数据是累计安装 1,175 次,近一周安装 48 次,下载 380 次,GitHub 44 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

domain-driven-design 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
domain-driven-design

领域驱动设计 · 本页

1,17544需要联网MIT通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Domain-Driven Design

Overview

This skill provides guidance for domain modeling based on Rich Hickey's data-oriented design principles and Scott Wlaschin's type-driven design approach. Focus on building systems that make illegal states unrepresentable, prioritize data and transformations over objects and methods, and establish a ubiquitous language that bridges technical implementation and business domain.

Core Principles

Rich Hickey's Data-Oriented Design

Simplicity over Ease

  • Favor simple constructs that can be understood independently
  • Avoid complecting (intertwining) unrelated concerns
  • Separate policy from mechanism, data from behavior

Data is King

  • Model the domain using pure data structures, not objects with behavior
  • Prefer generic data structures (maps, sets, vectors) over custom classes when appropriate
  • Data should be self-describing and inspectable
  • Functions transform data; data does not execute behavior

Value of Values

  • Use immutable values to represent facts
  • Values enable local reasoning and simple equality
  • Values can be freely shared without coordination
  • Consider: what are the immutable facts in this domain?

Decomplecting

  • Identify what is truly essential to the domain vs. incidental complexity
  • Separate when-it-happens from what-happens
  • Separate mechanism from policy
  • Question: are these concerns actually separate, or have we tangled them?

Scott Wlaschin's Type-Driven Design

Make Illegal States Unrepresentable

  • Use the type system to eliminate invalid states at compile time
  • Model optional values explicitly (Option/Maybe types)
  • Use sum types (discriminated unions) for states that are mutually exclusive
  • Avoid primitive obsession; create domain-specific types

Domain Modeling Made Functional

  • Model workflows as data transformations: Input → Process → Output
  • Explicitly model business rules as functions
  • Separate validation from business logic
  • Think in terms of: What can happen? What are the valid transitions?

Railway-Oriented Programming

  • Model success and failure paths explicitly (Result types)
  • Chain operations that can fail using bind/flatMap
  • Keep the happy path clear and linear
  • Handle errors at appropriate boundaries

Types as Documentation

  • Type signatures should communicate intent
  • Use newtype wrappers for semantic clarity (UserId, EmailAddress, Timestamp)
  • Constrain inputs to valid ranges using types
  • Let the type system guide API design

DDD Building Blocks

Entities vs Value Objects

Entities are defined by identity, not attributes:

  • Have a unique identifier (ID, account number, etc.)
  • Can change over time while maintaining identity
  • Two entities with same attributes but different IDs are distinct
  • Used when domain experts refer to things by name/ID

Value Objects are defined entirely by attributes:

  • No unique identifier
  • Immutable
  • Two value objects with same attributes are interchangeable
  • Used when only the value matters, not identity

Decision Guide:

  • Ask: Do domain experts refer to this by ID/name? → Entity
  • Ask: Can I replace it with an equivalent copy? → If yes: Value Object

Aggregates and Aggregate Roots

Aggregate: A cluster of entities and value objects treated as a single unit for data changes.

Aggregate Root: The single entity through which all external access to the aggregate must pass.

Purpose:

  • Define transactional consistency boundaries
  • Enforce invariants that span multiple objects
  • Simplify the model by grouping related concepts

Rules:

  • External references go only to the aggregate root (use ID references)
  • Root enforces all invariants for the entire aggregate
  • Transactions don't cross aggregate boundaries (use eventual consistency)
  • Keep aggregates small for better performance and scalability

When NOT to create an aggregate:

  • Objects can be modified independently
  • No shared invariants requiring transactional consistency
  • Different objects have different lifecycles

Bounded Contexts

Definition: An explicit boundary within which a domain model applies.

Purpose:

  • Divide large domains into manageable pieces
  • Allow same term to have different meanings in different contexts
  • Prevent model corruption from mixing incompatible concepts

Key Insight: Ubiquitous language is only ubiquitous within a context. "Customer" in Sales context may be different from "Customer" in Shipping context.

When modeling:

  • Identify which bounded context you're in
  • Make context boundaries explicit in code structure (separate modules/namespaces)
  • Use anti-corruption layers when integrating across contexts
  • Document relationships between contexts (context map)

Domain Events

Definition: Something important that happened in the domain.

Characteristics:

  • Named in past tense (OrderPlaced, PaymentProcessed, UserRegistered)
  • Immutable facts
  • Domain experts care about them
  • Can trigger reactions within or across bounded contexts

Uses:

  • Decouple domain logic
  • Enable eventual consistency between aggregates
  • Integration between bounded contexts
  • Event sourcing (store events as source of truth)

Repositories

Purpose: Provide illusion of an in-memory collection of aggregates, abstracting persistence.

Characteristics:

  • Operate at aggregate boundaries (load/save whole aggregates)
  • Provide lookup by ID
  • Hide database implementation details
  • Return domain entities, not database rows

Pattern: Application layer uses repository to get/save aggregates; domain layer remains pure.

Domain Modeling Workflow

1. Discover the Ubiquitous Language

Start by identifying the domain concepts, using terminology from domain experts:

Action Items:

  • List nouns (entities, value objects) and verbs (operations, events) from the domain
  • Document domain terms with precise definitions
  • Identify synonyms and resolve ambiguity
  • Ask: What does the business call this? What are the boundaries of this concept?

Output Format: Create a glossary section documenting each term:

**Term** (Type: Entity/ValueObject/Event/Command)
- Definition: [Clear, domain-expert-approved definition]
- Examples: [Concrete examples]
- Invariants: [Rules that must always hold]

2. Analyze the Existing Domain Model

Before making changes, understand the current state:

Exploration Steps:

  • Identify where domain concepts are currently modeled (types, schemas, tables)
  • Map out relationships between domain entities
  • Find where business logic lives (services, functions, stored procedures)
  • Document implicit rules and constraints
  • Note inconsistencies in naming or modeling

Questions to Answer:

  • What types/classes represent domain concepts?
  • What are the invariants? Where are they enforced?
  • Which concepts are tangled together that should be separate?
  • Are there phantom types or states that shouldn't exist?

3. Identify Inconsistencies and Smells

Common problems to surface:

Naming Inconsistencies

  • Same concept with different names (User vs Account vs Customer)
  • Different concepts with same name (Order as entity vs Order as command)
  • Technical names bleeding into domain language (DTO, DAO suffixes)

Structural Problems

  • Illegal states being representable (e.g., status: "approved" | "rejected" with separate approved_at and rejected_at fields that can both be set)
  • Primitive obsession (strings for email, numbers for money)
  • Optional fields that are actually required in certain states
  • Null/undefined used to represent multiple distinct states

Complected Concerns

  • Domain logic mixed with infrastructure (DB access in business logic)
  • Multiple responsibilities in one type/module
  • Temporal coupling (must call A before B or system breaks)

Missing Concepts

  • Domain concepts that exist in conversations but not in code
  • Implicit states that should be explicit
  • Business rules enforced through comments or conventions rather than types

4. Design the Domain Model

Apply type-driven and data-driven principles:

Data Modeling:

  • Start with the data shape; what are the facts?
  • Use immutable values for facts that don't change
  • Model state transitions explicitly
  • Separate identity from attributes
  • Consider: what varies together? What varies independently?

Type Design:

  • Create sum types for mutually exclusive states: type PaymentStatus = | Pending | Approved {approvedAt: Timestamp, approvedBy: UserId} | Rejected {rejectedAt: Timestamp, reason: string}
  • Use product types to ensure all required data is present
  • Create semantic wrappers for primitives: type EmailAddress = EmailAddress of string // with validation type Money = {amount: Decimal, currency: Currency}
  • Make impossible states unrepresentable

Workflow Modeling:

  • Model each business workflow as a clear pipeline: ValidateInput → ExecuteBusinessLogic → HandleResult → Persist → Notify
  • Identify decision points and model them explicitly
  • Separate pure business logic from effects (IO, time, randomness)
  • Use clear function signatures that document intent

5. Build and Maintain Ubiquitous Language

Consistency Rules:

  • Use identical terminology in code, documentation, conversations, and UI
  • When domain language changes, update all representations
  • Avoid technical jargon in domain code (no "factory", "manager", "handler" unless domain terms)
  • Resist the temptation to rename domain concepts for technical convenience

Code Conventions:

  • Domain types should mirror domain language exactly
  • Function names should use domain verbs
  • Module boundaries should follow domain boundaries
  • Comments should explain domain rules, not implementation details

Documentation:

  • Keep the glossary up to date
  • Document why decisions were made (especially constraints and invariants)
  • Link code to domain documentation
  • Make implicit domain rules explicit

6. Visualize the Domain Model

Use diagrams to communicate domain structure and relationships:

Mermaid for Relationships:

classDiagram
    Order --> Customer
    Order --> OrderLine
    OrderLine --> Product
    Order --> PaymentStatus

    class Order {
        +OrderId id
        +CustomerId customerId
        +List~OrderLine~ lines
        +PaymentStatus status
    }

    class PaymentStatus {
        <<enumeration>>
        Pending
        Approved
        Rejected
    }

Mermaid for Workflows:

graph LR
    A[Receive Order] --> B{Valid?}
    B -->|Yes| C[Calculate Total]
    B -->|No| D[Return Validation Error]
    C --> E[Process Payment]
    E --> F{Payment Success?}
    F -->|Yes| G[Fulfill Order]
    F -->|No| H[Cancel Order]

Mermaid for State Transitions:

stateDiagram-v2
    [*] --> Draft
    Draft --> Submitted: submit()
    Submitted --> Approved: approve()
    Submitted --> Rejected: reject()
    Approved --> Fulfilled: fulfill()
    Fulfilled --> [*]
    Rejected --> [*]

Graphviz/DOT for Complex Relationships:

digraph domain {
    rankdir=LR;
    node [shape=box];

    Customer -> Order [label="places"];
    Order -> OrderLine [label="contains"];
    OrderLine -> Product [label="references"];
    Order -> Payment [label="requires"];
    Payment -> PaymentMethod [label="uses"];
}

ASCII for Quick Sketches:

Customer
  └─> Order (1:N)
       ├─> OrderLine (1:N)
       │    └─> Product
       └─> Payment (1:1)
            └─> PaymentMethod

When to Use Each:

  • Mermaid classDiagram: Entity relationships and type structures
  • Mermaid graph/flowchart: Business workflows and decision trees
  • Mermaid stateDiagram: State transitions and lifecycle
  • Graphviz/DOT: Complex dependency graphs, module boundaries
  • ASCII: Quick sketches during discussion, simple hierarchies

Domain Modeling Anti-Patterns

Anemic Domain Model

  • Symptom: Data structures with getters/setters, all logic in separate services
  • Problem: Violates data-orientation by adding ceremony without encapsulation benefits
  • Solution: Keep data as data; put related transformations in same module but separate from data definition

Entity Services Anti-Pattern

  • Symptom: Classes like UserService, OrderManager, ProductFactory
  • Problem: Hides actual operations; lacks ubiquitous language
  • Solution: Name functions after domain operations: approveOrder, cancelSubscription, calculateDiscount

Primitive Obsession

  • Symptom: String for email, number for money, boolean flags for states
  • Problem: No type safety; invalid values representable
  • Solution: Create semantic types with validation

Accidental Complexity

  • Symptom: Complex abstractions, design patterns without clear domain benefit
  • Problem: Adds layers that obscure domain meaning
  • Solution: Simplify; prefer composition over inheritance; avoid premature abstraction

Hidden Temporal Coupling

  • Symptom: Must call methods in specific order or system breaks
  • Problem: Complects workflow with state management
  • Solution: Make workflow explicit; use types to enforce valid transitions

Boolean Blindness

  • Symptom: Boolean flags to represent states (isApproved, isActive, isDeleted)
  • Problem: Multiple booleans can represent impossible states
  • Solution: Use sum types for mutually exclusive states

Contextualizing Within Existing Models

When adding to or changing an existing domain model:

  1. Map Current State: Document existing types, relationships, and patterns
  2. Identify Affected Concepts: Which existing concepts does this change touch?
  3. Check Consistency: Does new design follow existing patterns? If not, why?
  4. Assess Impact: What breaks if we make this change?
  5. Migration Path: How do we evolve from current to desired state?
  6. Update Ubiquitous Language: Ensure all usage points are updated
  7. Visualize Before/After: Create diagrams showing current and proposed models

Key Questions:

  • Does this change align with existing domain boundaries?
  • Are we using consistent terminology?
  • Does this introduce new concepts or reuse existing ones?
  • Are we fixing an inconsistency or introducing a new one?
  • Can we make this change incrementally?

Checklist for Domain Modeling

Before completing domain modeling work:

Language & Communication:

  • All domain concepts are named using ubiquitous language
  • Domain glossary is updated with new/changed terms
  • All code, docs, and conversations use identical terminology
  • Bounded context is clearly identified and documented

Type Design:

  • Types make illegal states unrepresentable
  • No primitive obsession; semantic types are used appropriately
  • Entities have clear identity; value objects are immutable
  • Sum types used for mutually exclusive states

Domain Logic:

  • Business rules are explicit and testable
  • Data and behavior are appropriately separated
  • Workflows are modeled as clear data transformations
  • Domain logic is pure (no side effects)
  • Temporal coupling is eliminated or made explicit

Aggregates & Boundaries:

  • Aggregate boundaries are explicit
  • Aggregates enforce their invariants
  • External references to aggregates use IDs only
  • Aggregates are kept small and focused
  • Transactional boundaries are appropriate

Consistency & Integration:

  • Inconsistencies with existing model are resolved or documented
  • Cross-aggregate consistency strategy is defined (transactional vs eventual)
  • Domain events are used for important occurrences
  • Integration between bounded contexts uses anti-corruption layers

Documentation:

  • Visualization diagrams clearly communicate the design
  • Key decisions and invariants are documented
  • Context map shows relationships between bounded contexts

Resources

references/

This skill includes reference documentation for deeper exploration:

  • ddd_foundations_and_patterns.md: Eric Evans' foundational DDD concepts (entities, value objects, aggregates, bounded contexts, repositories, domain events), Martin Fowler's Ubiquitous Language guidance, and practical Clojure/functional patterns. Essential reading for understanding DDD building blocks and how to apply them.
  • rich_hickey_principles.md: Core concepts from Rich Hickey's talks including Simple Made Easy, Value of Values, and The Language of the System. Focus on data-oriented design, simplicity, decomplecting, and the power of immutable values.
  • wlaschin_patterns.md: Scott Wlaschin's type-driven design patterns, domain modeling recipes, functional architecture guidance, and railway-oriented programming. Emphasis on making illegal states unrepresentable and designing with types.
  • visualization_examples.md: Comprehensive examples of Mermaid, Graphviz, and ASCII diagram patterns for domain modeling. Includes entity relationships, workflows, state machines, aggregate boundaries, and bounded context maps.

Load these references when deeper context is needed on specific principles or patterns.

平台分布

Claude Code

28.89%
按下载量换算110

Antigravity

20.44%
按下载量换算78

windsurf

15.97%
按下载量换算61

Codex

13.55%
按下载量换算51

Gemini CLI

8.58%
按下载量换算33

OpenCode

3.49%
按下载量换算13

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

继续浏览同类 Skills