kataster 0.0.0-stage → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/acceptance-tester.md +53 -0
- package/.claude/agents/code-reviewer.md +56 -0
- package/.claude/agents/domain-architect.md +40 -0
- package/.claude/agents/lead-dev.md +50 -0
- package/.claude/agents/product-owner.md +39 -0
- package/.claude/agents/repo-analyst.md +78 -0
- package/.claude/agents/requirements-engineer.md +44 -0
- package/.claude/agents/ux-designer.md +64 -0
- package/.claude/hooks/bash-guard.ts +92 -0
- package/.claude/hooks/code-check.ts +37 -0
- package/.claude/hooks/path-guard.ts +34 -0
- package/.claude/hooks/path-rules.ts +66 -0
- package/.claude/hooks/project-check.ts +108 -0
- package/.claude/hooks/protect-files.ts +55 -0
- package/.claude/hooks/session-start.ts +213 -0
- package/.claude/hooks/stop-gate.ts +56 -0
- package/.claude/hooks/validate-docs.ts +58 -0
- package/.claude/lib/architecture.ts +736 -0
- package/.claude/lib/backlog-github.ts +454 -0
- package/.claude/lib/backlog-jira.ts +347 -0
- package/.claude/lib/backlog-sync.ts +42 -0
- package/.claude/lib/backlog.ts +396 -0
- package/.claude/lib/bazel.ts +212 -0
- package/.claude/lib/config.ts +122 -0
- package/.claude/lib/discovery.ts +821 -0
- package/.claude/lib/engineering.ts +406 -0
- package/.claude/lib/nx.ts +129 -0
- package/.claude/lib/repo.ts +1194 -0
- package/.claude/lib/toolgraph.ts +74 -0
- package/.claude/lib/turbo.ts +166 -0
- package/.claude/package-lock.json +427 -0
- package/.claude/package.json +21 -0
- package/.claude/settings.json +82 -0
- package/.claude/skills/adopt/SKILL.md +283 -0
- package/.claude/skills/adopt/scripts/boundary-check.ts +156 -0
- package/.claude/skills/adopt/scripts/package-doc.ts +71 -0
- package/.claude/skills/adopt/scripts/repo-map.ts +123 -0
- package/.claude/skills/adopt/scripts/rule-doc.ts +80 -0
- package/.claude/skills/architect/ADR-FORMAT.md +97 -0
- package/.claude/skills/architect/SKILL.md +64 -0
- package/.claude/skills/architect/TECH-STACK.md +21 -0
- package/.claude/skills/backlog/SKILL.md +198 -0
- package/.claude/skills/backlog/scripts/backlog-pull.ts +45 -0
- package/.claude/skills/backlog/scripts/backlog-push.ts +38 -0
- package/.claude/skills/backlog/scripts/backlog-status.ts +32 -0
- package/.claude/skills/backlog/scripts/jira-import.ts +40 -0
- package/.claude/skills/backlog/scripts/jira-plan.ts +26 -0
- package/.claude/skills/backlog/scripts/jira-record.ts +41 -0
- package/.claude/skills/bootstrap/SKILL.md +119 -0
- package/.claude/skills/codebase-design/DEEPENING.md +37 -0
- package/.claude/skills/codebase-design/DESIGN-IT-TWICE.md +44 -0
- package/.claude/skills/codebase-design/SKILL.md +114 -0
- package/.claude/skills/domain-model/CONTEXT-FORMAT.md +47 -0
- package/.claude/skills/domain-model/SKILL.md +64 -0
- package/.claude/skills/domain-model/templates/data-model.md +29 -0
- package/.claude/skills/engineering-conventions/SKILL.md +31 -0
- package/.claude/skills/event-storming/SKILL.md +44 -0
- package/.claude/skills/event-storming/schema/events.schema.json +124 -0
- package/.claude/skills/event-storming/scripts/render-event-storming.ts +11 -0
- package/.claude/skills/event-storming/scripts/validate-events.ts +11 -0
- package/.claude/skills/event-storming/templates/events.example.yaml +91 -0
- package/.claude/skills/feature/SKILL.md +86 -0
- package/.claude/skills/feature/scripts/intake.ts +356 -0
- package/.claude/skills/grill-me/SKILL.md +7 -0
- package/.claude/skills/grill-with-docs/SKILL.md +7 -0
- package/.claude/skills/grilling/SKILL.md +30 -0
- package/.claude/skills/groom-backlog/SKILL.md +93 -0
- package/.claude/skills/groom-backlog/scripts/backlog-health.ts +238 -0
- package/.claude/skills/implement/SKILL.md +129 -0
- package/.claude/skills/implement/scripts/affected.ts +245 -0
- package/.claude/skills/implement/scripts/check-commands.ts +37 -0
- package/.claude/skills/implement/scripts/check-language.ts +15 -0
- package/.claude/skills/implement/scripts/check-scenarios.ts +59 -0
- package/.claude/skills/implement/scripts/next-story.ts +23 -0
- package/.claude/skills/implement/scripts/story-context.ts +135 -0
- package/.claude/skills/implement/scripts/story-status.ts +47 -0
- package/.claude/skills/implement/scripts/verify.ts +92 -0
- package/.claude/skills/improve-codebase-architecture/HTML-REPORT.md +123 -0
- package/.claude/skills/improve-codebase-architecture/SKILL.md +71 -0
- package/.claude/skills/retro/SKILL.md +53 -0
- package/.claude/skills/review-stories/SKILL.md +31 -0
- package/.claude/skills/shape/SKILL.md +193 -0
- package/.claude/skills/tdd/SKILL.md +38 -0
- package/.claude/skills/tdd/mocking.md +59 -0
- package/.claude/skills/tdd/tests.md +77 -0
- package/.claude/skills/user-stories/SKILL.md +138 -0
- package/.claude/skills/user-stories/schema/story.schema.json +39 -0
- package/.claude/skills/user-stories/scripts/render-backlog.ts +4 -0
- package/.claude/skills/user-stories/scripts/validate-stories.ts +13 -0
- package/.claude/skills/user-stories/templates/story-template.md +38 -0
- package/.claude/skills/ux-design/SKILL.md +107 -0
- package/.claude/skills/writing-for-agents/SKILL-MECHANICS.md +22 -0
- package/.claude/skills/writing-for-agents/SKILL.md +81 -0
- package/.claude/tsconfig.json +15 -0
- package/.opencode/agents/acceptance-tester.md +64 -0
- package/.opencode/agents/code-reviewer.md +69 -0
- package/.opencode/agents/domain-architect.md +59 -0
- package/.opencode/agents/lead-dev.md +67 -0
- package/.opencode/agents/product-owner.md +59 -0
- package/.opencode/agents/repo-analyst.md +86 -0
- package/.opencode/agents/requirements-engineer.md +58 -0
- package/.opencode/agents/ux-designer.md +83 -0
- package/.opencode/commands/adopt.md +7 -0
- package/.opencode/commands/backlog-sync.md +7 -0
- package/.opencode/commands/bootstrap.md +7 -0
- package/.opencode/commands/event-storming.md +7 -0
- package/.opencode/commands/feature.md +7 -0
- package/.opencode/commands/grill-me.md +7 -0
- package/.opencode/commands/grill-with-docs.md +7 -0
- package/.opencode/commands/groom-backlog.md +7 -0
- package/.opencode/commands/implement.md +7 -0
- package/.opencode/commands/improve-codebase-architecture.md +7 -0
- package/.opencode/commands/retro.md +7 -0
- package/.opencode/commands/review-stories.md +7 -0
- package/.opencode/commands/shape.md +7 -0
- package/.opencode/opencode.jsonc +15 -0
- package/.opencode/plugins/kataster/index.ts +283 -0
- package/AGENTS.md +21 -0
- package/CHANGELOG.md +91 -0
- package/LICENSE +21 -0
- package/README.md +331 -2
- package/bin/kataster.mjs +7 -0
- package/extras/skills/shadcn/SKILL.md +277 -0
- package/extras/skills/shadcn/agents/openai.yml +5 -0
- package/extras/skills/shadcn/assets/shadcn-small.png +0 -0
- package/extras/skills/shadcn/assets/shadcn.png +0 -0
- package/extras/skills/shadcn/cli.md +290 -0
- package/extras/skills/shadcn/customization.md +209 -0
- package/extras/skills/shadcn/evals/evals.json +77 -0
- package/extras/skills/shadcn/mcp.md +105 -0
- package/extras/skills/shadcn/registry.md +277 -0
- package/extras/skills/shadcn/rules/base-vs-radix.md +306 -0
- package/extras/skills/shadcn/rules/chat.md +250 -0
- package/extras/skills/shadcn/rules/composition.md +213 -0
- package/extras/skills/shadcn/rules/forms.md +192 -0
- package/extras/skills/shadcn/rules/icons.md +101 -0
- package/extras/skills/shadcn/rules/styling.md +185 -0
- package/guide/README.md +9 -0
- package/guide/brownfield.md +242 -0
- package/guide/concepts.md +109 -0
- package/guide/greenfield.md +84 -0
- package/guide/install.md +144 -0
- package/guide/release.md +92 -0
- package/package.json +56 -4
- package/src/cli.mjs +302 -0
- package/src/detect.mjs +237 -0
- package/src/install.mjs +427 -0
- package/src/repo.mjs +129 -0
- package/src/util.mjs +110 -0
- package/templates/CONTEXT.md +21 -0
- package/templates/conventions.md +63 -0
- package/templates/docs/adr/README.md +7 -0
- package/templates/docs/architecture/data-model.md +31 -0
- package/templates/docs/domain/context-map.md +21 -0
- package/templates/docs/domain/events.yaml +23 -0
- package/templates/docs/product/initiatives/README.md +41 -0
- package/templates/docs/product/ux-guidelines.md +27 -0
- package/templates/docs/product/vision.md +36 -0
- package/templates/docs/reviews/.gitkeep +0 -0
- package/templates/docs/stories/OPEN_QUESTIONS.md +8 -0
- package/templates/docs/stories/README.md +26 -0
- package/templates/docs/workflow.md +135 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where does the backlog stand? Which stories are linked, which changed locally, which changed in the tracker?
|
|
3
|
+
* Writes nothing. `--check` exits 1 when there is drift, so a CI job can use it.
|
|
4
|
+
*/
|
|
5
|
+
import { loadBacklogConfig } from "../../../lib/config.ts";
|
|
6
|
+
import { statusGithub } from "../../../lib/backlog-github.ts";
|
|
7
|
+
import { jiraStatus } from "../../../lib/backlog-jira.ts";
|
|
8
|
+
|
|
9
|
+
const cfg = loadBacklogConfig();
|
|
10
|
+
if (cfg.provider === "local") {
|
|
11
|
+
console.log("Backlog: local – docs/stories/ is the backlog, nothing to sync.");
|
|
12
|
+
process.exit(0);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let result: { lines: string[]; drift: boolean };
|
|
16
|
+
try {
|
|
17
|
+
result = cfg.provider === "github" ? statusGithub(cfg) : jiraStatus(cfg);
|
|
18
|
+
} catch (error) {
|
|
19
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
console.log(`Backlog: ${cfg.provider}${cfg.provider === "jira" ? ` (${cfg.jira.project || "project not configured"})` : ""}`);
|
|
23
|
+
for (const line of result.lines) console.log(` ${line}`);
|
|
24
|
+
const drift = result.drift;
|
|
25
|
+
console.log(
|
|
26
|
+
drift
|
|
27
|
+
? `\nDrift found – ${cfg.provider === "github" ? "run /backlog-sync pull or push" : "run the MCP pull/push"}.`
|
|
28
|
+
: cfg.provider === "jira"
|
|
29
|
+
? "\nThe local mirror is consistent with the last import – run the MCP pull to compare with Jira."
|
|
30
|
+
: "\nEverything that is linked is in sync.",
|
|
31
|
+
);
|
|
32
|
+
process.exit(process.argv.includes("--check") && drift ? 1 : 0);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Imports Jira issue data into the local mirror.
|
|
3
|
+
*
|
|
4
|
+
* The agent fetches the issues with mcp-atlassian (jira_search / jira_get_issue) and writes them as JSON. Accepted
|
|
5
|
+
* shapes:
|
|
6
|
+
*
|
|
7
|
+
* [{ "key": "PROJ-123", "summary": "ST-012: …", "description": "…", "status": "Ready",
|
|
8
|
+
* "labels": ["kataster", "kataster-status-ready"], "priority": "High", "browse_url": "…" }]
|
|
9
|
+
*
|
|
10
|
+
* [{ "key": "PROJ-123", "fields": { "summary": "…", "description": "…", "status": { "name": "Ready" },
|
|
11
|
+
* "priority": { "name": "High" }, "labels": ["…"] } }]
|
|
12
|
+
*
|
|
13
|
+
* Usage: node jira-import.ts --from <issues.json>
|
|
14
|
+
*/
|
|
15
|
+
import { readFileSync } from "node:fs";
|
|
16
|
+
import { loadBacklogConfig } from "../../../lib/config.ts";
|
|
17
|
+
import { jiraImport } from "../../../lib/backlog-jira.ts";
|
|
18
|
+
|
|
19
|
+
const cfg = loadBacklogConfig();
|
|
20
|
+
const fromIndex = process.argv.indexOf("--from");
|
|
21
|
+
const from = fromIndex >= 0 ? process.argv[fromIndex + 1] : "";
|
|
22
|
+
if (!from) {
|
|
23
|
+
console.error("Usage: node jira-import.ts --from <issues.json>");
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
if (cfg.provider !== "jira") {
|
|
27
|
+
console.error(`Backlog provider is '${cfg.provider}', not 'jira'.`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
const raw = JSON.parse(readFileSync(from, "utf8"));
|
|
33
|
+
const issues = Array.isArray(raw) ? raw : raw.issues ?? raw.values ?? raw.results ?? [];
|
|
34
|
+
const report = jiraImport(cfg, issues);
|
|
35
|
+
for (const line of report.lines) console.log(line);
|
|
36
|
+
process.exit(0);
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prints the MCP calls that bring Jira in line with the local mirror, as JSON.
|
|
3
|
+
*
|
|
4
|
+
* The agent executes them with mcp-atlassian (jira_create_issue, jira_update_issue, jira_get_transitions,
|
|
5
|
+
* jira_transition_issue, jira_create_issue_link), then records the returned keys with jira-record.ts.
|
|
6
|
+
*
|
|
7
|
+
* Usage: node jira-plan.ts [ST-NNN ...]
|
|
8
|
+
*/
|
|
9
|
+
import { loadBacklogConfig } from "../../../lib/config.ts";
|
|
10
|
+
import { jiraPlan } from "../../../lib/backlog-jira.ts";
|
|
11
|
+
|
|
12
|
+
const ids = process.argv.slice(2).filter((arg) => /^ST-\d+$/i.test(arg));
|
|
13
|
+
const cfg = loadBacklogConfig();
|
|
14
|
+
|
|
15
|
+
if (cfg.provider !== "jira") {
|
|
16
|
+
console.error(`Backlog provider is '${cfg.provider}', not 'jira' – change backlog.provider in .claude/project.json.`);
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
console.log(JSON.stringify(jiraPlan(cfg, ids), null, 2));
|
|
22
|
+
process.exit(0);
|
|
23
|
+
} catch (error) {
|
|
24
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Records the Jira keys the agent got back from jira_create_issue.
|
|
3
|
+
*
|
|
4
|
+
* Input (one array for all stories):
|
|
5
|
+
* [{ "story": "ST-012", "key": "PROJ-123", "url": "https://…/browse/PROJ-123" }]
|
|
6
|
+
*
|
|
7
|
+
* Usage: node jira-record.ts --from <results.json>
|
|
8
|
+
*/
|
|
9
|
+
import { readFileSync } from "node:fs";
|
|
10
|
+
import { loadBacklogConfig } from "../../../lib/config.ts";
|
|
11
|
+
import { jiraRecord, type JiraRecord } from "../../../lib/backlog-jira.ts";
|
|
12
|
+
|
|
13
|
+
const cfg = loadBacklogConfig();
|
|
14
|
+
const fromIndex = process.argv.indexOf("--from");
|
|
15
|
+
const from = fromIndex >= 0 ? process.argv[fromIndex + 1] : "";
|
|
16
|
+
if (!from) {
|
|
17
|
+
console.error("Usage: node jira-record.ts --from <results.json>");
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
if (cfg.provider !== "jira") {
|
|
21
|
+
console.error(`Backlog provider is '${cfg.provider}', not 'jira'.`);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
const raw = JSON.parse(readFileSync(from, "utf8"));
|
|
27
|
+
const rows = Array.isArray(raw) ? raw : raw.results ?? raw.issues ?? [];
|
|
28
|
+
const results: JiraRecord[] = rows
|
|
29
|
+
.map((row: Record<string, unknown>) => ({
|
|
30
|
+
story: String(row.story ?? row.id ?? ""),
|
|
31
|
+
key: String(row.key ?? row.issue_key ?? row.issueKey ?? ""),
|
|
32
|
+
url: typeof row.url === "string" ? row.url : typeof row.browse_url === "string" ? row.browse_url : undefined,
|
|
33
|
+
}))
|
|
34
|
+
.filter((row: JiraRecord) => row.story && row.key);
|
|
35
|
+
const lines = jiraRecord(cfg, results);
|
|
36
|
+
for (const line of lines) console.log(line);
|
|
37
|
+
process.exit(lines.some((line) => line.startsWith("skip")) ? 1 : 0);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bootstrap
|
|
3
|
+
description: Greenfield entry point – grills the vision, runs a big-picture event storming, builds the domain model and architecture with ADRs, sets the UX yardstick and derives the foundation stories and first vertical slice. Use when starting a new project.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
argument-hint: "[project idea in one sentence – empty = ask first]"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Bootstrap a New Project
|
|
9
|
+
|
|
10
|
+
You are starting from nothing but an idea. The order is fixed: **vision → domain → architecture → UX → stories**.
|
|
11
|
+
Technology comes after the domain, never before it.
|
|
12
|
+
|
|
13
|
+
Idea: the arguments from the invocation (empty → ask the user for one sentence first).
|
|
14
|
+
|
|
15
|
+
## Preconditions
|
|
16
|
+
|
|
17
|
+
1. Read `.claude/project.json`. If it is missing, tell the user to run `npx kataster init` first and stop.
|
|
18
|
+
2. If the repository already has code, this is the wrong command: use `/adopt`.
|
|
19
|
+
3. Call the `skill` tool for `grilling` and `domain-model`. Grilling sets how you ask; domain-model sets how the
|
|
20
|
+
glossary is written.
|
|
21
|
+
|
|
22
|
+
## Phase 1 – Grill the vision
|
|
23
|
+
|
|
24
|
+
The frontier is every `[OPEN]` in `docs/product/vision.md`: problem, user groups, goals, non-goals, success
|
|
25
|
+
criteria, constraints, the domain in one paragraph. Work it in rounds as the `grilling` skill says – numbered
|
|
26
|
+
questions, recommended answer each, whole frontier per round.
|
|
27
|
+
|
|
28
|
+
Rules for this phase:
|
|
29
|
+
|
|
30
|
+
- **No technology.** No framework, no database, no hosting. If the user starts there, park it: "that is an ADR
|
|
31
|
+
after the domain, and the domain may change the answer."
|
|
32
|
+
- **Force a non-goal.** A vision without a "we will not do this" is a wish list.
|
|
33
|
+
- **Success criteria must be measurable**, or they are not criteria.
|
|
34
|
+
- **Write as you go**: remove answered `[OPEN]`s from `docs/product/vision.md`; resolved terms go into
|
|
35
|
+
`CONTEXT.md` immediately (domain-model skill).
|
|
36
|
+
|
|
37
|
+
Stop when the frontier is empty and the user confirms a shared understanding.
|
|
38
|
+
|
|
39
|
+
## Phase 2 – Big-picture event storming
|
|
40
|
+
|
|
41
|
+
Read `.claude/skills/event-storming/SKILL.md` and follow it with the whole domain as focus. Phases 1–6 are
|
|
42
|
+
mandatory; 7–8 are the proposal you hand to the architect.
|
|
43
|
+
|
|
44
|
+
- 8–15 suspected events as a starting point, in the user's words, past tense.
|
|
45
|
+
- Order them into `flows` – one per business process. Mark pivotal events.
|
|
46
|
+
- Collect hotspots systematically; grill the ones the user can decide now.
|
|
47
|
+
- Commands and actors, policies (including time-triggered), read models.
|
|
48
|
+
- Write `docs/domain/events.yaml` after **every** phase. The hook validates and renders it; fix errors at once.
|
|
49
|
+
|
|
50
|
+
Stop when every event has an aggregate or context, every command a trigger, and no hotspot blocks a boundary.
|
|
51
|
+
|
|
52
|
+
## Phase 3 – Domain model and architecture
|
|
53
|
+
|
|
54
|
+
Delegate to `domain-architect` with the file paths and the IDs from `events.yaml`: bounded contexts, context map,
|
|
55
|
+
aggregates with testable invariants, and the logical data model. The agent proposes; the user decides.
|
|
56
|
+
|
|
57
|
+
Then the architecture, in this order:
|
|
58
|
+
|
|
59
|
+
1. **Shape** – the simplest architecture that meets the documented requirements. A monolith is the default;
|
|
60
|
+
anything distributed needs a cited requirement.
|
|
61
|
+
2. **Tech stack** – only now, following `.claude/skills/architect/TECH-STACK.md`. One ADR
|
|
62
|
+
(`docs/adr/0001-tech-stack.md`, `status: proposed`), with the driving requirements cited from
|
|
63
|
+
`docs/product/vision.md` and `docs/domain/events.yaml`. **Only the user sets `accepted`.**
|
|
64
|
+
3. **Other decisions** – only the ones that pass the architect skill's three criteria. Not every library.
|
|
65
|
+
|
|
66
|
+
## Phase 4 – UX yardstick
|
|
67
|
+
|
|
68
|
+
Call the `skill` tool for `ux-design`. Grill the questions the vision does not settle:
|
|
69
|
+
|
|
70
|
+
- devices and the design size (the size the layout is built for, not the exception),
|
|
71
|
+
- UI language(s) and where terms come from,
|
|
72
|
+
- the states every screen needs (empty, full, rejected, no permission),
|
|
73
|
+
- the recurring patterns worth a G-number.
|
|
74
|
+
|
|
75
|
+
Delegate to `ux-designer`: write the approved decisions into `docs/product/ux-guidelines.md` as rules with date
|
|
76
|
+
and reason. Do not let it become a mood board.
|
|
77
|
+
|
|
78
|
+
## Phase 5 – Foundation stories and the first slice
|
|
79
|
+
|
|
80
|
+
Delegate to `requirements-engineer` in two parts:
|
|
81
|
+
|
|
82
|
+
1. **Foundation tech tasks** – what every later story relies on: repository skeleton, the single quality command
|
|
83
|
+
(`verify`), CI, the test harness and test data approach, auth/roles if the vision needs them, deployment.
|
|
84
|
+
Each is a tech task with a checklist and `depends_on`, not a domain story. Keep them minimal: foundation just
|
|
85
|
+
in time, not a platform project.
|
|
86
|
+
2. **The first vertical slice** – the smallest set of stories that delivers one real end-to-end path from the
|
|
87
|
+
vision (e.g. "report → triage → resolve"), each a story with Gherkin scenarios, `ui` where a person sees
|
|
88
|
+
something.
|
|
89
|
+
|
|
90
|
+
Rules: at most 10 scenarios per story; no implementation plan inside a domain story; every story links its
|
|
91
|
+
`events`; `status: draft`, then `review` when finished.
|
|
92
|
+
|
|
93
|
+
## Phase 6 – Review
|
|
94
|
+
|
|
95
|
+
Read `.claude/skills/review-stories/SKILL.md` and follow it with the story IDs from Phase 5. The user approves
|
|
96
|
+
every `ready`. Fix what the review finds through `requirements-engineer` – never by editing a story into shape
|
|
97
|
+
yourself when the change is structural.
|
|
98
|
+
|
|
99
|
+
## Phase 7 – Wrap-up
|
|
100
|
+
|
|
101
|
+
Summarize: vision settled (and what stayed open), number of events/commands/policies/read models, contexts and
|
|
102
|
+
aggregates, ADRs proposed, UX guidelines written, stories created and their review outcome.
|
|
103
|
+
|
|
104
|
+
Then name the next step:
|
|
105
|
+
|
|
106
|
+
- `node .claude/skills/implement/scripts/verify.ts` should be green before the first `/implement`.
|
|
107
|
+
- `/implement` for the first foundation story; `/feature <idea>` once the domain has a language and the
|
|
108
|
+
foundation stands.
|
|
109
|
+
- `/groom-backlog` after the first bounded context is complete.
|
|
110
|
+
|
|
111
|
+
## Rules
|
|
112
|
+
|
|
113
|
+
- **Domain before technology, always.** If a technology question blocks the domain, it is a spike with a timebox,
|
|
114
|
+
not an architecture decision made in advance.
|
|
115
|
+
- **No invented requirements.** Every ADR cites a path in `docs/`. No documented requirement → no complexity.
|
|
116
|
+
- **The user owns the language and the decisions.** You propose; they confirm. Accepted ADRs are theirs to set.
|
|
117
|
+
- **Stop at checkpoints.** After vision, after event storming, after the model, after the stories – summarize in
|
|
118
|
+
3–5 lines and ask whether to continue. A bootstrap that runs to the end without a checkpoint produces a
|
|
119
|
+
beautiful model nobody agreed to.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Deepening
|
|
2
|
+
|
|
3
|
+
How to deepen a cluster of shallow modules safely, given its dependencies. Assumes the vocabulary in [SKILL.md](SKILL.md): **module**, **interface**, **seam**, **adapter**.
|
|
4
|
+
|
|
5
|
+
## Dependency categories
|
|
6
|
+
|
|
7
|
+
When assessing a candidate for deepening, classify its dependencies. The category determines how the deepened module is tested across its seam.
|
|
8
|
+
|
|
9
|
+
### 1. In-process
|
|
10
|
+
|
|
11
|
+
Pure computation, in-memory state, no I/O. Always deepenable: merge the modules and test through the new interface directly. No adapter needed.
|
|
12
|
+
|
|
13
|
+
### 2. Local-substitutable
|
|
14
|
+
|
|
15
|
+
Dependencies that have local test stand-ins (PGLite for Postgres, in-memory filesystem). Deepenable if the stand-in exists. The deepened module is tested with the stand-in running in the test suite. The seam is internal; no port at the module's external interface.
|
|
16
|
+
|
|
17
|
+
### 3. Remote but owned (Ports & Adapters)
|
|
18
|
+
|
|
19
|
+
Your own services across a network boundary (microservices, internal APIs). Define a **port** (interface) at the seam. The deep module owns the logic; the transport is injected as an **adapter**. Tests use an in-memory adapter. Production uses an HTTP/gRPC/queue adapter.
|
|
20
|
+
|
|
21
|
+
Recommendation shape: *"Define a port at the seam, implement an HTTP adapter for production and an in-memory adapter for testing, so the logic sits in one deep module even though it's deployed across a network."*
|
|
22
|
+
|
|
23
|
+
### 4. True external (Mock)
|
|
24
|
+
|
|
25
|
+
Third-party services (Stripe, Twilio, etc.) you don't control. The deepened module takes the external dependency as an injected port; tests provide a mock adapter.
|
|
26
|
+
|
|
27
|
+
## Seam discipline
|
|
28
|
+
|
|
29
|
+
- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a port unless at least two adapters are justified (typically production + test). A single-adapter seam is just indirection.
|
|
30
|
+
- **Internal seams vs external seams.** A deep module can have internal seams (private to its implementation, used by its own tests) as well as the external seam at its interface. Don't expose internal seams through the interface just because tests use them.
|
|
31
|
+
|
|
32
|
+
## Testing strategy: replace, don't layer
|
|
33
|
+
|
|
34
|
+
- Old unit tests on shallow modules become waste once tests at the deepened module's interface exist; delete them.
|
|
35
|
+
- Write new tests at the deepened module's interface. The **interface is the test surface**.
|
|
36
|
+
- Tests assert on observable outcomes through the interface, not internal state.
|
|
37
|
+
- Tests should survive internal refactors, since they describe behaviour, not implementation. If a test has to change when the implementation changes, it's testing past the interface.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Design It Twice
|
|
2
|
+
|
|
3
|
+
When the user wants to explore alternative interfaces for a chosen deepening candidate, use this parallel sub-agent pattern. Based on "Design It Twice" (Ousterhout): your first idea is unlikely to be the best.
|
|
4
|
+
|
|
5
|
+
Uses the vocabulary in [SKILL.md](SKILL.md): **module**, **interface**, **seam**, **adapter**, **leverage**.
|
|
6
|
+
|
|
7
|
+
## Process
|
|
8
|
+
|
|
9
|
+
### 1. Frame the problem space
|
|
10
|
+
|
|
11
|
+
Before spawning sub-agents, write a user-facing explanation of the problem space for the chosen candidate:
|
|
12
|
+
|
|
13
|
+
- The constraints any new interface would need to satisfy
|
|
14
|
+
- The dependencies it would rely on, and which category they fall into (see [DEEPENING.md](DEEPENING.md))
|
|
15
|
+
- A rough illustrative code sketch to ground the constraints, not a proposal, just a way to make the constraints concrete
|
|
16
|
+
|
|
17
|
+
Show this to the user, then immediately proceed to Step 2. The user reads and thinks while the sub-agents work in parallel.
|
|
18
|
+
|
|
19
|
+
### 2. Spawn sub-agents
|
|
20
|
+
|
|
21
|
+
Spawn 3+ sub-agents in parallel. Each must produce a **radically different** interface for the deepened module.
|
|
22
|
+
|
|
23
|
+
Prompt each sub-agent with a separate technical brief (file paths, coupling details, dependency category from [DEEPENING.md](DEEPENING.md), what sits behind the seam). The brief is independent of the user-facing problem-space explanation in Step 1. Give each agent a different design constraint:
|
|
24
|
+
|
|
25
|
+
- Agent 1: "Minimize the interface: aim for 1–3 entry points max. Maximise leverage per entry point."
|
|
26
|
+
- Agent 2: "Maximise flexibility: support many use cases and extension."
|
|
27
|
+
- Agent 3: "Optimise for the most common caller: make the default case trivial."
|
|
28
|
+
- Agent 4 (if applicable): "Design around ports & adapters for cross-seam dependencies."
|
|
29
|
+
|
|
30
|
+
Include both [SKILL.md](SKILL.md) vocabulary and CONTEXT.md vocabulary in the brief so each sub-agent names things consistently with the architecture language and the project's domain language.
|
|
31
|
+
|
|
32
|
+
Each sub-agent outputs:
|
|
33
|
+
|
|
34
|
+
1. Interface (types, methods, params, plus invariants, ordering, error modes)
|
|
35
|
+
2. Usage example showing how callers use it
|
|
36
|
+
3. What the implementation hides behind the seam
|
|
37
|
+
4. Dependency strategy and adapters (see [DEEPENING.md](DEEPENING.md))
|
|
38
|
+
5. Trade-offs: where leverage is high, where it's thin
|
|
39
|
+
|
|
40
|
+
### 3. Present and compare
|
|
41
|
+
|
|
42
|
+
Present designs sequentially so the user can absorb each one, then compare them in prose. Contrast by **depth** (leverage at the interface), **locality** (where change concentrates), and **seam placement**.
|
|
43
|
+
|
|
44
|
+
After comparing, give your own recommendation: which design you think is strongest and why. If elements from different designs would combine well, propose a hybrid. Be opinionated: the user wants a strong read, not a menu.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codebase-design
|
|
3
|
+
description: Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Codebase Design
|
|
7
|
+
|
|
8
|
+
Design **deep modules**: a lot of behaviour behind a small interface, placed at a clean seam, testable through that interface. Use this language and these principles wherever code is being designed or restructured. The aim is leverage for callers, locality for maintainers, and testability for everyone.
|
|
9
|
+
|
|
10
|
+
## Glossary
|
|
11
|
+
|
|
12
|
+
Use these terms exactly: don't substitute "component," "service," "API," or "boundary." Consistent language is the whole point.
|
|
13
|
+
|
|
14
|
+
**Module**: anything with an interface and an implementation. Deliberately scale-agnostic: a function, class, package, or tier-spanning slice. _Avoid_: unit, component, service.
|
|
15
|
+
|
|
16
|
+
**Interface**: everything a caller must know to use the module correctly: the type signature, but also invariants, ordering constraints, error modes, required configuration, and performance characteristics. _Avoid_: API, signature (too narrow, they refer only to the type-level surface).
|
|
17
|
+
|
|
18
|
+
**Implementation**: what's inside a module, its body of code. Distinct from **Adapter**: a thing can be a small adapter with a large implementation (a Postgres repo) or a large adapter with a small implementation (an in-memory fake). Reach for "adapter" when the seam is the topic; "implementation" otherwise.
|
|
19
|
+
|
|
20
|
+
**Depth**: leverage at the interface. The amount of behaviour a caller (or test) can exercise per unit of interface they have to learn. A module is **deep** when a large amount of behaviour sits behind a small interface, **shallow** when the interface is nearly as complex as the implementation.
|
|
21
|
+
|
|
22
|
+
**Seam** _(Michael Feathers)_: a place where you can alter behaviour without editing in that place; the *location* at which a module's interface lives. Where to put the seam is its own design decision, distinct from what goes behind it. _Avoid_: boundary (overloaded with DDD's bounded context).
|
|
23
|
+
|
|
24
|
+
**Adapter**: a concrete thing that satisfies an interface at a seam. Describes *role* (what slot it fills), not substance (what's inside).
|
|
25
|
+
|
|
26
|
+
**Leverage**: what callers get from depth. More capability per unit of interface they learn. One implementation pays back across N call sites and M tests.
|
|
27
|
+
|
|
28
|
+
**Locality**: what maintainers get from depth. Change, bugs, knowledge, and verification concentrate in one place rather than spreading across callers. Fix once, fixed everywhere.
|
|
29
|
+
|
|
30
|
+
## Deep vs shallow
|
|
31
|
+
|
|
32
|
+
**Deep module** = small interface + lots of implementation:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
┌─────────────────────┐
|
|
36
|
+
│ Small Interface │ ← Few methods, simple params
|
|
37
|
+
├─────────────────────┤
|
|
38
|
+
│ │
|
|
39
|
+
│ Deep Implementation│ ← Complex logic hidden
|
|
40
|
+
│ │
|
|
41
|
+
└─────────────────────┘
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Shallow module** = large interface + little implementation (avoid):
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
┌─────────────────────────────────┐
|
|
48
|
+
│ Large Interface │ ← Many methods, complex params
|
|
49
|
+
├─────────────────────────────────┤
|
|
50
|
+
│ Thin Implementation │ ← Just passes through
|
|
51
|
+
└─────────────────────────────────┘
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
When designing an interface, ask:
|
|
55
|
+
|
|
56
|
+
- Can I reduce the number of methods?
|
|
57
|
+
- Can I simplify the parameters?
|
|
58
|
+
- Can I hide more complexity inside?
|
|
59
|
+
|
|
60
|
+
## Principles
|
|
61
|
+
|
|
62
|
+
- **Depth is a property of the interface, not the implementation.** A deep module can be internally composed of small, mockable, swappable parts; they just aren't part of the interface. A module can have **internal seams** (private to its implementation, used by its own tests) as well as the **external seam** at its interface.
|
|
63
|
+
- **The deletion test.** Imagine deleting the module. If complexity vanishes, it was a pass-through. If complexity reappears across N callers, it was earning its keep.
|
|
64
|
+
- **The interface is the test surface.** Callers and tests cross the same seam. If you want to test *past* the interface, the module is probably the wrong shape.
|
|
65
|
+
- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a seam unless something actually varies across it.
|
|
66
|
+
|
|
67
|
+
## Designing for testability
|
|
68
|
+
|
|
69
|
+
Good interfaces make testing natural:
|
|
70
|
+
|
|
71
|
+
1. **Accept dependencies, don't create them.**
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
// Testable
|
|
75
|
+
function processOrder(order, paymentGateway) {}
|
|
76
|
+
|
|
77
|
+
// Hard to test
|
|
78
|
+
function processOrder(order) {
|
|
79
|
+
const gateway = new StripeGateway();
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
2. **Return results, don't produce side effects.**
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
// Testable
|
|
87
|
+
function calculateDiscount(cart): Discount {}
|
|
88
|
+
|
|
89
|
+
// Hard to test
|
|
90
|
+
function applyDiscount(cart): void {
|
|
91
|
+
cart.total -= discount;
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
3. **Small surface area.** Fewer methods = fewer tests needed. Fewer params = simpler test setup.
|
|
96
|
+
|
|
97
|
+
## Relationships
|
|
98
|
+
|
|
99
|
+
- A **Module** has exactly one **Interface** (the surface it presents to callers and tests).
|
|
100
|
+
- **Depth** is a property of a **Module**, measured against its **Interface**.
|
|
101
|
+
- A **Seam** is where a **Module**'s **Interface** lives.
|
|
102
|
+
- An **Adapter** sits at a **Seam** and satisfies the **Interface**.
|
|
103
|
+
- **Depth** produces **Leverage** for callers and **Locality** for maintainers.
|
|
104
|
+
|
|
105
|
+
## Rejected framings
|
|
106
|
+
|
|
107
|
+
- **Depth as ratio of implementation-lines to interface-lines** (Ousterhout): rewards padding the implementation. We use depth-as-leverage instead.
|
|
108
|
+
- **"Interface" as the TypeScript `interface` keyword or a class's public methods**: too narrow: interface here includes every fact a caller must know.
|
|
109
|
+
- **"Boundary"**: overloaded with DDD's bounded context. Say **seam** or **interface**.
|
|
110
|
+
|
|
111
|
+
## Going deeper
|
|
112
|
+
|
|
113
|
+
- **Deepening a cluster given its dependencies**, see [DEEPENING.md](DEEPENING.md): dependency categories, seam discipline, and replace-don't-layer testing.
|
|
114
|
+
- **Exploring alternative interfaces**, see [DESIGN-IT-TWICE.md](DESIGN-IT-TWICE.md): spin up parallel sub-agents to design the interface several radically different ways, then compare on depth, locality, and seam placement.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# CONTEXT.md Format
|
|
2
|
+
|
|
3
|
+
`CONTEXT.md` at the repo root is the glossary – the single source of truth for domain language.
|
|
4
|
+
|
|
5
|
+
## Structure
|
|
6
|
+
|
|
7
|
+
```md
|
|
8
|
+
# <Project>
|
|
9
|
+
|
|
10
|
+
{One or two sentence description of the domain.}
|
|
11
|
+
|
|
12
|
+
## Language
|
|
13
|
+
|
|
14
|
+
### Defect Reporting
|
|
15
|
+
|
|
16
|
+
**Defect**:
|
|
17
|
+
{A one or two sentence description of the term}
|
|
18
|
+
_Avoid_: Bug, error, issue
|
|
19
|
+
|
|
20
|
+
**Defect report**:
|
|
21
|
+
A message from anyone about something wrong with an item, before it has been assessed.
|
|
22
|
+
_Avoid_: Ticket, complaint
|
|
23
|
+
_UI (en)_: report
|
|
24
|
+
|
|
25
|
+
### Workshop
|
|
26
|
+
|
|
27
|
+
**Repair**:
|
|
28
|
+
Work carried out by a technician to remove one or more defects from an item.
|
|
29
|
+
_Avoid_: Fix, service
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Rules
|
|
33
|
+
|
|
34
|
+
- **Be opinionated.** When multiple words exist for the same concept, pick the best one and list the others under `_Avoid_`.
|
|
35
|
+
- **Keep definitions tight.** One or two sentences max. Define what it IS, not what it does.
|
|
36
|
+
- **UI wording.** The UI language comes from `.claude/project.json` (`languages.ui`). Every term gets a
|
|
37
|
+
`_UI (<lang>)_` line with the one word the UI uses for it – no synonyms in the UI either.
|
|
38
|
+
- **Only include terms specific to this domain.** General programming concepts (timeouts, error types, utility patterns) don't belong. Before adding a term, ask: is this a concept unique to the domain, or a general concept? Only the former belongs.
|
|
39
|
+
- **Group terms by bounded context** (subheadings named like the contexts in `docs/domain/events.yaml`) once contexts exist. Before that, a flat list is fine. Terms used across contexts go under `### Shared`.
|
|
40
|
+
- The same word with different meanings in two contexts gets one entry per context, each defined for its context.
|
|
41
|
+
- Names of events, commands etc. in `events.yaml` and all stories use these terms exactly.
|
|
42
|
+
|
|
43
|
+
## Single vs multi-context
|
|
44
|
+
|
|
45
|
+
During discovery there is one root `CONTEXT.md`, grouped by bounded context; the relationships between contexts are in `docs/domain/context-map.md`.
|
|
46
|
+
|
|
47
|
+
When code exists and contexts become separate modules, the glossary may be split: a root `CONTEXT-MAP.md` lists the contexts and links to one `CONTEXT.md` per module (e.g. `src/workshop/CONTEXT.md`). Only split when the code is actually structured that way – decide it via ADR.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: domain-model
|
|
3
|
+
description: Build and sharpen the project's domain model – the ubiquitous language in CONTEXT.md, bounded contexts, context map, aggregates/invariants and the logical, stack-neutral data model based on docs/domain/events.yaml. Use when discussing domain terminology, writing or editing CONTEXT.md, or modeling contexts, aggregates and data.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Domain Modeling
|
|
7
|
+
|
|
8
|
+
Actively build and sharpen the domain model as you go. This is the *active* discipline: challenging terms, inventing edge-case scenarios, and writing the glossary and the model down the moment they crystallise. (Merely *reading* `CONTEXT.md` for vocabulary is not this skill: that's a one-line habit every skill and agent has. This skill is for when you're changing the model, not just consuming it.)
|
|
9
|
+
|
|
10
|
+
Architecture decisions (ADRs, tech stack) belong to the `architect` skill. The domain comes first.
|
|
11
|
+
|
|
12
|
+
## Files
|
|
13
|
+
|
|
14
|
+
| What | Where |
|
|
15
|
+
|---|---|
|
|
16
|
+
| Glossary (ubiquitous language) | `CONTEXT.md` at the repo root – format: [CONTEXT-FORMAT.md](./CONTEXT-FORMAT.md) |
|
|
17
|
+
| Event storming model incl. `bounded_contexts`, `aggregates` | `docs/domain/events.yaml` |
|
|
18
|
+
| Context map | `docs/domain/context-map.md` |
|
|
19
|
+
| Logical data model | `docs/architecture/data-model.md` – template: `templates/data-model.md` |
|
|
20
|
+
|
|
21
|
+
## 1. Language (during every session)
|
|
22
|
+
|
|
23
|
+
### Challenge against the glossary
|
|
24
|
+
When the user uses a term that conflicts with the existing language in `CONTEXT.md`, call it out immediately. "Your glossary defines 'invoice' as X, but you seem to mean Y. Which is it?"
|
|
25
|
+
|
|
26
|
+
### Sharpen fuzzy language
|
|
27
|
+
When the user uses vague or overloaded terms, propose a precise canonical term. "You're saying 'order': do you mean the customer's request, or the shipment that fulfils it? Those are different things."
|
|
28
|
+
|
|
29
|
+
### Discuss concrete scenarios
|
|
30
|
+
When domain relationships are being discussed, stress-test them with specific scenarios. Invent scenarios that probe edge cases and force the user to be precise about the boundaries between concepts. "A customer reports the same problem on an item that already has an open case – a new case or the same one?"
|
|
31
|
+
|
|
32
|
+
### Cross-reference with docs and code
|
|
33
|
+
When the user states how something works, check whether `docs/domain/events.yaml`, the stories (and the code, once it exists) agree. If you find a contradiction, surface it.
|
|
34
|
+
|
|
35
|
+
### Update CONTEXT.md inline
|
|
36
|
+
When a term is resolved, update `CONTEXT.md` right there. Don't batch these up: capture them as they happen. `CONTEXT.md` is totally devoid of implementation details. It is a glossary and nothing else – not a spec, not a scratch pad.
|
|
37
|
+
|
|
38
|
+
Same word, different meaning in two places → a hint at a bounded context boundary (see 2).
|
|
39
|
+
|
|
40
|
+
## 2. Bounded Contexts & Context Map
|
|
41
|
+
- Draw boundaries along language (same word, different meaning → different context) and responsibility (who decides?).
|
|
42
|
+
- `docs/domain/context-map.md`: per context its purpose, core terms, owner role. Relationships as a Mermaid `flowchart` using the patterns Customer/Supplier, Conformist, Anti-Corruption Layer, Shared Kernel, Published Language.
|
|
43
|
+
- 2–4 contexts are typical for a small system. More only with justification.
|
|
44
|
+
- Maintain them in `events.yaml` under `bounded_contexts`, and group the terms in `CONTEXT.md` by context.
|
|
45
|
+
|
|
46
|
+
## 3. Aggregates
|
|
47
|
+
- An aggregate protects invariants that must be consistent **immediately**. Everything else is eventually consistent via events/policies.
|
|
48
|
+
- Keep them small. Reference other aggregates by ID only.
|
|
49
|
+
- Per aggregate in `events.yaml`: `context`, `invariants` (as testable statements). Assign commands and events via `aggregate`.
|
|
50
|
+
- **An invariant is stated once, on the aggregate** (user, 2026-10-01). A command's `rules` list only what it adds beyond them: defaults, actor permissions no invariant carries, required input, checks across aggregate or context boundaries, and consequences of the transition. Everything the stored state has to satisfy is an invariant, not a rule – the requirements-engineer reads both when deriving scenarios.
|
|
51
|
+
- Sign of a wrong aggregate: a command needs data from several aggregates to check a rule.
|
|
52
|
+
|
|
53
|
+
## 4. Logical Data Model (`docs/architecture/data-model.md`)
|
|
54
|
+
- Per aggregate: root entity, entities, value objects, attributes with **domain** types (e.g. `SerialNumber`, `Money`, `Timestamp`), required/optional.
|
|
55
|
+
- Lifecycle as a Mermaid `stateDiagram-v2` (derive states from the events).
|
|
56
|
+
- Overall view as a Mermaid `erDiagram` (logical, no database types).
|
|
57
|
+
- **Traceability**: every attribute comes from the `data` of an event or the `fields` of a read model. Attributes without a source → hotspot.
|
|
58
|
+
- Stack-neutral until an ADR decides the stack. After that, a "Physical Model" section may follow.
|
|
59
|
+
|
|
60
|
+
## 5. Quality Check Before Hand-off
|
|
61
|
+
- Every term used in events, commands and stories is in `CONTEXT.md`; no `_Avoid_` term is used anywhere.
|
|
62
|
+
- Every event has an aggregate or context, every command a trigger (actor or policy).
|
|
63
|
+
- No open hotspots that affect an aggregate or a context boundary – otherwise present them to the user.
|
|
64
|
+
- `node .claude/skills/event-storming/scripts/validate-events.ts` passes.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Logical Data Model
|
|
2
|
+
|
|
3
|
+
> Stack-neutral. Source: `docs/domain/events.yaml`. As of: <date>
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
```mermaid
|
|
8
|
+
erDiagram
|
|
9
|
+
AGGREGATE_A ||--o{ ENTITY_B : contains
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## <Aggregate name> (`AGG-…`, context `BC-…`)
|
|
13
|
+
|
|
14
|
+
**Invariants**
|
|
15
|
+
- …
|
|
16
|
+
|
|
17
|
+
**Lifecycle**
|
|
18
|
+
|
|
19
|
+
```mermaid
|
|
20
|
+
stateDiagram-v2
|
|
21
|
+
[*] --> StateA : EVT-…
|
|
22
|
+
StateA --> StateB : EVT-…
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
| Element | Kind (root/entity/VO) | Attribute | Domain type | Required | Source (event/read model) |
|
|
26
|
+
|---|---|---|---|---|---|
|
|
27
|
+
| … | Root | … | … | yes | EVT-… |
|
|
28
|
+
|
|
29
|
+
**Open points:** HS-…
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: engineering-conventions
|
|
3
|
+
description: How the code is built in this repository – module layout, commands, event journal, version checks, policies, read models, time-based rules, UI texts, test data and the seam catalog. Read it before planning or writing code for a story (/implement), and in code reviews.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Engineering Conventions
|
|
7
|
+
|
|
8
|
+
The conventions themselves live in **`docs/engineering/conventions.md`** – they are repository-specific and grow
|
|
9
|
+
with the code. This skill is the rule for using them:
|
|
10
|
+
|
|
11
|
+
1. **Read `docs/engineering/conventions.md` before writing code for a story.** It overrides general preferences.
|
|
12
|
+
If the file is missing or still full of `[OPEN]` markers, say so: the conventions are written after the
|
|
13
|
+
foundation stories exist (or by `/adopt` for an existing codebase), not before.
|
|
14
|
+
2. **The seam catalog lives there.** `/implement` only stops for the user when a story needs a seam that is not in
|
|
15
|
+
the catalog; seams in the catalog are pre-approved.
|
|
16
|
+
3. **When code and conventions disagree, raise it** – don't silently follow either. A change to the conventions is
|
|
17
|
+
a decision for the user, and `/retro` is the place to propose it.
|
|
18
|
+
|
|
19
|
+
The document must answer, at minimum:
|
|
20
|
+
|
|
21
|
+
| Topic | Question it answers |
|
|
22
|
+
|---|---|
|
|
23
|
+
| Module layout | Which directories exist, what belongs in each, which imports are allowed across them? |
|
|
24
|
+
| Commands and events | How does a command run (transaction, authorization, version check)? Where do domain events go? How are automatic policies triggered? |
|
|
25
|
+
| Read models | Where do queries live, how do they stay out of the write path? |
|
|
26
|
+
| Time-based rules | How is "now" injected so due/overdue rules are testable? |
|
|
27
|
+
| UI and texts | Where do texts live, in which language(s), which shared frames/components exist? |
|
|
28
|
+
| Test data and seams | Test data builders, fixed clock, database per run – and the seam catalog: which seam each kind of code is tested at. |
|
|
29
|
+
|
|
30
|
+
`templates/conventions.md` in the Kataster package is the starting point the installer copies to
|
|
31
|
+
`docs/engineering/conventions.md`.
|