dld-kit 1.0.0-rc.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.
@@ -0,0 +1,119 @@
1
+ ---
2
+ name: dld-decide
3
+ description: Record a single development decision as a markdown file with YAML frontmatter. Collects context, rationale, and code references interactively.
4
+ compatibility: Requires Node.js 20+ and git.
5
+ metadata:
6
+ dld-kit-version: "1.0.0-rc.1"
7
+ ---
8
+ <!-- Generated by dld-kit from templates/skills/dld-decide/SKILL.md. Do not edit: updating the skills overwrites this file. -->
9
+
10
+ # /dld-decide — Record a Decision
11
+
12
+ You are helping the developer record a development decision. This should be a focused, low-ceremony conversation — not an interrogation.
13
+
14
+ ## Interaction style
15
+
16
+ Use the `AskUserQuestion` tool for all questions and prompts. This provides a structured input experience for the user rather than waiting for freeform replies.
17
+
18
+ ## Commands
19
+
20
+ The commands below run the `dld` CLI bundled with the dld-common skill, and need Node.js 20+. `<skill-dir>` stands for the absolute path of this skill's directory. If `<skill-dir>/../dld-common/scripts/dld.mjs` does not exist, stop and tell the user to install the dld-common skill: `npx skills add jimutt/dld-kit --skill dld-common`.
21
+
22
+ This skill uses: `next-id`, `create-decision`, `update-status`, `regenerate-index`.
23
+
24
+ ## Prerequisites
25
+
26
+ Check that `dld.config.yaml` exists at the repo root. If not, tell the user to run `/dld-init` first and stop.
27
+
28
+ ## Read project context
29
+
30
+ 1. Read `dld.config.yaml` to understand the project structure (flat vs namespaced, decisions directory, namespaces list)
31
+ 2. Read `decisions/PRACTICES.md` if it exists — be aware of project conventions when helping structure the decision
32
+ 3. For namespaced projects, also read `decisions/records/<namespace>/PRACTICES.md` if it exists for the relevant namespace
33
+
34
+ ## Conversation flow
35
+
36
+ ### 1. Collect the decision
37
+
38
+ If the user provided context with the skill invocation, use it. Otherwise ask:
39
+
40
+ > What decision are you recording? Tell me what you decided, why, and what code it affects.
41
+
42
+ Listen for:
43
+ - **What** was decided (the decision itself)
44
+ - **Why** (the rationale — what problem it solves, what alternatives were considered)
45
+ - **What it affects** (code areas, components, modules)
46
+
47
+ ### 2. Ask clarifying questions (if needed)
48
+
49
+ Only ask follow-up questions if the rationale or scope is genuinely unclear. Maximum 3-5 questions total. Don't interrogate — if the developer gave enough context, move on.
50
+
51
+ Good reasons to ask:
52
+ - The rationale is missing or unclear
53
+ - There might be alternatives worth noting
54
+ - The scope of affected code isn't clear
55
+ - There are obvious consequences worth recording
56
+
57
+ ### 3. Check for related decisions
58
+
59
+ Scan existing decision files for potential relationships:
60
+ - Decisions that reference the same code paths
61
+ - Decisions with overlapping tags
62
+ - Decisions that this one might supersede or amend
63
+
64
+ If you find related decisions, mention them and ask whether this decision **supersedes** (fully replaces) or **amends** (partially modifies) any of them. A superseded decision gets marked as `superseded` and is no longer active. An amended decision stays `accepted` — the amendment changes part of its scope while the rest remains in effect.
65
+
66
+ ### 4. Determine namespace (namespaced projects only)
67
+
68
+ If the project is namespaced, determine which namespace this decision belongs to. Infer from the code references if possible, otherwise ask.
69
+
70
+ ### 5. Assign ID
71
+
72
+ Run `next-id`:
73
+ ```bash
74
+ node "<skill-dir>/../dld-common/scripts/dld.mjs" next-id
75
+ ```
76
+
77
+ This outputs the next available ID (e.g., `DL-004`).
78
+
79
+ ### 6. Create the decision record
80
+
81
+ Compose the markdown body with the relevant sections (Context, Decision, Rationale, Consequences). Omit sections that aren't relevant, but always include Context and Decision.
82
+
83
+ Then run `create-decision`, piping the body via `printf` with `\n` for newlines (do **not** use literal newlines in the body argument — use `\n` escape sequences so the entire command stays on one logical line):
84
+ ```bash
85
+ printf "## Context\n\nWhat prompted this decision.\n\n## Decision\n\nWhat was decided.\n\n## Rationale\n\nWhy this choice.\n\n## Consequences\n\nWhat becomes easier or harder." | node "<skill-dir>/../dld-common/scripts/dld.mjs" create-decision \
86
+ --id "DL-NNN" \
87
+ --title "Short descriptive title" \
88
+ --namespace "billing" \
89
+ --tags "tag1, tag2" \
90
+ --supersedes "DL-003, DL-007" \
91
+ --amends "DL-005" \
92
+ --body-stdin
93
+ ```
94
+
95
+ Flags `--namespace`, `--tags`, `--supersedes`, `--amends` are optional. The command creates the file with YAML frontmatter and the body content, and outputs the file path.
96
+
97
+ > **Note:** If the body contains literal `%` characters, escape them as `%%` (printf format string requirement).
98
+
99
+ If this decision supersedes others, also update their status:
100
+ ```bash
101
+ node "<skill-dir>/../dld-common/scripts/dld.mjs" update-status DL-003 superseded
102
+ ```
103
+
104
+ **Do not** update the status of amended decisions — they stay `accepted`.
105
+
106
+ ### 7. Regenerate INDEX.md
107
+
108
+ ```bash
109
+ node "<skill-dir>/../dld-common/scripts/dld.mjs" regenerate-index
110
+ ```
111
+
112
+ ### 8. Suggest next steps
113
+
114
+ > Decision **DL-NNN** recorded as `proposed`.
115
+ >
116
+ > Next steps:
117
+ > - `/dld-adjust` — refine the decision before implementing
118
+ > - `/dld-implement DL-NNN` — implement this decision
119
+ > - `/dld-decide` — record another decision
@@ -0,0 +1,216 @@
1
+ ---
2
+ name: dld-implement
3
+ description: Implement one or more proposed decisions. Makes code changes, adds `@decision` annotations, and updates decision status.
4
+ compatibility: Requires Node.js 20+ and git.
5
+ metadata:
6
+ dld-kit-version: "1.0.0-rc.1"
7
+ ---
8
+ <!-- Generated by dld-kit from templates/skills/dld-implement/SKILL.md. Do not edit: updating the skills overwrites this file. -->
9
+
10
+ # /dld-implement — Implement Decisions
11
+
12
+ You are implementing one or more `proposed` decisions by making code changes, adding `@decision` annotations, and updating the decision records.
13
+
14
+ ## Commands
15
+
16
+ The commands below run the `dld` CLI bundled with the dld-common skill, and need Node.js 20+. `<skill-dir>` stands for the absolute path of this skill's directory. If `<skill-dir>/../dld-common/scripts/dld.mjs` does not exist, stop and tell the user to install the dld-common skill: `npx skills add jimutt/dld-kit --skill dld-common`.
17
+
18
+ This skill uses: `update-status`, `verify-annotations`, `regenerate-index`.
19
+
20
+ ## Prerequisites
21
+
22
+ 1. Check that `dld.config.yaml` exists at the repo root. If not, tell the user to run `/dld-init` first and stop.
23
+ 2. Parse the user's input to identify which decision(s) to implement:
24
+ - Specific IDs: `DL-005`, `DL-005 DL-006`
25
+ - By tag: `tag:payment-gateway`
26
+ - **No arguments:** If the user runs `/dld-implement` without specifying decisions, find all decisions with `status: proposed` in the records subdirectory (`decisions/records/`) and implement all of them.
27
+ 3. Read each referenced decision file. Verify they exist and have `status: proposed`. If a decision is already `accepted`, tell the user and skip it. If it doesn't exist, report the error.
28
+
29
+ ## Read project context
30
+
31
+ 1. Read `dld.config.yaml` for project structure
32
+ 2. Read `decisions/PRACTICES.md` if it exists — **this is where practices guidance is most important**. Apply the project's testing approach, code style, error handling patterns, and architecture conventions when writing code.
33
+ 3. For namespaced projects, also read `decisions/records/<namespace>/PRACTICES.md` for namespace-specific practices
34
+
35
+ ## Implementation
36
+
37
+ ### Batch vs. single implementation
38
+
39
+ When multiple decisions are requested, decide whether to implement them individually or as a batch:
40
+
41
+ - **Batch together** decisions that are tightly coupled — they touch the same code, share types, or depend on each other so heavily that implementing one without the others would produce incomplete or throwaway code (e.g., a data model + its validation + its state machine).
42
+ - **Implement separately** decisions that are independent — they touch different areas of the codebase and can stand on their own.
43
+
44
+ When batching, implement all the code together, add annotations for all decisions, then update each decision record and status individually in step 4.
45
+
46
+ ### 1. Understand the decision(s)
47
+
48
+ Read each decision record carefully. Understand:
49
+ - What was decided
50
+ - The rationale and constraints
51
+ - The code areas referenced
52
+ - Any superseded or amended decisions (read those too for context on what changed)
53
+
54
+ ### 2. Make code changes
55
+
56
+ Implement the decision(s) by modifying the codebase. Follow the practices manifest if one exists.
57
+
58
+ **Refining decisions during implementation:** While implementing, you may discover details that weren't anticipated during planning — a specific threshold value, an edge case handling approach, or a refinement to the original design. Since the decision is still in `proposed` status, it is **mutable** and can be updated:
59
+
60
+ - **Small refinements** (implementation details, specific values, edge cases that don't change the decision's intent) — update the decision record inline. Amend the Decision, Rationale, or Consequences sections as needed. This is expected and encouraged.
61
+ - **Major discoveries** (a fundamentally different approach is needed, or an entirely new design concern surfaces) — stop and suggest the user run `/dld-decide` to record a separate decision. If the new discovery invalidates the current decision, it may need to be superseded instead.
62
+
63
+ The boundary: if the discovery changes the *intent* of the decision, it's a new decision. If it refines the *implementation details*, update the current one.
64
+
65
+ ### 3. Add `@decision` annotations
66
+
67
+ **This step is mandatory.** Every implemented decision MUST have at least one `@decision(DL-NNN)` annotation in the source code. Updating the decision record's `references` field alone is not sufficient. The annotation in code is what triggers AI agents to look up the decision before modifying the annotated code.
68
+
69
+ Add `@decision(DL-NNN)` annotations to the code you modified or created. Place annotations in comments near the relevant code.
70
+
71
+ **Where to annotate:**
72
+ - Functions, methods, or classes that embody the decision
73
+ - Configuration or constants that were chosen based on the decision
74
+ - Key logic branches where the decision's rationale matters
75
+
76
+ **Annotation format** (adapt comment syntax to the language):
77
+ ```typescript
78
+ // @decision(DL-012)
79
+ function calculateVAT(order: Order): Money {
80
+ // ...
81
+ }
82
+ ```
83
+
84
+ ```python
85
+ # @decision(DL-012)
86
+ def calculate_vat(order: Order) -> Money:
87
+ ...
88
+ ```
89
+
90
+ **Guidelines:**
91
+ - Annotate at the declaration level, not every line
92
+ - One annotation per decision per code location
93
+ - Multiple decisions can annotate the same code: `// @decision(DL-012) @decision(DL-015)`
94
+ - Use the `annotation_prefix` from `dld.config.yaml` (default: `@decision`)
95
+
96
+ **Keep annotations lean — the decision record is the single source of truth.**
97
+
98
+ The point of `@decision(DL-NNN)` is to keep the rich context (rationale, constraints, alternatives, consequences) in the decision record, *not* scattered through the code. The annotation is a pointer, not a summary. Do not let implementing a decision turn into a comment-writing exercise.
99
+
100
+ - **Default to the bare annotation.** `// @decision(DL-012)` on its own is the norm and is usually all you need.
101
+ - **Do not restate the decision's context.** Don't paraphrase the rationale, the alternatives considered, or the "why" in comments. That duplicates the record, creates a second source of truth, and drifts the moment the decision is adjusted.
102
+ - **Avoid "because" comments paired with the annotation.** `// @decision(DL-012)` already means "the reasoning lives in DL-012." Writing `// We use X because Y (see DL-012)` defeats the purpose — drop the "because Y."
103
+ - **Only add a further comment when the *code itself* is genuinely non-obvious** — a subtle invariant, a non-intuitive workaround, a non-local ordering dependency. Such a comment should explain *what the code is doing*, never *why the decision was made* (that's the record's job).
104
+
105
+ When in doubt, leave it out — a reader who wants the "why" follows the annotation to the decision record.
106
+
107
+ ### 4. Update decision records
108
+
109
+ For each implemented decision:
110
+
111
+ 1. **Update the `references` field** in the decision record's YAML frontmatter. Edit the file directly — add the code paths and symbols that were annotated. Example:
112
+ ```yaml
113
+ references:
114
+ - path: src/billing/vat.ts
115
+ symbol: calculateVAT
116
+ - path: src/billing/vat.test.ts
117
+ ```
118
+
119
+ 2. **Update status** from `proposed` to `accepted`:
120
+ ```bash
121
+ node "<skill-dir>/../dld-common/scripts/dld.mjs" update-status DL-NNN accepted
122
+ ```
123
+
124
+ ### 5. Verify annotations
125
+
126
+ After updating all decision records, run `verify-annotations` to confirm every implemented decision has at least one `@decision` annotation in the codebase:
127
+
128
+ ```bash
129
+ node "<skill-dir>/../dld-common/scripts/dld.mjs" verify-annotations DL-005 DL-006
130
+ ```
131
+
132
+ Pass all the decision IDs that were implemented. If any are missing annotations, the command will report them and exit with an error. Go back and add the missing annotations before proceeding.
133
+
134
+ ### 6. Review code changes
135
+
136
+ Check `dld.config.yaml` for the `implement_review` key. If it is set to `false`, skip this step entirely. If it is `true` or absent (default: enabled), proceed.
137
+
138
+ Launch a subagent to review all code changes for correctness and security. Use the `Agent` tool (also called `AgentTool`) with a prompt constructed from the template below, replacing all `{{placeholders}}` with actual values:
139
+
140
+ ```
141
+ You are reviewing code changes for the {{project_name}} project before committing. The changes implement {{decision_count}} decisions ({{decision_range}}) covering:
142
+
143
+ {{decision_summaries}}
144
+
145
+ The project uses:
146
+ {{tech_stack_summary}}
147
+
148
+ Review these files for:
149
+ - Correctness (logic errors, edge cases)
150
+ - Security (SQL injection, directory traversal, XSS, etc.)
151
+ - Consistency with existing patterns and conventions
152
+ - Type safety issues
153
+ - Missing error handling
154
+ - Any code that could be simplified
155
+
156
+ Files to review (read all of them):
157
+ {{file_list}}
158
+
159
+ Also read the practices doc at {{practices_path}}
160
+
161
+ Focus on the changes made for these decisions; report pre-existing issues only where the new code interacts with them. Before reporting consistency findings, examine similar existing code in the repo to learn its conventions.
162
+
163
+ Do NOT make any changes. Only report findings. Be concise — focus on actual issues, not style preferences ({{linter_name}} handles style).
164
+
165
+ Report each finding in this format:
166
+
167
+ ### [SEVERITY] Short title
168
+ - Location: `path/to/file.ext:42`
169
+ - Description: what is wrong and why it matters
170
+ - Recommendation: specific, actionable fix
171
+
172
+ Group findings by severity:
173
+ - Critical (must fix): incorrect behavior, data loss, or an exploitable vulnerability
174
+ - Moderate (should fix): bugs in edge cases, missing error handling that can plausibly trigger
175
+ - Minor (nice to have): simplifications and small improvements
176
+ ```
177
+
178
+ **Filling in the placeholders:**
179
+ - `{{project_name}}` — from `dld.config.yaml` or the repo directory name
180
+ - `{{decision_count}}` and `{{decision_range}}` — count and IDs of the decisions just implemented (e.g., "3 decisions (DL-005 – DL-007)")
181
+ - `{{decision_summaries}}` — one-line summary of each decision's title and intent
182
+ - `{{tech_stack_summary}}` — languages, frameworks, and key libraries from the project (infer from `dld.config.yaml`, `package.json`, or equivalent)
183
+ - `{{file_list}}` — all files you created or modified during steps 2–4
184
+ - `{{practices_path}}` — path to `decisions/PRACTICES.md` (or namespace-specific practices if applicable). Omit the line if no practices file exists.
185
+ - `{{linter_name}}` — the project's linter (e.g., ESLint, Ruff). If unknown, use "the project linter"
186
+
187
+ **Launching the subagent is requested by the user.** Some agent harnesses carry a standing instruction not to spawn subagents unless the user asked for one. That condition is met here: the user asked by running this skill in a project whose `implement_review` setting is enabled. The request does not need to be repeated in conversation, and this step is not an unprompted fan-out — it is one review agent, at a fixed point, that the project opted into.
188
+
189
+ **If the subagent genuinely cannot run** — the tool is unavailable, or the user denies the call — do not silently skip the review. Do it inline instead, and make it a deliberate pass rather than a recollection: re-read each changed file from disk and work through the checklist above against what is actually written. Then state in your final report that the review ran inline rather than in a subagent, and why. An inline review is the author checking their own work; it is weaker than a fresh-context review at catching assumptions baked in while implementing, and the user needs to know which one they got.
190
+
191
+ **Acting on findings:**
192
+ - **Critical** — fix before proceeding
193
+ - **Moderate** — fix unless you disagree with the finding (use your judgment)
194
+ - **Minor** — skip unless trivial to address
195
+
196
+ **Note:** The review subagent operates with limited context and may flag false positives or misunderstand project-specific patterns. Use your own judgment — you have fuller context from having just written the code. If you're uncertain whether a finding warrants a fix, ask the user before making changes.
197
+
198
+ If you made fixes, re-run `verify-annotations` from step 5 to ensure annotations are still intact.
199
+
200
+ ### 7. Regenerate INDEX.md
201
+
202
+ ```bash
203
+ node "<skill-dir>/../dld-common/scripts/dld.mjs" regenerate-index
204
+ ```
205
+
206
+ ### 8. Suggest next steps
207
+
208
+ > Implemented and accepted: **DL-NNN** (<title>)
209
+ >
210
+ > Code changes:
211
+ > - `src/billing/vat.ts` — modified `calculateVAT` (annotated with `@decision(DL-NNN)`)
212
+ > - `src/billing/vat.test.ts` — added tests
213
+ >
214
+ > Next steps:
215
+ > - `/dld-decide` — record another decision
216
+ > - `/dld-audit` — check for drift between decisions and code
@@ -0,0 +1,133 @@
1
+ ---
2
+ name: dld-init
3
+ description: Bootstrap DLD (Decision-Linked Development) in a repository. Creates dld.config.yaml, the decisions/ directory, and INDEX.md. Run once per project.
4
+ compatibility: Requires Node.js 20+ and git.
5
+ metadata:
6
+ dld-kit-version: "1.0.0-rc.1"
7
+ ---
8
+ <!-- Generated by dld-kit from templates/skills/dld-init/SKILL.md. Do not edit: updating the skills overwrites this file. -->
9
+
10
+ # /dld-init — Bootstrap DLD
11
+
12
+ You are initializing Decision-Linked Development (DLD) in this repository. This is an interactive setup process that runs once per project.
13
+
14
+ ## Interaction style
15
+
16
+ Use the `AskUserQuestion` tool for all questions and prompts. This provides a structured input experience for the user rather than waiting for freeform replies.
17
+
18
+ ## Commands
19
+
20
+ The commands below run the `dld` CLI bundled with the dld-common skill, and need Node.js 20+. `<skill-dir>` stands for the absolute path of this skill's directory. If `<skill-dir>/../dld-common/scripts/dld.mjs` does not exist, stop and tell the user to install the dld-common skill: `npx skills add jimutt/dld-kit --skill dld-common`.
21
+
22
+ This skill uses: `create-config`, `create-directories`, `create-empty-index`, `install-rule`.
23
+
24
+ ## Prerequisites
25
+
26
+ - This must be a git repository
27
+ - `dld.config.yaml` must NOT already exist at the repo root (if it does, tell the user DLD is already initialized and suggest the dld-status skill instead)
28
+
29
+ Users who install dld-kit from npm can run `npx dld-kit init` in a terminal instead: it does steps 2–4 and 6 non-interactively and also installs the skills. This skill covers projects whose skills were installed another way.
30
+
31
+ ## Steps
32
+
33
+ ### 1. Ask about project structure
34
+
35
+ Ask the user:
36
+
37
+ > Is this a **flat** project (all decisions in one directory) or a **namespaced** project (decisions organized by component/domain, e.g., for a monorepo)?
38
+
39
+ - **Flat** is the default and right for most projects
40
+ - **Namespaced** is for monorepos or projects with distinct domains (billing, auth, etc.)
41
+
42
+ If namespaced, ask for the initial namespace list. Suggest they can add more later.
43
+
44
+ ### 2. Create `dld.config.yaml`
45
+
46
+ Run `create-config`:
47
+ ```bash
48
+ node "<skill-dir>/../dld-common/scripts/dld.mjs" create-config <mode> [namespace1 namespace2 ...]
49
+ ```
50
+
51
+ Example flat:
52
+ ```bash
53
+ node "<skill-dir>/../dld-common/scripts/dld.mjs" create-config flat
54
+ ```
55
+
56
+ Example namespaced:
57
+ ```bash
58
+ node "<skill-dir>/../dld-common/scripts/dld.mjs" create-config namespaced billing auth shared
59
+ ```
60
+
61
+ ### 3. Create directory structure
62
+
63
+ ```bash
64
+ node "<skill-dir>/../dld-common/scripts/dld.mjs" create-directories
65
+ ```
66
+
67
+ This reads mode and namespaces from `dld.config.yaml` (created in step 2).
68
+
69
+ ### 4. Create initial INDEX.md
70
+
71
+ ```bash
72
+ node "<skill-dir>/../dld-common/scripts/dld.mjs" create-empty-index
73
+ ```
74
+
75
+ This reads mode from `dld.config.yaml`.
76
+
77
+ ### 5. Offer to create a practices manifest
78
+
79
+ Ask the user:
80
+
81
+ > Would you like to create a **development practices manifest**? This is an optional document (`decisions/PRACTICES.md`) that captures your project's development conventions (testing approach, code style, error handling patterns, etc.). The AI agent reads this when making and implementing decisions.
82
+ >
83
+ > You can skip this now and add it later at any time.
84
+
85
+ If they accept, help them fill it out by asking about:
86
+ - Testing practices (TDD? coverage targets? integration test requirements?)
87
+ - Code style preferences (error handling patterns, validation approach)
88
+ - Architecture conventions (dependency injection, repository pattern, etc.)
89
+
90
+ If the repository already has application code, scan it first and suggest conventions you observe (e.g., "I see you're using Result types for error handling and Zod for validation — should I include those?"). This saves the user from having to recall everything from scratch.
91
+
92
+ Write `decisions/PRACTICES.md` with their answers in simple markdown format:
93
+ ```markdown
94
+ # Development Practices
95
+
96
+ ## Testing
97
+ - ...
98
+
99
+ ## Code Style
100
+ - ...
101
+
102
+ ## Architecture
103
+ - ...
104
+ ```
105
+
106
+ For namespaced projects, this is the root-level shared practices. Mention they can create namespace-specific practices later at `decisions/records/<namespace>/PRACTICES.md`.
107
+
108
+ ### 6. Install the always-on rule
109
+
110
+ The rule tells the agent to look up `@decision` annotations before changing annotated code, in every session. Install it for the harness you are running in:
111
+
112
+ ```bash
113
+ node "<skill-dir>/../dld-common/scripts/dld.mjs" install-rule --agent <harness>
114
+ ```
115
+
116
+ `<harness>` is one of `claude` (Claude Code), `antigravity`, `codex`, `cursor`, `opencode` or `pi`; for another harness that reads `AGENTS.md`, such as Copilot CLI, use `codex`. If you are unsure which one you are, or the user says the team uses several agents, ask the user and pass them all, comma-separated (e.g. `--agent claude,codex`). The command decides where the rule goes (a rule file the harness loads, or a marked block in `AGENTS.md` or `CLAUDE.md`) and prints what it wrote; relay that to the user, including any warning.
117
+
118
+ Do not write the rule into `CLAUDE.md` or `AGENTS.md` yourself.
119
+
120
+ ### 7. Suggest next steps
121
+
122
+ Tell the user:
123
+
124
+ > DLD is initialized. Here's what you can do next:
125
+
126
+ If the repository already has application code:
127
+ > - the dld-retrofit skill — generate initial decisions from your existing codebase
128
+ > - Edit `decisions/PRACTICES.md` to refine your development practices (if created)
129
+
130
+ If this is a new/empty project:
131
+ > - the dld-decide skill — record your first decision
132
+ > - the dld-plan skill — break down a feature into multiple decisions
133
+ > - Edit `decisions/PRACTICES.md` to refine your development practices (if created)
@@ -0,0 +1,76 @@
1
+ ---
2
+ name: dld-lookup
3
+ description: Look up decisions by ID, tag, code path, or keyword. IMPORTANT — use this proactively whenever you encounter `@decision` annotations in code you are about to read or modify.
4
+ compatibility: No external dependencies.
5
+ metadata:
6
+ dld-kit-version: "1.0.0-rc.1"
7
+ ---
8
+ <!-- Generated by dld-kit from templates/skills/dld-lookup/SKILL.md. Do not edit: updating the skills overwrites this file. -->
9
+
10
+ # /dld-lookup — Look Up Decisions
11
+
12
+ You are looking up decision records. This skill is used in two ways:
13
+ 1. **Proactively by you (the AI agent)** — whenever you encounter `@decision(DL-XXX)` annotations in code you're reading or about to modify, look up the decision to understand the rationale before proceeding. This is not optional.
14
+ 2. **On request by the developer** — to query decisions by ID, tag, code path, or keyword.
15
+
16
+ ## Prerequisites
17
+
18
+ Check that `dld.config.yaml` exists at the repo root. If not, tell the user to run `/dld-init` first and stop.
19
+
20
+ Read `dld.config.yaml` to understand the project structure (flat vs namespaced, decisions directory). The decisions directory path can be resolved by reading the `decisions_dir` field from `dld.config.yaml`. Decision records (DL-*.md) live in the `records/` subdirectory under the decisions directory.
21
+
22
+ ## Query modes
23
+
24
+ Parse the user's input to determine the query type:
25
+
26
+ ### By ID: `/dld-lookup DL-047`
27
+
28
+ Find and read the decision file `DL-047.md`. Search the records subdirectory (`decisions/records/`, including namespace subdirectories) for the file.
29
+
30
+ Display the full decision record.
31
+
32
+ ### By tag: `/dld-lookup tag:payment-gateway`
33
+
34
+ Scan all decision files and find those with the matching tag in their YAML frontmatter `tags` field.
35
+
36
+ Display a summary table, then offer to show full details for any specific decision:
37
+
38
+ ```
39
+ Found 3 decisions tagged `payment-gateway`:
40
+
41
+ | ID | Title | Status |
42
+ |----|-------|--------|
43
+ | DL-045 | Payment gateway retry strategy | accepted |
44
+ | DL-046 | Idempotency key format | proposed |
45
+ | DL-047 | Gateway timeout handling | proposed |
46
+
47
+ Would you like to see the full details for any of these?
48
+ ```
49
+
50
+ ### By code path: `/dld-lookup path:src/billing/vat.ts`
51
+
52
+ Scan all decision files and find those with a matching `path` in their `references` field. Match both exact paths and partial paths (e.g., `vat.ts` should match `src/billing/vat.ts`).
53
+
54
+ Display results the same way as tag lookup.
55
+
56
+ ### By keyword: `/dld-lookup <search terms>`
57
+
58
+ If the input doesn't match the `DL-NNN`, `tag:`, or `path:` patterns, treat it as a keyword search. Search across:
59
+ - Decision titles
60
+ - Decision body content (Context, Decision, Rationale, Consequences sections)
61
+ - Tags
62
+
63
+ Display results the same way as tag lookup.
64
+
65
+ ## Proactive usage (encountering `@decision` annotations)
66
+
67
+ When you encounter `@decision(DL-XXX)` in code — whether you are reading, modifying, or reviewing it — you MUST look up the referenced decision before proceeding. This applies to all interactions with annotated code, not just when explicitly asked.
68
+
69
+ After reading the decision:
70
+
71
+ 1. **Understand** the rationale behind the annotated code
72
+ 2. **Assess** whether your planned changes are compatible with the decision
73
+ 3. **If they conflict** — stop and inform the user. Explain the conflict and suggest recording a new decision via `/dld-decide` that supersedes the existing one. Do not silently modify code in a way that contradicts an active decision.
74
+ 4. **If they're compatible** — proceed with the modification
75
+
76
+ This is the core DLD feedback loop — `@decision` annotations are mechanical triggers that ensure design rationale is consulted before code is changed.