一键导入
domainchart
This skill visualizes the domain object hierarchy in the project using domainchart npm package.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
This skill visualizes the domain object hierarchy in the project using domainchart npm package.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
| description | This skill visualizes the domain object hierarchy in the project using domainchart npm package. |
| metadata | {"github-path":"skills/domainchart","github-ref":"refs/heads/main","github-repo":"https://github.com/kt3k/domainchart","github-tree-sha":"ca4b540ea091684b84b444bbacd87e18518b272d"} |
| name | domainchart |
A skill for expressing a DDD domain as a hierarchy of domain objects that can be rendered as a tree-style diagram. The focus is on modeling the structure correctly; the renderer is just a thin step at the end.
The skill takes an optional argument that names the scope to analyze — file paths, directory paths, or a free-form description (e.g. "the billing module"). When no argument is given, treat the entire codebase as the scope.
Execute the steps below in order. Do not skip ahead.
OrderId / UserId are Value Objects. One node per concept; don't
merge.npx domainchart types. Run the command and read its JSON Schema output. This is the
authoritative input shape — do not guess the schema from memory.name as the parent property's type to express the parent→child edge.
Collections / optionals / unions all count as references: OrderItem[], Array<OrderItem>,
Set<OrderItem>, OrderItem?, Foo | Bar, Array<Foo | Bar>.type that does not match a declared name is a primitive leaf (string, number,
Date, …).mktemp -d and write the document to
<tmp>/domainchart.json. Do not write to the project yet.npx domainchart validate <tmp>/domainchart.json. If any errors or warnings
are reported, fix the JSON and re-run. Repeat until the output is clean.npx domainchart build <tmp>/domainchart.json -o <tmp>/domainchart.html.open <tmp>/domainchart.html on
macOS).domainchart.json and
domainchart.html into the project, and where. Only copy if they confirm.OrderId) instead of by object.OtherAggregateRoot creates a child edge; referencing its ID (OtherAggregateRootId as a Value
Object) keeps the two aggregates separate.{
"title": "EC Site Domain Model",
"models": [
{
"name": "Order",
"kind": "entity",
"description": "Order aggregate root",
"properties": [
{ "name": "id", "type": "OrderId" },
{ "name": "items", "type": "OrderItem[]" },
{ "name": "customerId", "type": "CustomerId" }
]
},
{
"name": "OrderItem",
"kind": "entity",
"properties": [
{ "name": "quantity", "type": "number" },
{ "name": "unitPrice", "type": "Money" }
]
},
{
"name": "Money",
"kind": "value_object",
"properties": [
{ "name": "amount", "type": "number" },
{ "name": "currency", "type": "string" }
]
},
{
"name": "OrderId",
"kind": "value_object",
"properties": [{ "name": "value", "type": "string" }]
},
{
"name": "CustomerId",
"kind": "value_object",
"properties": [{ "name": "value", "type": "string" }]
}
]
}
Inferred result: Order becomes the aggregate root, owning OrderItem (which owns Money) and
OrderId. CustomerId is a leaf — the Customer aggregate is referenced only by ID, keeping the
two aggregates separate.