domain-knowledge-kit 0.2.15 → 0.2.19
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/README.md +4 -0
- package/dist/cli.js +24 -1
- package/dist/cli.js.map +1 -1
- package/dist/features/agent/commands/init.d.ts +90 -1
- package/dist/features/agent/commands/init.d.ts.map +1 -1
- package/dist/features/agent/commands/init.js +328 -32
- package/dist/features/agent/commands/init.js.map +1 -1
- package/dist/features/agent/commands/prime.d.ts +11 -0
- package/dist/features/agent/commands/prime.d.ts.map +1 -1
- package/dist/features/agent/commands/prime.js +105 -8
- package/dist/features/agent/commands/prime.js.map +1 -1
- package/dist/features/agent/commands/update.d.ts +27 -0
- package/dist/features/agent/commands/update.d.ts.map +1 -0
- package/dist/features/agent/commands/update.js +316 -0
- package/dist/features/agent/commands/update.js.map +1 -0
- package/dist/features/agent/dkk-artifacts.d.ts +76 -0
- package/dist/features/agent/dkk-artifacts.d.ts.map +1 -0
- package/dist/features/agent/dkk-artifacts.js +328 -0
- package/dist/features/agent/dkk-artifacts.js.map +1 -0
- package/dist/features/agent/install-mode.d.ts +34 -0
- package/dist/features/agent/install-mode.d.ts.map +1 -0
- package/dist/features/agent/install-mode.js +78 -0
- package/dist/features/agent/install-mode.js.map +1 -0
- package/dist/features/agent/mcp-register.d.ts +20 -0
- package/dist/features/agent/mcp-register.d.ts.map +1 -0
- package/dist/features/agent/mcp-register.js +116 -0
- package/dist/features/agent/mcp-register.js.map +1 -0
- package/dist/features/agent/settings-prune.d.ts +29 -0
- package/dist/features/agent/settings-prune.d.ts.map +1 -0
- package/dist/features/agent/settings-prune.js +70 -0
- package/dist/features/agent/settings-prune.js.map +1 -0
- package/dist/features/agent/tests/settings-prune.test.d.ts +2 -0
- package/dist/features/agent/tests/settings-prune.test.d.ts.map +1 -0
- package/dist/features/agent/tests/settings-prune.test.js +118 -0
- package/dist/features/agent/tests/settings-prune.test.js.map +1 -0
- package/dist/features/federation/commands/consumers.d.ts +40 -0
- package/dist/features/federation/commands/consumers.d.ts.map +1 -0
- package/dist/features/federation/commands/consumers.js +126 -0
- package/dist/features/federation/commands/consumers.js.map +1 -0
- package/dist/features/federation/commands/peers-add.d.ts +14 -0
- package/dist/features/federation/commands/peers-add.d.ts.map +1 -0
- package/dist/features/federation/commands/peers-add.js +79 -0
- package/dist/features/federation/commands/peers-add.js.map +1 -0
- package/dist/features/federation/commands/peers-list.d.ts +8 -0
- package/dist/features/federation/commands/peers-list.d.ts.map +1 -0
- package/dist/features/federation/commands/peers-list.js +51 -0
- package/dist/features/federation/commands/peers-list.js.map +1 -0
- package/dist/features/federation/commands/peers-status.d.ts +8 -0
- package/dist/features/federation/commands/peers-status.d.ts.map +1 -0
- package/dist/features/federation/commands/peers-status.js +78 -0
- package/dist/features/federation/commands/peers-status.js.map +1 -0
- package/dist/features/federation/commands/pull.d.ts +18 -0
- package/dist/features/federation/commands/pull.d.ts.map +1 -0
- package/dist/features/federation/commands/pull.js +153 -0
- package/dist/features/federation/commands/pull.js.map +1 -0
- package/dist/features/federation/git-fetcher.d.ts +45 -0
- package/dist/features/federation/git-fetcher.d.ts.map +1 -0
- package/dist/features/federation/git-fetcher.js +70 -0
- package/dist/features/federation/git-fetcher.js.map +1 -0
- package/dist/features/federation/loader.d.ts +60 -0
- package/dist/features/federation/loader.d.ts.map +1 -0
- package/dist/features/federation/loader.js +193 -0
- package/dist/features/federation/loader.js.map +1 -0
- package/dist/features/federation/lock.d.ts +12 -0
- package/dist/features/federation/lock.d.ts.map +1 -0
- package/dist/features/federation/lock.js +48 -0
- package/dist/features/federation/lock.js.map +1 -0
- package/dist/features/federation/tests/git-fetcher.test.d.ts +2 -0
- package/dist/features/federation/tests/git-fetcher.test.d.ts.map +1 -0
- package/dist/features/federation/tests/git-fetcher.test.js +167 -0
- package/dist/features/federation/tests/git-fetcher.test.js.map +1 -0
- package/dist/features/federation/tests/loader.test.d.ts +2 -0
- package/dist/features/federation/tests/loader.test.d.ts.map +1 -0
- package/dist/features/federation/tests/loader.test.js +144 -0
- package/dist/features/federation/tests/loader.test.js.map +1 -0
- package/dist/features/federation/tests/phase5.test.d.ts +2 -0
- package/dist/features/federation/tests/phase5.test.d.ts.map +1 -0
- package/dist/features/federation/tests/phase5.test.js +137 -0
- package/dist/features/federation/tests/phase5.test.js.map +1 -0
- package/dist/features/federation/tests/schema-load.test.d.ts +2 -0
- package/dist/features/federation/tests/schema-load.test.d.ts.map +1 -0
- package/dist/features/federation/tests/schema-load.test.js +97 -0
- package/dist/features/federation/tests/schema-load.test.js.map +1 -0
- package/dist/features/federation/tests/validator.test.d.ts +2 -0
- package/dist/features/federation/tests/validator.test.d.ts.map +1 -0
- package/dist/features/federation/tests/validator.test.js +319 -0
- package/dist/features/federation/tests/validator.test.js.map +1 -0
- package/dist/features/mcp/commands/serve.d.ts +10 -0
- package/dist/features/mcp/commands/serve.d.ts.map +1 -0
- package/dist/features/mcp/commands/serve.js +12 -0
- package/dist/features/mcp/commands/serve.js.map +1 -0
- package/dist/features/mcp/server.d.ts +15 -0
- package/dist/features/mcp/server.d.ts.map +1 -0
- package/dist/features/mcp/server.js +438 -0
- package/dist/features/mcp/server.js.map +1 -0
- package/dist/features/pipeline/commands/validate.d.ts.map +1 -1
- package/dist/features/pipeline/commands/validate.js +7 -0
- package/dist/features/pipeline/commands/validate.js.map +1 -1
- package/dist/features/pipeline/indexer.d.ts +28 -2
- package/dist/features/pipeline/indexer.d.ts.map +1 -1
- package/dist/features/pipeline/indexer.js +82 -27
- package/dist/features/pipeline/indexer.js.map +1 -1
- package/dist/features/pipeline/validator.d.ts +10 -0
- package/dist/features/pipeline/validator.d.ts.map +1 -1
- package/dist/features/pipeline/validator.js +274 -27
- package/dist/features/pipeline/validator.js.map +1 -1
- package/dist/features/query/commands/list.d.ts +10 -0
- package/dist/features/query/commands/list.d.ts.map +1 -1
- package/dist/features/query/commands/list.js +1 -1
- package/dist/features/query/commands/list.js.map +1 -1
- package/dist/features/query/commands/locate.d.ts +1 -0
- package/dist/features/query/commands/locate.d.ts.map +1 -1
- package/dist/features/query/commands/locate.js +1 -1
- package/dist/features/query/commands/locate.js.map +1 -1
- package/dist/features/query/commands/search.d.ts.map +1 -1
- package/dist/features/query/commands/search.js +2 -0
- package/dist/features/query/commands/search.js.map +1 -1
- package/dist/features/query/commands/show.d.ts +15 -0
- package/dist/features/query/commands/show.d.ts.map +1 -1
- package/dist/features/query/commands/show.js +116 -58
- package/dist/features/query/commands/show.js.map +1 -1
- package/dist/features/query/commands/story.d.ts +70 -0
- package/dist/features/query/commands/story.d.ts.map +1 -1
- package/dist/features/query/commands/story.js +2 -2
- package/dist/features/query/commands/story.js.map +1 -1
- package/dist/features/query/commands/summary.d.ts +3 -0
- package/dist/features/query/commands/summary.d.ts.map +1 -1
- package/dist/features/query/commands/summary.js +1 -1
- package/dist/features/query/commands/summary.js.map +1 -1
- package/dist/features/query/searcher.d.ts +18 -1
- package/dist/features/query/searcher.d.ts.map +1 -1
- package/dist/features/query/searcher.js +11 -2
- package/dist/features/query/searcher.js.map +1 -1
- package/dist/features/scaffold/commands/new-domain.d.ts +22 -0
- package/dist/features/scaffold/commands/new-domain.d.ts.map +1 -1
- package/dist/features/scaffold/commands/new-domain.js +44 -28
- package/dist/features/scaffold/commands/new-domain.js.map +1 -1
- package/dist/features/scaffold/commands/service-init.d.ts +12 -0
- package/dist/features/scaffold/commands/service-init.d.ts.map +1 -0
- package/dist/features/scaffold/commands/service-init.js +69 -0
- package/dist/features/scaffold/commands/service-init.js.map +1 -0
- package/dist/shared/graph.d.ts +8 -0
- package/dist/shared/graph.d.ts.map +1 -1
- package/dist/shared/graph.js +180 -112
- package/dist/shared/graph.js.map +1 -1
- package/dist/shared/index.d.ts +4 -1
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +6 -1
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/loader.d.ts +22 -0
- package/dist/shared/loader.d.ts.map +1 -1
- package/dist/shared/loader.js +31 -1
- package/dist/shared/loader.js.map +1 -1
- package/dist/shared/paths.d.ts +59 -7
- package/dist/shared/paths.d.ts.map +1 -1
- package/dist/shared/paths.js +93 -11
- package/dist/shared/paths.js.map +1 -1
- package/dist/shared/refs.d.ts +96 -0
- package/dist/shared/refs.d.ts.map +1 -0
- package/dist/shared/refs.js +182 -0
- package/dist/shared/refs.js.map +1 -0
- package/dist/shared/service-id.d.ts +11 -0
- package/dist/shared/service-id.d.ts.map +1 -0
- package/dist/shared/service-id.js +64 -0
- package/dist/shared/service-id.js.map +1 -0
- package/dist/shared/tests/paths.test.d.ts +2 -0
- package/dist/shared/tests/paths.test.d.ts.map +1 -0
- package/dist/shared/tests/paths.test.js +111 -0
- package/dist/shared/tests/paths.test.js.map +1 -0
- package/dist/shared/tests/refs.test.d.ts +2 -0
- package/dist/shared/tests/refs.test.d.ts.map +1 -0
- package/dist/shared/tests/refs.test.js +104 -0
- package/dist/shared/tests/refs.test.js.map +1 -0
- package/dist/shared/types/domain.d.ts +14 -0
- package/dist/shared/types/domain.d.ts.map +1 -1
- package/dist/shared/types/federation.d.ts +60 -0
- package/dist/shared/types/federation.d.ts.map +1 -0
- package/dist/shared/types/federation.js +12 -0
- package/dist/shared/types/federation.js.map +1 -0
- package/dist/version.d.ts +4 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +15 -0
- package/dist/version.js.map +1 -0
- package/package.json +8 -5
- package/tools/dkk/claude/agents/dkk-domain-reviewer.md +69 -0
- package/tools/dkk/claude/commands/dkk-adr.md +11 -0
- package/tools/dkk/claude/commands/dkk-impact.md +34 -0
- package/tools/dkk/claude/commands/dkk-implement.md +12 -0
- package/tools/dkk/claude/commands/dkk-prime.md +6 -0
- package/tools/dkk/claude/commands/dkk-review.md +12 -0
- package/tools/dkk/claude/commands/dkk-story.md +12 -0
- package/tools/dkk/claude/hooks/post-edit-validate.mjs +68 -0
- package/tools/dkk/claude/hooks/pre-edit-block-generated.mjs +39 -0
- package/tools/dkk/claude/hooks/session-start-prime.mjs +20 -0
- package/tools/dkk/claude/hooks/stop-validate.mjs +67 -0
- package/tools/dkk/claude/settings.json +62 -0
- package/tools/dkk/claude/skills/dkk-adr-author/SKILL.md +54 -0
- package/tools/dkk/claude/skills/dkk-flow-implementer/SKILL.md +51 -0
- package/tools/dkk/claude/skills/dkk-story-analyst/SKILL.md +108 -0
- package/tools/dkk/schema/actors.schema.json +1 -1
- package/tools/dkk/schema/adr-frontmatter.schema.json +4 -4
- package/tools/dkk/schema/aggregate.schema.json +1 -1
- package/tools/dkk/schema/command.schema.json +1 -1
- package/tools/dkk/schema/event.schema.json +1 -1
- package/tools/dkk/schema/federation.schema.json +71 -0
- package/tools/dkk/schema/glossary.schema.json +1 -1
- package/tools/dkk/schema/index.schema.json +2 -2
- package/tools/dkk/schema/policy.schema.json +1 -1
- package/tools/dkk/schema/read-model.schema.json +1 -1
- package/tools/dkk/schema/service.schema.json +30 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript interfaces for the multi-repo federation layer.
|
|
3
|
+
*
|
|
4
|
+
* `service.yml` declares this repo's service identity. `federation.yml`
|
|
5
|
+
* lists peer services whose `.dkk/` directories should be loaded
|
|
6
|
+
* alongside the local model (read-only).
|
|
7
|
+
*
|
|
8
|
+
* Aligns with JSON schemas under tools/dkk/schema/service.schema.json
|
|
9
|
+
* and federation.schema.json.
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=federation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"federation.js","sourceRoot":"","sources":["../../../src/shared/types/federation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,UAAU,QAEd,CAAC;AAEV,qEAAqE;AACrE,eAAO,MAAM,OAAO,yBAAyB,CAAC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package version, read at runtime from `package.json`.
|
|
3
|
+
*
|
|
4
|
+
* Works in both dev (`src/version.ts`) and build (`dist/version.js`) because
|
|
5
|
+
* `package.json` is one level above either entrypoint. Computed once at
|
|
6
|
+
* module load.
|
|
7
|
+
*/
|
|
8
|
+
import { readFileSync } from "node:fs";
|
|
9
|
+
import { fileURLToPath } from "node:url";
|
|
10
|
+
import { dirname, resolve } from "node:path";
|
|
11
|
+
const pkgPath = resolve(dirname(fileURLToPath(import.meta.url)), "../package.json");
|
|
12
|
+
export const pkgVersion = JSON.parse(readFileSync(pkgPath, "utf8")).version;
|
|
13
|
+
/** Name of the package on the npm registry. Used by `dkk update`. */
|
|
14
|
+
export const pkgName = "domain-knowledge-kit";
|
|
15
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,OAAO,GAAG,OAAO,CACrB,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EACvC,iBAAiB,CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GACrB,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CACzC,CAAC,OAAO,CAAC;AAEV,qEAAqE;AACrE,MAAM,CAAC,MAAM,OAAO,GAAG,sBAAsB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "domain-knowledge-kit",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.19",
|
|
4
4
|
"description": "Domain Knowledge Pack — YAML + ADR links + deterministic search + generated docs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"dist/",
|
|
19
19
|
"tools/dkk/schema/",
|
|
20
20
|
"tools/dkk/templates/",
|
|
21
|
+
"tools/dkk/claude/",
|
|
21
22
|
".github/skills/",
|
|
22
23
|
"LICENSE",
|
|
23
24
|
"README.md"
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
"lint:fix": "eslint . --fix",
|
|
31
32
|
"check": "npm run typecheck && npm run lint",
|
|
32
33
|
"prepublishOnly": "npm run build",
|
|
33
|
-
"test": "tsx src/features/pipeline/tests/validate-schemas.test.ts && tsx src/shared/tests/loader.test.ts && tsx src/features/pipeline/tests/validator.test.ts && tsx src/shared/tests/graph.test.ts && tsx src/features/pipeline/tests/indexer.test.ts && tsx src/features/query/tests/searcher.test.ts && tsx src/features/pipeline/tests/renderer.test.ts && tsx src/shared/tests/verify-collision-fix.test.ts && tsx test/cli-integration.ts"
|
|
34
|
+
"test": "tsx src/features/pipeline/tests/validate-schemas.test.ts && tsx src/shared/tests/loader.test.ts && tsx src/shared/tests/refs.test.ts && tsx src/shared/tests/paths.test.ts && tsx src/features/federation/tests/loader.test.ts && tsx src/features/federation/tests/schema-load.test.ts && tsx src/features/federation/tests/git-fetcher.test.ts && tsx src/features/federation/tests/validator.test.ts && tsx src/features/federation/tests/phase5.test.ts && tsx src/features/pipeline/tests/validator.test.ts && tsx src/shared/tests/graph.test.ts && tsx src/features/pipeline/tests/indexer.test.ts && tsx src/features/query/tests/searcher.test.ts && tsx src/features/pipeline/tests/renderer.test.ts && tsx src/shared/tests/verify-collision-fix.test.ts && tsx test/cli-integration.ts"
|
|
34
35
|
},
|
|
35
36
|
"engines": {
|
|
36
37
|
"node": ">=21.2.0"
|
|
@@ -38,7 +39,6 @@
|
|
|
38
39
|
"keywords": [],
|
|
39
40
|
"license": "Elastic-2.0",
|
|
40
41
|
"devDependencies": {
|
|
41
|
-
"@types/better-sqlite3": "^7.6.13",
|
|
42
42
|
"@types/js-yaml": "^4.0.9",
|
|
43
43
|
"eslint": "^10.0.1",
|
|
44
44
|
"tsx": "^4.7.0",
|
|
@@ -47,12 +47,15 @@
|
|
|
47
47
|
"vitest": "^4.1.0"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
51
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
50
52
|
"ajv": "^8.12.0",
|
|
51
53
|
"ajv-formats": "^3.0.1",
|
|
52
|
-
"better-sqlite3": "^
|
|
54
|
+
"better-sqlite3": "^12.10.0",
|
|
53
55
|
"commander": "^12.0.0",
|
|
54
56
|
"fast-glob": "^3.3.2",
|
|
55
57
|
"handlebars": "^4.7.8",
|
|
56
|
-
"js-yaml": "^4.1.0"
|
|
58
|
+
"js-yaml": "^4.1.0",
|
|
59
|
+
"zod": "^4.4.3"
|
|
57
60
|
}
|
|
58
61
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dkk-domain-reviewer
|
|
3
|
+
description: Review a code change, branch, or PR for impact on the local Domain Knowledge Pack. Identifies affected domain items, computes blast radius, flags ADR drift, and returns a single bounded report. Use when the user asks to review a diff, audit a PR, or check whether a change is domain-safe.
|
|
4
|
+
tools: Read, Grep, Glob, Bash, mcp__dkk__search, mcp__dkk__show, mcp__dkk__summary, mcp__dkk__related, mcp__dkk__list, mcp__dkk__locate, mcp__dkk__stats, mcp__dkk__validate, mcp__dkk__story, mcp__dkk__prime
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# DKK Domain Reviewer
|
|
8
|
+
|
|
9
|
+
You review a code change for impact on the project's Domain Knowledge Pack. Your job is to surface domain risk that would be invisible from a syntactic diff review: broken cross-references, blast radius beyond the changed file, drift between code and ADR-recorded decisions.
|
|
10
|
+
|
|
11
|
+
You return a **single bounded report**. You do not converse — caller invokes you, you investigate, you reply once.
|
|
12
|
+
|
|
13
|
+
## Inputs
|
|
14
|
+
|
|
15
|
+
The caller provides one of:
|
|
16
|
+
|
|
17
|
+
- A list of changed files (relative paths)
|
|
18
|
+
- A git diff range (e.g. `origin/main...HEAD`)
|
|
19
|
+
- A PR number/URL — in which case run `gh pr diff <number>` to retrieve the diff
|
|
20
|
+
|
|
21
|
+
If no input is provided, default to the working-tree diff: `git diff` and `git status` to enumerate changed files.
|
|
22
|
+
|
|
23
|
+
## Investigation procedure
|
|
24
|
+
|
|
25
|
+
1. **Enumerate changed files.** From the diff or file list, separate:
|
|
26
|
+
- Domain YAML changes under `.dkk/domain/**/*.yml`
|
|
27
|
+
- ADR changes under `.dkk/adr/*.md`
|
|
28
|
+
- Code changes that *might* implement a domain command, event, policy, aggregate, or read model
|
|
29
|
+
2. **For each changed domain YAML file**: extract the item id (path → `<context>.<Name>`). Call `mcp__dkk__summary` for orientation, then `mcp__dkk__related` with `depth: 2` for blast radius. Note every neighbour whose definition file was *not* in the diff — those are the items most likely to break invariants.
|
|
30
|
+
3. **For each changed ADR**: call `mcp__dkk__show` on the ADR id. List every item in `domain_refs`. For each, verify (via `mcp__dkk__show`) that the item's `adr_refs` still contains this ADR. Flag missing back-links.
|
|
31
|
+
4. **For each code change**: grep the file for tokens that look like domain identifiers (PascalCase command/event names, `actor.<Name>`, etc.). For each match, call `mcp__dkk__search` with the token. If the token does not resolve to a model item, flag it as a possible drift (code references a name that the model doesn't know about, or vice versa).
|
|
32
|
+
5. **Run `mcp__dkk__validate`** to check schema and cross-reference health on the post-change model. Include any errors or warnings verbatim in the report.
|
|
33
|
+
6. **Spot-check ADR drift.** For each domain item touched by the change, look at its `adr_refs`. Read each referenced ADR via `mcp__dkk__show` and check whether the change is consistent with the ADR's *Decision* and *Consequences* sections. Flag any change that appears to contradict an Accepted ADR.
|
|
34
|
+
|
|
35
|
+
## Report format
|
|
36
|
+
|
|
37
|
+
Return one markdown report with these sections (omit a section if empty):
|
|
38
|
+
|
|
39
|
+
```markdown
|
|
40
|
+
## Domain Review
|
|
41
|
+
|
|
42
|
+
### Changed domain items
|
|
43
|
+
- `<id>` — <one-line summary> [<context>]
|
|
44
|
+
|
|
45
|
+
### Blast radius (depth 2)
|
|
46
|
+
- `<changed-id>` → affects <N> items not in this diff:
|
|
47
|
+
- `<neighbour-id>` (<kind>) — <relationship>
|
|
48
|
+
|
|
49
|
+
### Cross-reference issues
|
|
50
|
+
- <description>; <path or id>
|
|
51
|
+
|
|
52
|
+
### ADR drift
|
|
53
|
+
- `<adr-id>: <title>` — <how the change appears to deviate>
|
|
54
|
+
|
|
55
|
+
### Validation
|
|
56
|
+
- <verbatim errors / warnings, or "clean">
|
|
57
|
+
|
|
58
|
+
### Recommendations
|
|
59
|
+
- <ordered, actionable items>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
If the diff has no domain impact, return: *"No domain-relevant changes detected."*
|
|
63
|
+
|
|
64
|
+
## Constraints
|
|
65
|
+
|
|
66
|
+
- Read-only. Do not edit files. Do not call `dkk render`, `dkk add`, `dkk rename`, `dkk rm`, or any write-side `dkk` command.
|
|
67
|
+
- Do not run tests, builds, or arbitrary scripts. The Bash allowance is for `git`, `gh`, and read-only `dkk` queries only.
|
|
68
|
+
- Stay focused on **domain** impact. General code review (style, performance, security) is out of scope — leave those for other reviewers.
|
|
69
|
+
- If you cannot determine impact for some change with confidence, say so explicitly rather than guessing.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Draft a new Architecture Decision Record using the dkk-adr-author skill.
|
|
3
|
+
argument-hint: <decision-topic>
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Invoke the `dkk-adr-author` skill. The decision topic is `$ARGUMENTS`.
|
|
7
|
+
|
|
8
|
+
- If `$ARGUMENTS` is empty, ask the user to describe the decision in one sentence before proceeding.
|
|
9
|
+
- Otherwise, treat `$ARGUMENTS` as the topic and start the skill workflow at step 1 (search for prior ADRs covering this topic via `mcp__dkk__search` with `type: adr`).
|
|
10
|
+
|
|
11
|
+
Follow the skill's workflow end to end, including the bidirectional `domain_refs` ↔ `adr_refs` linking and the final `dkk render` quality gate.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Show blast radius for a DKK item — summary, depth-3 graph neighbours, and linked ADRs.
|
|
3
|
+
argument-hint: <item-id>
|
|
4
|
+
allowed-tools: mcp__dkk__summary, mcp__dkk__related, mcp__dkk__show, mcp__dkk__locate
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Compute and present the blast radius of `$ARGUMENTS`.
|
|
8
|
+
|
|
9
|
+
1. Call `mcp__dkk__summary` with `id: $ARGUMENTS`. Report the item's name, kind, context, and one-line description.
|
|
10
|
+
2. Call `mcp__dkk__related` with `id: $ARGUMENTS` and `depth: 3`. Group results by kind.
|
|
11
|
+
3. From the summary, collect any `adr_refs`. For each, call `mcp__dkk__show` and report the ADR id, title, and status.
|
|
12
|
+
4. Call `mcp__dkk__locate` and report the absolute path(s) where this item is defined.
|
|
13
|
+
|
|
14
|
+
Format the output as:
|
|
15
|
+
|
|
16
|
+
```markdown
|
|
17
|
+
## Impact: <id>
|
|
18
|
+
|
|
19
|
+
**<name>** (<kind>, <context>) — <description>
|
|
20
|
+
|
|
21
|
+
### Source
|
|
22
|
+
- <absolute path>
|
|
23
|
+
|
|
24
|
+
### Direct neighbours (depth 1)
|
|
25
|
+
- <kind>: <id>, <id>, ...
|
|
26
|
+
|
|
27
|
+
### Extended blast radius (depth 2–3)
|
|
28
|
+
- <kind>: <id>, <id>, ...
|
|
29
|
+
|
|
30
|
+
### Linked ADRs
|
|
31
|
+
- <adr-id>: <title> (<status>)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
If the id does not resolve, list the closest candidates from `mcp__dkk__list` or `mcp__dkk__search` and stop.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Walk through framework-agnostic implementation of a DKK flow using the dkk-flow-implementer skill.
|
|
3
|
+
argument-hint: <flow-id-or-feature-name>
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Invoke the `dkk-flow-implementer` skill. The user's target is `$ARGUMENTS`.
|
|
7
|
+
|
|
8
|
+
- If `$ARGUMENTS` is empty, ask the user which flow to implement, or list available flows via `mcp__dkk__list` (filter `type: flow`).
|
|
9
|
+
- If `$ARGUMENTS` looks like a flow id (`flow.<Name>` or bare `<Name>`), pass it through to `mcp__dkk__story`.
|
|
10
|
+
- Otherwise, run `mcp__dkk__search` with `$ARGUMENTS` first to identify the matching flow or root command, then proceed.
|
|
11
|
+
|
|
12
|
+
Follow the skill's workflow: retrieve story, ask clarifying questions, present ADR constraints, generate the framework-agnostic checklist, and walk the user through items interactively.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Re-inject DKK agent context (domain principles, item types, CLI reference, current model summary). Use after compaction or topic drift.
|
|
3
|
+
allowed-tools: mcp__dkk__prime
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Call `mcp__dkk__prime` with default arguments and read the response. After loading, briefly confirm the number of contexts, items, and ADRs currently in the model. Do not summarize the prime content itself — the user just needs the agent to be re-primed.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Review the current change for DKK domain impact. Delegates to the dkk-domain-reviewer subagent in an isolated context.
|
|
3
|
+
argument-hint: [pr-number | git-range]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Invoke the `dkk-domain-reviewer` subagent. Pass through `$ARGUMENTS` as the input scope:
|
|
7
|
+
|
|
8
|
+
- If `$ARGUMENTS` is empty, instruct the subagent to review the working-tree diff (`git status` + `git diff`).
|
|
9
|
+
- If `$ARGUMENTS` looks like a number or `#NNN`, instruct it to run `gh pr diff <number>` and review that PR.
|
|
10
|
+
- Otherwise, treat `$ARGUMENTS` as a git range (e.g. `origin/main...HEAD`) and pass it through.
|
|
11
|
+
|
|
12
|
+
Wait for the subagent's report. Display it verbatim to the user. Do not perform the review yourself.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Generate a user story or epic from a DKK flow using the dkk-story-analyst skill.
|
|
3
|
+
argument-hint: <flow-id-or-feature-name>
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Invoke the `dkk-story-analyst` skill. The user's target is `$ARGUMENTS`.
|
|
7
|
+
|
|
8
|
+
- If `$ARGUMENTS` is empty, ask the user which flow to draft a story for, or list available flows via `mcp__dkk__list` (filter `type: flow`).
|
|
9
|
+
- If `$ARGUMENTS` looks like a flow id (`flow.<Name>` or bare `<Name>`), pass it through to `mcp__dkk__story`.
|
|
10
|
+
- Otherwise, run `mcp__dkk__search` with `$ARGUMENTS` first to identify the matching flow or root command, then proceed.
|
|
11
|
+
|
|
12
|
+
Follow the skill's workflow end to end, including clarifying questions and acceptance-criteria mapping.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* PostToolUse hook — auto-validate after edits to domain YAML.
|
|
4
|
+
*
|
|
5
|
+
* When Claude Code edits or writes a file under `.dkk/domain/`, run
|
|
6
|
+
* `dkk validate` so any broken cross-references or schema violations
|
|
7
|
+
* surface back into the agent loop immediately, before the next step.
|
|
8
|
+
*
|
|
9
|
+
* Stays silent for unrelated edits (no-op, exit 0).
|
|
10
|
+
*/
|
|
11
|
+
import { spawnSync } from "node:child_process";
|
|
12
|
+
|
|
13
|
+
let raw = "";
|
|
14
|
+
process.stdin.on("data", (d) => (raw += d));
|
|
15
|
+
process.stdin.on("end", () => {
|
|
16
|
+
let payload;
|
|
17
|
+
try {
|
|
18
|
+
payload = JSON.parse(raw || "{}");
|
|
19
|
+
} catch {
|
|
20
|
+
process.exit(0);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const filePath =
|
|
24
|
+
payload?.tool_input?.file_path ??
|
|
25
|
+
payload?.tool_input?.notebook_path ??
|
|
26
|
+
"";
|
|
27
|
+
|
|
28
|
+
// Only act on domain YAML edits.
|
|
29
|
+
const isDomainYaml = /\.dkk\/domain\/.*\.ya?ml$/.test(filePath);
|
|
30
|
+
if (!isDomainYaml) process.exit(0);
|
|
31
|
+
|
|
32
|
+
const repoRoot = process.env.CLAUDE_PROJECT_DIR ?? process.cwd();
|
|
33
|
+
|
|
34
|
+
const res = spawnSync("dkk", ["validate", "--json", "--minify"], {
|
|
35
|
+
cwd: repoRoot,
|
|
36
|
+
encoding: "utf8",
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Tooling problem (dkk not on PATH, spawn error, etc.) — surface a clear
|
|
40
|
+
// setup error to the user, but don't block the agent with a phantom
|
|
41
|
+
// "validation failure" it has no way to fix.
|
|
42
|
+
if (res.error?.code === "ENOENT") {
|
|
43
|
+
process.stderr.write(
|
|
44
|
+
"dkk post-edit hook: 'dkk' CLI not found on PATH — install with `npm i -g domain-knowledge-kit` to enable auto-validation.\n",
|
|
45
|
+
);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
if (res.error) {
|
|
49
|
+
process.stderr.write(
|
|
50
|
+
`dkk post-edit hook: failed to invoke validator — ${res.error.message}\n`,
|
|
51
|
+
);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// If validate fails, surface the JSON output to the model via stderr (exit 2
|
|
56
|
+
// makes Claude Code feed stderr back as a tool-result correction signal).
|
|
57
|
+
if (res.status !== 0) {
|
|
58
|
+
const body =
|
|
59
|
+
res.stdout ||
|
|
60
|
+
res.stderr ||
|
|
61
|
+
"(validator exited non-zero with no output — likely a tooling/wiring problem, not a domain issue)";
|
|
62
|
+
process.stderr.write(
|
|
63
|
+
`dkk validate failed after edit to ${filePath}:\n${body}\n`,
|
|
64
|
+
);
|
|
65
|
+
process.exit(2);
|
|
66
|
+
}
|
|
67
|
+
process.exit(0);
|
|
68
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* PreToolUse hook — block writes to generated/derived directories.
|
|
4
|
+
*
|
|
5
|
+
* `.dkk/docs/` is regenerated from YAML by `dkk render`. Edits there are
|
|
6
|
+
* always lost on the next render, so we block the tool call up-front and
|
|
7
|
+
* tell the agent to edit the source YAML instead.
|
|
8
|
+
*
|
|
9
|
+
* Same treatment for `dist/` (TypeScript build output).
|
|
10
|
+
*/
|
|
11
|
+
let raw = "";
|
|
12
|
+
process.stdin.on("data", (d) => (raw += d));
|
|
13
|
+
process.stdin.on("end", () => {
|
|
14
|
+
let payload;
|
|
15
|
+
try {
|
|
16
|
+
payload = JSON.parse(raw || "{}");
|
|
17
|
+
} catch {
|
|
18
|
+
process.exit(0);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const filePath = payload?.tool_input?.file_path ?? "";
|
|
22
|
+
if (!filePath) process.exit(0);
|
|
23
|
+
|
|
24
|
+
if (/\.dkk\/docs\//.test(filePath)) {
|
|
25
|
+
process.stderr.write(
|
|
26
|
+
`Blocked: ${filePath} is generated by \`dkk render\`. Edit the YAML under .dkk/domain/ and re-render instead.\n`,
|
|
27
|
+
);
|
|
28
|
+
process.exit(2);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (/\/dist\//.test(filePath)) {
|
|
32
|
+
process.stderr.write(
|
|
33
|
+
`Blocked: ${filePath} is build output. Edit the source under src/ and run \`npm run build\`.\n`,
|
|
34
|
+
);
|
|
35
|
+
process.exit(2);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
process.exit(0);
|
|
39
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* SessionStart hook — pipe `dkk prime` output into Claude Code's context.
|
|
4
|
+
*
|
|
5
|
+
* The hook prints the agent context document (item types, retrieval/update
|
|
6
|
+
* workflows, current domain summary) to stdout, which Claude Code surfaces
|
|
7
|
+
* as additional context for the session. Any errors fall through silently
|
|
8
|
+
* so a missing domain model never blocks session start.
|
|
9
|
+
*/
|
|
10
|
+
import { spawnSync } from "node:child_process";
|
|
11
|
+
|
|
12
|
+
const repoRoot = process.env.CLAUDE_PROJECT_DIR ?? process.cwd();
|
|
13
|
+
|
|
14
|
+
const res = spawnSync("dkk", ["prime"], { cwd: repoRoot, encoding: "utf8" });
|
|
15
|
+
if (res.status === 0 && res.stdout) {
|
|
16
|
+
process.stdout.write(res.stdout);
|
|
17
|
+
}
|
|
18
|
+
// Always exit 0 — never block session start over a missing `dkk` binary or
|
|
19
|
+
// an empty/absent domain model. Priming is a best-effort context boost.
|
|
20
|
+
process.exit(0);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Stop hook — final validation gate before the agent ends a turn.
|
|
4
|
+
*
|
|
5
|
+
* Runs `dkk validate`. If the domain model is invalid, returns exit code 2
|
|
6
|
+
* with the JSON error report on stderr. Claude Code feeds that back so the
|
|
7
|
+
* agent must fix the broken model before declaring the work complete.
|
|
8
|
+
*
|
|
9
|
+
* `stop_hook_active` is honoured to prevent infinite loops if Claude tries
|
|
10
|
+
* to stop again after the hook already fired once.
|
|
11
|
+
*/
|
|
12
|
+
import { spawnSync } from "node:child_process";
|
|
13
|
+
import { existsSync } from "node:fs";
|
|
14
|
+
import { resolve } from "node:path";
|
|
15
|
+
|
|
16
|
+
let raw = "";
|
|
17
|
+
process.stdin.on("data", (d) => (raw += d));
|
|
18
|
+
process.stdin.on("end", () => {
|
|
19
|
+
let payload;
|
|
20
|
+
try {
|
|
21
|
+
payload = JSON.parse(raw || "{}");
|
|
22
|
+
} catch {
|
|
23
|
+
process.exit(0);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (payload?.stop_hook_active) {
|
|
27
|
+
process.exit(0);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const repoRoot = process.env.CLAUDE_PROJECT_DIR ?? process.cwd();
|
|
31
|
+
|
|
32
|
+
// No domain model? Nothing to gate on.
|
|
33
|
+
if (!existsSync(resolve(repoRoot, ".dkk/domain"))) process.exit(0);
|
|
34
|
+
|
|
35
|
+
const res = spawnSync("dkk", ["validate", "--json", "--minify"], {
|
|
36
|
+
cwd: repoRoot,
|
|
37
|
+
encoding: "utf8",
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Tooling problem (dkk not on PATH, spawn error, etc.) — surface a clear
|
|
41
|
+
// setup error to the user, but don't block the agent with a phantom
|
|
42
|
+
// "domain failure" it has no way to fix.
|
|
43
|
+
if (res.error?.code === "ENOENT") {
|
|
44
|
+
process.stderr.write(
|
|
45
|
+
"dkk stop hook: 'dkk' CLI not found on PATH — install with `npm i -g domain-knowledge-kit` to enable the domain validation gate.\n",
|
|
46
|
+
);
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
if (res.error) {
|
|
50
|
+
process.stderr.write(
|
|
51
|
+
`dkk stop hook: failed to invoke validator — ${res.error.message}\n`,
|
|
52
|
+
);
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (res.status !== 0) {
|
|
57
|
+
const body =
|
|
58
|
+
res.stdout ||
|
|
59
|
+
res.stderr ||
|
|
60
|
+
"(validator exited non-zero with no output — likely a tooling/wiring problem, not a domain issue)";
|
|
61
|
+
process.stderr.write(
|
|
62
|
+
`Domain validation failed — fix these before ending the turn:\n${body}\n`,
|
|
63
|
+
);
|
|
64
|
+
process.exit(2);
|
|
65
|
+
}
|
|
66
|
+
process.exit(0);
|
|
67
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/claude-code-settings.json",
|
|
3
|
+
"permissions": {
|
|
4
|
+
"allow": [
|
|
5
|
+
"Bash(dkk list:*)",
|
|
6
|
+
"Bash(dkk show:*)",
|
|
7
|
+
"Bash(dkk summary:*)",
|
|
8
|
+
"Bash(dkk search:*)",
|
|
9
|
+
"Bash(dkk related:*)",
|
|
10
|
+
"Bash(dkk graph:*)",
|
|
11
|
+
"Bash(dkk locate:*)",
|
|
12
|
+
"Bash(dkk story:*)",
|
|
13
|
+
"Bash(dkk validate:*)",
|
|
14
|
+
"Bash(dkk stats:*)",
|
|
15
|
+
"Bash(dkk prime:*)"
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
"hooks": {
|
|
19
|
+
"SessionStart": [
|
|
20
|
+
{
|
|
21
|
+
"hooks": [
|
|
22
|
+
{
|
|
23
|
+
"type": "command",
|
|
24
|
+
"command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/session-start-prime.mjs\""
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"PreToolUse": [
|
|
30
|
+
{
|
|
31
|
+
"matcher": "Edit|Write|MultiEdit|NotebookEdit",
|
|
32
|
+
"hooks": [
|
|
33
|
+
{
|
|
34
|
+
"type": "command",
|
|
35
|
+
"command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/pre-edit-block-generated.mjs\""
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"PostToolUse": [
|
|
41
|
+
{
|
|
42
|
+
"matcher": "Edit|Write|MultiEdit",
|
|
43
|
+
"hooks": [
|
|
44
|
+
{
|
|
45
|
+
"type": "command",
|
|
46
|
+
"command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/post-edit-validate.mjs\""
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"Stop": [
|
|
52
|
+
{
|
|
53
|
+
"hooks": [
|
|
54
|
+
{
|
|
55
|
+
"type": "command",
|
|
56
|
+
"command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/stop-validate.mjs\""
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dkk-adr-author
|
|
3
|
+
description: Draft a new Architecture Decision Record grounded in the local Domain Knowledge Pack. Use when the user wants to record an architectural decision, capture a trade-off, document a tech choice, or formalize a discussion as an ADR.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ADR Author
|
|
7
|
+
|
|
8
|
+
Use this skill whenever the user wants to **record an architectural decision, draft an ADR, or capture a trade-off** in a project that has a Domain Knowledge Pack (`.dkk/`).
|
|
9
|
+
|
|
10
|
+
> **The DKK model is the single source of truth.** Every ADR must link to the domain items it constrains, bidirectionally. Skipping that link is the most common failure mode this skill prevents.
|
|
11
|
+
|
|
12
|
+
## Preferred tools
|
|
13
|
+
|
|
14
|
+
1. `mcp__dkk__search` (with `type: adr`) — find related existing ADRs
|
|
15
|
+
2. `mcp__dkk__show` — read those ADRs in full
|
|
16
|
+
3. `mcp__dkk__search` and `mcp__dkk__related` — identify which domain items the decision affects
|
|
17
|
+
4. `mcp__dkk__locate` — get absolute paths to edit the linked items
|
|
18
|
+
5. `mcp__dkk__validate` — final correctness check
|
|
19
|
+
6. `dkk new adr "<title>"` (Bash) — scaffold the file with the right number and frontmatter
|
|
20
|
+
7. `dkk render` (Bash) — refresh docs and search index after the ADR is finished
|
|
21
|
+
|
|
22
|
+
Use the equivalent `dkk` shell commands only if the MCP server is unavailable.
|
|
23
|
+
|
|
24
|
+
## Workflow
|
|
25
|
+
|
|
26
|
+
1. **Search prior ADRs first.** Call `mcp__dkk__search` with the topic and `type: adr`. Read every related ADR via `mcp__dkk__show`. If a *current* ADR already covers the decision, do not create a new one — update the existing record (with `superseded_by` if direction has changed). If a *deprecated* ADR is relevant, surface its rationale to the user; do not relitigate without acknowledging it.
|
|
27
|
+
2. **Identify affected domain items.** From the user's description, search the model and use `mcp__dkk__related` to find aggregates, events, commands, policies, and read models the decision constrains. Confirm the list with the user.
|
|
28
|
+
3. **Clarify the decision.** Ask **2–5 targeted questions** before drafting. Derive each question and its options from the search results and the user's stated motivation. Skip questions only when the decision is fully specified and uncontroversial. Examples (only if relevant):
|
|
29
|
+
- What problem prompted the decision? (constraint / incident / new requirement / cleanup)
|
|
30
|
+
- What alternatives were considered, and why were they rejected?
|
|
31
|
+
- Which domain items are constrained by this decision?
|
|
32
|
+
- What is the status — Proposed (needs review), Accepted (in effect), or Deprecated (recording history)?
|
|
33
|
+
- Does this supersede a prior ADR? If yes, which one?
|
|
34
|
+
4. **Scaffold via the CLI.** Run `dkk new adr "<title>"` — this auto-increments the number and creates the file with valid frontmatter and the canonical section structure. Do not hand-create the file.
|
|
35
|
+
5. **Fill the body.** The canonical sections are *Context*, *Decision*, *Consequences*, and *Alternatives Considered*. Use precise domain terminology — match every name to the items returned by `mcp__dkk__search` and `mcp__dkk__show`.
|
|
36
|
+
6. **Set the bidirectional links.** Both sides must agree:
|
|
37
|
+
- In the ADR frontmatter, set `domain_refs:` to the list of affected item ids (e.g. `ordering.OrderPlaced`, `actor.Customer`).
|
|
38
|
+
- On every linked domain item's YAML, append the new ADR id to its `adr_refs:` list. Use `mcp__dkk__locate` to find each file.
|
|
39
|
+
7. **Run quality gates.** The post-edit hook runs `mcp__dkk__validate` automatically; before declaring the work done, also run `dkk render` to refresh `.dkk/docs/` and rebuild the search index.
|
|
40
|
+
|
|
41
|
+
## Status discipline
|
|
42
|
+
|
|
43
|
+
- **Proposed** — newly drafted, awaiting team review. The decision is not in effect yet.
|
|
44
|
+
- **Accepted** — the decision is in effect; new code must comply.
|
|
45
|
+
- **Deprecated** — no longer in effect, but kept as project memory. If a successor exists, set `superseded_by: adr-NNNN` in the frontmatter.
|
|
46
|
+
|
|
47
|
+
Never delete an ADR. Even superseded ones are institutional memory.
|
|
48
|
+
|
|
49
|
+
## Don'ts
|
|
50
|
+
|
|
51
|
+
- Don't draft an ADR that doesn't reference at least one domain item (the bidirectional link is what makes ADRs queryable).
|
|
52
|
+
- Don't invent domain terms in the ADR body — every name must exist in the model.
|
|
53
|
+
- Don't hand-edit the ADR filename or number; let `dkk new adr` assign it.
|
|
54
|
+
- Don't skip searching for prior ADRs — relitigating a decided question without referencing the prior ADR is the worst failure mode.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dkk-flow-implementer
|
|
3
|
+
description: Guide a developer through framework-agnostic implementation of a DKK flow. Use when the user asks to implement, build, or code a flow or feature that maps to a flow in the local Domain Knowledge Pack.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Flow Implementer
|
|
7
|
+
|
|
8
|
+
Use this skill whenever the user asks to **implement, build, or code a flow / feature** in a project that has a Domain Knowledge Pack (`.dkk/`).
|
|
9
|
+
|
|
10
|
+
> **Source of truth is local.** Do not look for or reference external trackers (Jira, GitHub Issues, Linear, Trello, etc.) for requirements. The local DKK model — accessed through the MCP `dkk` server or the `dkk` CLI — is authoritative.
|
|
11
|
+
|
|
12
|
+
## Preferred tools
|
|
13
|
+
|
|
14
|
+
Call MCP tools rather than shelling out, in this order of preference:
|
|
15
|
+
|
|
16
|
+
1. `mcp__dkk__story` — full flow context (actors, ordered steps, policies, BDD examples, ADRs, downstream effects) in one call
|
|
17
|
+
2. `mcp__dkk__list` — to discover available flows when the user hasn't named one
|
|
18
|
+
3. `mcp__dkk__search` — to locate a flow when the user gives a feature name instead of an id
|
|
19
|
+
4. `mcp__dkk__related` — to extend blast radius beyond the immediate flow
|
|
20
|
+
5. `mcp__dkk__show` — to read the full definition of a specific item
|
|
21
|
+
6. `mcp__dkk__validate` — final correctness check after edits
|
|
22
|
+
|
|
23
|
+
Fall back to the equivalent `dkk` shell commands only if the MCP server is unavailable.
|
|
24
|
+
|
|
25
|
+
## Workflow
|
|
26
|
+
|
|
27
|
+
1. **Identify the flow.** If the user gave an id, normalize it (`flow.<Name>` or bare `<Name>`). Otherwise call `mcp__dkk__list` filtered by `type: flow`, or `mcp__dkk__search` on the feature name to find a candidate flow or root command.
|
|
28
|
+
2. **Retrieve full context.** Call `mcp__dkk__story` with the flow id. Read the actors, ordered steps, triggered policies, BDD examples, ADRs, and downstream effects.
|
|
29
|
+
3. **Clarify scope.** Ask **1–7 clarifying questions** before generating any checklist. Derive every question, its options, and your recommended default from the actual story output and the project's conventions — never use a fixed list. Each question must offer concrete options with one marked as recommended. **Skip the questions entirely** for trivial flows (≤2 steps, no cross-context effects, no ambiguity). Questions should target implementation behavior and UX, e.g.:
|
|
30
|
+
- What should the user see immediately after this command succeeds?
|
|
31
|
+
- How should validation errors surface (inline / toast / page-level)?
|
|
32
|
+
- Optimistic UI or wait-for-confirmation?
|
|
33
|
+
- Concurrency: can two users trigger this simultaneously?
|
|
34
|
+
- Is there an undo path, or one-way?
|
|
35
|
+
4. **Present architectural constraints.** List every ADR returned in the story output (`adr-NNNN — title — status`). Ask the user to acknowledge these before implementation begins. If the agent identifies any ADR conflict with the user's stated approach, surface it before proceeding.
|
|
36
|
+
5. **Generate a framework-agnostic checklist.** Group by domain role:
|
|
37
|
+
- **Aggregates** — entities, state transitions, invariants
|
|
38
|
+
- **Commands** — handlers, preconditions, validations
|
|
39
|
+
- **Events** — what to publish on success
|
|
40
|
+
- **Policies** — reactive logic triggered by events
|
|
41
|
+
- **Read models** — projections to update on events
|
|
42
|
+
6. **Walk through interactively.** Ask the user which checklist item they want to tackle first. Guide on the **domain logic** — invariants, policies, transitions — not framework boilerplate. Only emit framework-specific code if the user explicitly asks or `AGENTS.md` / `CLAUDE.md` directs otherwise.
|
|
43
|
+
7. **Use the canonical nouns.** Whatever names appear in the `mcp__dkk__story` output are the only allowed names. Do not rename `OrderBasket` to `ShoppingCart`.
|
|
44
|
+
8. **Validate and render after structural changes.** When the user's implementation requires new or modified domain items, use the DKK CLI commands (`dkk add`, `dkk rename`, `dkk rm`) for structural changes and edit YAML directly only for content. The post-edit hook will run `mcp__dkk__validate` automatically; before declaring the work done, also run `dkk render` to refresh docs and the search index.
|
|
45
|
+
|
|
46
|
+
## Interaction rules
|
|
47
|
+
|
|
48
|
+
- Do not generate full boilerplate up front. Wait for the user to request code for a specific checklist item.
|
|
49
|
+
- Confirm with the user before moving to the next checklist item.
|
|
50
|
+
- If the user asks for a framework-specific implementation, defer to `AGENTS.md` or `CLAUDE.md` conventions.
|
|
51
|
+
- Never invent domain terms. If a needed concept is missing from the model, surface it as a gap and propose adding it via `dkk add` rather than coding around it.
|