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.
- package/LICENSE +21 -0
- package/README.md +420 -0
- package/dist/dld.mjs +10379 -0
- package/package.json +64 -0
- package/skills/dld-adjust/SKILL.md +142 -0
- package/skills/dld-audit/SKILL.md +162 -0
- package/skills/dld-audit-auto/SKILL.md +172 -0
- package/skills/dld-common/SKILL.md +14 -0
- package/skills/dld-common/scripts/dld.mjs +10379 -0
- package/skills/dld-decide/SKILL.md +119 -0
- package/skills/dld-implement/SKILL.md +216 -0
- package/skills/dld-init/SKILL.md +133 -0
- package/skills/dld-lookup/SKILL.md +76 -0
- package/skills/dld-plan/SKILL.md +135 -0
- package/skills/dld-reindex/SKILL.md +173 -0
- package/skills/dld-retrofit/SKILL.md +181 -0
- package/skills/dld-snapshot/SKILL.md +284 -0
- package/skills/dld-status/SKILL.md +127 -0
- package/templates/rules/dld-workflow.md +22 -0
- package/templates/skills/dld-adjust/SKILL.md +139 -0
- package/templates/skills/dld-audit/SKILL.md +159 -0
- package/templates/skills/dld-audit-auto/SKILL.md +169 -0
- package/templates/skills/dld-common/SKILL.md +12 -0
- package/templates/skills/dld-decide/SKILL.md +116 -0
- package/templates/skills/dld-implement/SKILL.md +213 -0
- package/templates/skills/dld-init/SKILL.md +130 -0
- package/templates/skills/dld-lookup/SKILL.md +73 -0
- package/templates/skills/dld-plan/SKILL.md +132 -0
- package/templates/skills/dld-reindex/SKILL.md +170 -0
- package/templates/skills/dld-retrofit/SKILL.md +178 -0
- package/templates/skills/dld-snapshot/SKILL.md +281 -0
- package/templates/skills/dld-status/SKILL.md +124 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dld-retrofit
|
|
3
|
+
description: Bootstrap DLD decisions from an existing codebase. Analyzes code to infer rationale, generates decision records, and adds `@decision` annotations.
|
|
4
|
+
compatibility: Requires Node.js 20+ and git.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# /dld-retrofit — Retrofit Decisions onto Existing Code
|
|
8
|
+
|
|
9
|
+
You are helping the developer bootstrap DLD in an existing codebase by generating decision records from what the code already does. The goal is **not** 100% decision coverage — it's to create enough scaffolding that the DLD workflow feels natural for future development.
|
|
10
|
+
|
|
11
|
+
## Interaction style
|
|
12
|
+
|
|
13
|
+
Use the `AskUserQuestion` tool for all questions and prompts. This provides a structured input experience for the user rather than waiting for freeform replies.
|
|
14
|
+
|
|
15
|
+
## Commands
|
|
16
|
+
|
|
17
|
+
{{dld-setup}}
|
|
18
|
+
|
|
19
|
+
This skill uses: `next-id`, `create-decision`, `update-status`, `regenerate-index`.
|
|
20
|
+
|
|
21
|
+
## Prerequisites
|
|
22
|
+
|
|
23
|
+
1. Check that `dld.config.yaml` exists at the repo root. If not, tell the user to run `/dld-init` first and stop.
|
|
24
|
+
2. There should be existing application code in the repository. If the repo is empty or only has boilerplate, suggest `/dld-decide` or `/dld-plan` instead.
|
|
25
|
+
|
|
26
|
+
## Read project context
|
|
27
|
+
|
|
28
|
+
1. Read `dld.config.yaml` for project structure (flat vs namespaced, decisions directory)
|
|
29
|
+
2. Read `decisions/PRACTICES.md` if it exists
|
|
30
|
+
3. Check for any existing decisions — retrofit can be run alongside existing decisions
|
|
31
|
+
|
|
32
|
+
## Step 1: Analyze the codebase
|
|
33
|
+
|
|
34
|
+
Perform a broad analysis of the codebase:
|
|
35
|
+
- Identify the main components, modules, and domain areas
|
|
36
|
+
- Note the tech stack, frameworks, and key dependencies
|
|
37
|
+
- Identify architectural patterns in use (layered architecture, domain-driven modules, etc.)
|
|
38
|
+
- Look for non-obvious implementation choices — these are the best candidates for decisions
|
|
39
|
+
|
|
40
|
+
Present a brief summary to the user:
|
|
41
|
+
|
|
42
|
+
> **Codebase analysis:**
|
|
43
|
+
> - [Tech stack summary]
|
|
44
|
+
> - [N] main components/modules identified: [list]
|
|
45
|
+
> - [Notable patterns or architectural choices observed]
|
|
46
|
+
|
|
47
|
+
## Step 2: Determine scope
|
|
48
|
+
|
|
49
|
+
Ask the user:
|
|
50
|
+
|
|
51
|
+
> Would you like to retrofit the **entire codebase**, or focus on a **specific area**?
|
|
52
|
+
|
|
53
|
+
If a specific area, ask them to identify it (a directory, module, or domain concept). Narrow the analysis scope accordingly.
|
|
54
|
+
|
|
55
|
+
## Step 3: Choose granularity
|
|
56
|
+
|
|
57
|
+
Explain the two modes and ask the user to choose:
|
|
58
|
+
|
|
59
|
+
> **Broad mode** — Creates high-level decisions covering major features and components. Produces file-level references only (e.g., `path: src/billing/service.ts`). Good for getting started quickly with a general decision scaffold.
|
|
60
|
+
>
|
|
61
|
+
> **Detailed mode** — Creates finer-grained decisions covering specific behaviors and design choices. Produces method-level references and annotations (e.g., `symbol: calculateVAT`). Takes longer but creates richer traceability from the start.
|
|
62
|
+
>
|
|
63
|
+
> Which mode would you like to use?
|
|
64
|
+
|
|
65
|
+
## Step 4: Identify decisions
|
|
66
|
+
|
|
67
|
+
### System-framing decisions (always include these first)
|
|
68
|
+
|
|
69
|
+
Before diving into implementation details, identify **foundational decisions that frame the system itself**. These establish the context that all other decisions hang on:
|
|
70
|
+
|
|
71
|
+
- **System purpose** — What is this service/application and why does it exist? What problem does it solve? (e.g., "Auth integration microservice bridging platform accounts to Firebase Auth")
|
|
72
|
+
- **Core domain model** — What are the key domain concepts and their relationships? (e.g., "Multi-provider account linking with one primary identity per provider")
|
|
73
|
+
- **Key integration boundaries** — What external systems does this interact with and how? (e.g., "Dual Firebase integration: Admin SDK for backend, REST API for OOB flows")
|
|
74
|
+
|
|
75
|
+
These framing decisions may not map to a single function — they often reference the application entry point, main service interface, or core domain model files. Without them, the projected OVERVIEW.md would read as a collection of implementation details with no narrative anchor.
|
|
76
|
+
|
|
77
|
+
Aim for 1-3 framing decisions depending on the system's complexity. Ask the user to help articulate these — they capture the kind of high-level context that's hardest to infer from code alone.
|
|
78
|
+
|
|
79
|
+
### Implementation-level decisions
|
|
80
|
+
|
|
81
|
+
Then identify decisions at the implementation level. Focus on:
|
|
82
|
+
|
|
83
|
+
- **Architectural choices** — why the code is structured this way (module boundaries, layer patterns, data flow)
|
|
84
|
+
- **Non-obvious implementation details** — retry logic, caching strategies, validation approaches, error handling patterns
|
|
85
|
+
- **Domain rules** — business logic that encodes specific rules or policies
|
|
86
|
+
- **Technology choices** — framework selection, library usage, storage approach
|
|
87
|
+
- **Trade-offs** — places where the code chose one approach over alternatives
|
|
88
|
+
|
|
89
|
+
**Broad mode:** Aim for 1-2 decisions per major component or feature area. Each decision should cover a significant chunk of functionality.
|
|
90
|
+
|
|
91
|
+
**Detailed mode:** Aim for decisions wherever there's a meaningful "why" behind the code. Still don't try to cover everything — focus on the decisions a future developer (or AI agent) would most benefit from knowing about.
|
|
92
|
+
|
|
93
|
+
**Ask when unsure:** If you encounter code that looks like a deliberate design choice but you can't confidently infer the rationale, ask the user. These are often the most valuable decisions to capture — the ones where the "why" isn't obvious from the code alone. For example:
|
|
94
|
+
|
|
95
|
+
> I see the order service retries with a 7-second delay and max 3 attempts. Is there a specific reason for these values, or is it a general resilience pattern?
|
|
96
|
+
|
|
97
|
+
Don't ask about everything — focus on cases where the implementation seems intentionally specific and the rationale would be lost without human input.
|
|
98
|
+
|
|
99
|
+
Present the proposed decisions as a numbered list, with framing decisions first:
|
|
100
|
+
|
|
101
|
+
> **Proposed decisions:**
|
|
102
|
+
>
|
|
103
|
+
> *System framing:*
|
|
104
|
+
> 1. **[System purpose/identity]** — [what this system is and why it exists]
|
|
105
|
+
> - Affects: `src/Application.ts` (or equivalent entry point)
|
|
106
|
+
> 2. **[Core domain model]** — [key concepts and relationships]
|
|
107
|
+
> - Affects: `src/models/Account.ts`, `src/models/Identity.ts`
|
|
108
|
+
>
|
|
109
|
+
> *Implementation decisions:*
|
|
110
|
+
> 3. **[Title]** — [one-line summary]
|
|
111
|
+
> - Affects: `src/path/to/code.ts`
|
|
112
|
+
> 4. **[Title]** — [one-line summary]
|
|
113
|
+
> - Affects: `src/path/to/other.ts`
|
|
114
|
+
> ...
|
|
115
|
+
>
|
|
116
|
+
> Want me to proceed with all of these, remove any, or adjust?
|
|
117
|
+
|
|
118
|
+
Let the user review and adjust the list before proceeding.
|
|
119
|
+
|
|
120
|
+
## Step 5: Generate decision records
|
|
121
|
+
|
|
122
|
+
For each approved decision:
|
|
123
|
+
|
|
124
|
+
1. Read the relevant code to understand what it does and infer the rationale
|
|
125
|
+
2. Write the decision record with Context, Decision, and Rationale sections. The **Context** should describe the problem the code solves. The **Decision** should describe what the code does. The **Rationale** should be your best inference of *why* — acknowledge when you're inferring rather than stating known facts (e.g., "likely chosen because..." or "this approach avoids...").
|
|
126
|
+
3. Include a Consequences section only when trade-offs are apparent from the code
|
|
127
|
+
4. Assign sequential IDs using `next-id`
|
|
128
|
+
5. Create each record using `create-decision`
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
ID=$({{dld}} next-id)
|
|
132
|
+
printf "## Context\n\n...\n\n## Decision\n\n...\n\n## Rationale\n\n..." | {{dld}} create-decision \
|
|
133
|
+
--id "$ID" \
|
|
134
|
+
--title "Title" \
|
|
135
|
+
--tags "tag1, tag2" \
|
|
136
|
+
--body-stdin
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Step 6: Add annotations and references
|
|
140
|
+
|
|
141
|
+
For each decision, add `@decision(DL-NNN)` annotations to the relevant code:
|
|
142
|
+
|
|
143
|
+
- **Broad mode:** Annotate at the file/module level — typically at the top of the file or on the main export/class.
|
|
144
|
+
- **Detailed mode:** Annotate at the function/method/class level where the decision is embodied.
|
|
145
|
+
|
|
146
|
+
Then update each decision record's `references` field directly in the YAML frontmatter with the annotated code paths and symbols.
|
|
147
|
+
|
|
148
|
+
## Step 7: Mark as accepted
|
|
149
|
+
|
|
150
|
+
Since the code already exists, these decisions go directly to `accepted` status:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
{{dld}} update-status DL-NNN accepted
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Do this for each generated decision.
|
|
157
|
+
|
|
158
|
+
## Step 8: Regenerate INDEX.md
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
{{dld}} regenerate-index
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Step 9: Summary and next steps
|
|
165
|
+
|
|
166
|
+
> **Retrofit complete:**
|
|
167
|
+
> - Created **N** decisions (DL-XXX through DL-YYY)
|
|
168
|
+
> - Added **M** `@decision` annotations across the codebase
|
|
169
|
+
> - Mode: [broad/detailed]
|
|
170
|
+
> - Scope: [entire codebase / specific area]
|
|
171
|
+
>
|
|
172
|
+
> These decisions capture the current state of the codebase — not every design choice, but enough to establish a working decision scaffold.
|
|
173
|
+
>
|
|
174
|
+
> Next steps:
|
|
175
|
+
> - Review the generated decisions for accuracy — especially the inferred rationale
|
|
176
|
+
> - `/dld-snapshot` — generate SNAPSHOT.md and OVERVIEW.md from the new decisions
|
|
177
|
+
> - `/dld-decide` — record new decisions as you make changes going forward
|
|
178
|
+
> - `/dld-retrofit` — run again on other areas if you scoped to a specific component
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dld-snapshot
|
|
3
|
+
description: Generate SNAPSHOT.md (detailed decision reference) and OVERVIEW.md (narrative synthesis with diagrams) from the decision log.
|
|
4
|
+
compatibility: Requires Node.js 20+ and git.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# /dld-snapshot — Generate Spec Projection
|
|
8
|
+
|
|
9
|
+
You are generating documents that project the current state of the decision log into readable formats. The two built-in documents are always generated:
|
|
10
|
+
|
|
11
|
+
1. **`decisions/SNAPSHOT.md`** — Detailed per-decision reference. Every active decision with its rationale and code references.
|
|
12
|
+
2. **`decisions/OVERVIEW.md`** — High-level narrative synthesis with Mermaid diagrams. The document you'd hand to someone who needs to understand the system.
|
|
13
|
+
|
|
14
|
+
If the project's `dld.config.yaml` defines `snapshot_artifacts`, additional custom documents are generated as well (see Step 5).
|
|
15
|
+
|
|
16
|
+
## Commands
|
|
17
|
+
|
|
18
|
+
{{dld-setup}}
|
|
19
|
+
|
|
20
|
+
This skill uses: `detect-snapshot-changes`, `collect-active-decisions`, `update-snapshot-state`.
|
|
21
|
+
|
|
22
|
+
## Prerequisites
|
|
23
|
+
|
|
24
|
+
Check that `dld.config.yaml` exists at the repo root. If not, tell the user to run `/dld-init` first and stop.
|
|
25
|
+
|
|
26
|
+
There must be at least one `accepted` decision. If all decisions are `proposed`, tell the user there's nothing to snapshot yet and suggest `/dld-implement`.
|
|
27
|
+
|
|
28
|
+
Check for uncommitted changes to decision files. Run `git status --porcelain -- <decisions_dir>/records/` and inspect the output. If there are unstaged or staged-but-uncommitted decision files, commit them first with a message like `"Update decision records"` before proceeding. This ensures the change detection script can rely on git history. Tell the user you are committing pending decision changes.
|
|
29
|
+
|
|
30
|
+
## Step 1: Determine update mode
|
|
31
|
+
|
|
32
|
+
If the user's message includes `--full` (e.g., `/dld-snapshot --full`), skip change detection and use **full mode** for all documents.
|
|
33
|
+
|
|
34
|
+
Otherwise, run:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
{{dld}} detect-snapshot-changes
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
This outputs:
|
|
41
|
+
- `mode: full` — no prior snapshot state exists, or SNAPSHOT.md/OVERVIEW.md are missing. Proceed with full generation.
|
|
42
|
+
- `mode: incremental` — prior state exists. The output also includes:
|
|
43
|
+
- `new_decisions:` — comma-separated list of new accepted decision IDs (e.g., `DL-072, DL-073`)
|
|
44
|
+
- `modified_decisions:` — comma-separated list of existing decisions changed since last snapshot (status changes, content edits)
|
|
45
|
+
- `commit_range:` — the git range since last snapshot (e.g., `abc1234..HEAD`)
|
|
46
|
+
|
|
47
|
+
If mode is `incremental` but both `new_decisions` and `modified_decisions` are empty, tell the user nothing has changed since the last snapshot and stop.
|
|
48
|
+
|
|
49
|
+
## Step 2: Collect active decisions
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
{{dld}} collect-active-decisions
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This outputs the full content of all `accepted` decisions, separated by `===DLD_DECISION_BOUNDARY===` markers. Parse the output to extract each decision's frontmatter and body. Use the project mode from `dld.config.yaml` (already checked in prerequisites) to determine the organization strategy.
|
|
56
|
+
|
|
57
|
+
## Step 3: Generate or update SNAPSHOT.md
|
|
58
|
+
|
|
59
|
+
### Full mode
|
|
60
|
+
|
|
61
|
+
Write `decisions/SNAPSHOT.md` from scratch using the template and rules below.
|
|
62
|
+
|
|
63
|
+
### Incremental mode
|
|
64
|
+
|
|
65
|
+
Read the existing `decisions/SNAPSHOT.md` and apply targeted edits:
|
|
66
|
+
|
|
67
|
+
1. **For each new decision:** Identify which group heading (`## Namespace` or `## Tag Group`) it belongs to. Insert the new `### DL-NNN: Title` section in the correct position (ascending ID order within the group). If the group heading doesn't exist yet, add a new `## Group` section.
|
|
68
|
+
2. **For each modified decision:** Read its current status from the decision file.
|
|
69
|
+
- If now `superseded` or `deprecated`: remove its `### DL-NNN` section from the file. If the group becomes empty after removal, remove the group heading too.
|
|
70
|
+
- If still `accepted` but content changed: replace its `### DL-NNN` section with updated content.
|
|
71
|
+
- If it has a new `amends` relationship: add an `*Amended by: DL-YYY*` line to the target decision's section.
|
|
72
|
+
3. **Update the header:** Adjust the "Active decisions" count, the "DL-001 through DL-XXX" range, and the date.
|
|
73
|
+
|
|
74
|
+
Do NOT rewrite the entire file. Use targeted edits to insert, remove, or modify only the affected sections.
|
|
75
|
+
|
|
76
|
+
### Template
|
|
77
|
+
|
|
78
|
+
```markdown
|
|
79
|
+
# System Snapshot
|
|
80
|
+
|
|
81
|
+
> Auto-generated from the decision log on YYYY-MM-DD. Do not edit manually.
|
|
82
|
+
> Use `/dld-snapshot` to regenerate. Source of truth: individual decision records.
|
|
83
|
+
>
|
|
84
|
+
> **Active decisions:** N (DL-001 through DL-XXX, excluding superseded/deprecated)
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## <Namespace or Tag Group>
|
|
89
|
+
|
|
90
|
+
### DL-NNN: <Title>
|
|
91
|
+
*Supersedes: DL-XXX* ← only if applicable
|
|
92
|
+
*Amends: DL-XXX* ← only if applicable
|
|
93
|
+
*Amended by: DL-YYY* ← only if another decision amends this one
|
|
94
|
+
|
|
95
|
+
<The Decision section from the record — what was decided. Copy verbatim or lightly condense.>
|
|
96
|
+
|
|
97
|
+
**Rationale:** <1-3 sentence summary of the Rationale section. Condense, don't copy verbatim.>
|
|
98
|
+
|
|
99
|
+
**Code:** `<path>` → `<symbol>`, `<path>`
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### DL-NNN: <Title>
|
|
104
|
+
...
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Organization rules
|
|
108
|
+
|
|
109
|
+
**Namespaced projects:** Primary grouping by namespace. Within each namespace, decisions listed by ID ascending (oldest first — they build on each other).
|
|
110
|
+
|
|
111
|
+
**Flat projects:** Group by tag. Decisions with multiple tags appear under their first/primary tag. Decisions with no tags go under a "General" section. Within each group, decisions listed by ID ascending.
|
|
112
|
+
|
|
113
|
+
### Content rules
|
|
114
|
+
|
|
115
|
+
- Only include `accepted` decisions
|
|
116
|
+
- Skip `superseded`, `deprecated`, and `proposed` decisions entirely
|
|
117
|
+
- When a decision supersedes another (check the `supersedes` field in the YAML frontmatter), include a `*Supersedes: DL-XXX*` note
|
|
118
|
+
- When a decision amends another (check the `amends` field), include an `*Amends: DL-XXX*` note on the amending decision and an `*Amended by: DL-YYY*` note on the original decision
|
|
119
|
+
- The **Decision** section content should be copied directly or lightly condensed — this is the authoritative statement
|
|
120
|
+
- The **Rationale** should be condensed to 1-3 sentences — enough to understand *why*, not every detail
|
|
121
|
+
- **Code** references should list paths and symbols from the frontmatter `references` field
|
|
122
|
+
- If a decision has no Rationale section, omit the Rationale line
|
|
123
|
+
- If a decision has no references, omit the Code line
|
|
124
|
+
|
|
125
|
+
## Step 4: Generate or update OVERVIEW.md
|
|
126
|
+
|
|
127
|
+
This is fundamentally different from SNAPSHOT.md. You are **synthesizing** across decisions to create a readable narrative that explains the system's current design. Think of it as the document you'd give a new team member or use to onboard an AI agent on the project.
|
|
128
|
+
|
|
129
|
+
### Full mode
|
|
130
|
+
|
|
131
|
+
Write `decisions/OVERVIEW.md` from scratch using the template and guidelines below.
|
|
132
|
+
|
|
133
|
+
### Incremental mode
|
|
134
|
+
|
|
135
|
+
Read the existing `decisions/OVERVIEW.md`. Identify which domain sections are affected by the new and modified decisions — look at their namespaces, tags, and the topics they cover. Then:
|
|
136
|
+
|
|
137
|
+
1. **Update only the affected sections.** Rewrite each affected section to integrate new decisions or remove references to superseded/deprecated ones. Leave unaffected sections untouched.
|
|
138
|
+
2. **Add new sections** if new decisions introduce a domain area not covered by existing sections.
|
|
139
|
+
3. **Update diagrams** only if the changeset affects the relationships or components they depict.
|
|
140
|
+
4. **Update the header** (decision count, date) and **Key Technical Choices** if any new decisions are cross-cutting.
|
|
141
|
+
|
|
142
|
+
**Maintaining appropriate abstraction:** The overview should remain a high-level narrative, not grow into a detailed specification. As you update sections, consider whether the overall document still reads as an overview. If adding new decisions makes a section too detailed or the document too long, condense older stable content to make room — summarize established decisions more aggressively to keep focus on what matters for understanding the system. If the document's section structure no longer properly organizes the content (e.g., a new cross-cutting concern spans multiple existing sections), restructure as needed — this may mean a larger rewrite of the document, which is appropriate when the system's shape has meaningfully changed.
|
|
143
|
+
|
|
144
|
+
### Template
|
|
145
|
+
|
|
146
|
+
```markdown
|
|
147
|
+
# System Overview
|
|
148
|
+
|
|
149
|
+
> Auto-generated narrative synthesis from N active decisions. Last updated YYYY-MM-DD.
|
|
150
|
+
> This document is derived from individual decision records — do not edit manually.
|
|
151
|
+
> Use `/dld-snapshot` to regenerate.
|
|
152
|
+
|
|
153
|
+
## Architecture Overview
|
|
154
|
+
|
|
155
|
+
<If there are enough architectural decisions to warrant it, include a high-level Mermaid diagram showing key components and their relationships. Base this on the code references and decision content.>
|
|
156
|
+
|
|
157
|
+
```mermaid
|
|
158
|
+
graph TD
|
|
159
|
+
A[Component A] --> B[Component B]
|
|
160
|
+
B --> C[Component C]
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## <Namespace or Domain Area>
|
|
164
|
+
|
|
165
|
+
<Narrative prose synthesizing the decisions in this area. Write in present tense.
|
|
166
|
+
Explain what the system does and why, weaving together multiple decisions into
|
|
167
|
+
a coherent story. Reference decision IDs parenthetically, e.g., (DL-012).>
|
|
168
|
+
|
|
169
|
+
<If the decisions in this area describe a flow or process, include a Mermaid diagram:>
|
|
170
|
+
|
|
171
|
+
```mermaid
|
|
172
|
+
sequenceDiagram
|
|
173
|
+
participant Client
|
|
174
|
+
participant API
|
|
175
|
+
participant PaymentGateway
|
|
176
|
+
...
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
<Continue with other areas...>
|
|
180
|
+
|
|
181
|
+
## Decision Relationships
|
|
182
|
+
|
|
183
|
+
<Only include this section if there are supersession chains, amendment relationships, or closely related decision groups.
|
|
184
|
+
If no decisions supersede or amend others and there are no meaningful relationship clusters, omit this section entirely.>
|
|
185
|
+
|
|
186
|
+
```mermaid
|
|
187
|
+
graph LR
|
|
188
|
+
DL-003 -->|superseded by| DL-012
|
|
189
|
+
DL-012 -.->|amends| DL-005
|
|
190
|
+
DL-012 -.->|related| DL-014
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Key Technical Choices
|
|
194
|
+
|
|
195
|
+
<Bullet-point summary of the most impactful cross-cutting decisions that don't
|
|
196
|
+
belong to a single area. E.g., "PostgreSQL for primary data store (DL-001)",
|
|
197
|
+
"All API input validated with Zod schemas (DL-008)".>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Narrative guidelines
|
|
201
|
+
|
|
202
|
+
- **Write prose, not lists.** The snapshot already provides the structured listing. The overview should read like a design document.
|
|
203
|
+
- **Synthesize, don't enumerate.** Don't just list decisions — explain how they fit together. "The billing system uses banker's rounding for EU VAT calculations (DL-012), replacing the earlier truncation approach that caused reconciliation failures."
|
|
204
|
+
- **Use present tense.** Describe what the system *does*, not what was decided.
|
|
205
|
+
- **Reference decision IDs parenthetically.** Every claim should be traceable: "(DL-012)" after the relevant statement.
|
|
206
|
+
- **Include Mermaid diagrams where they add clarity.** Good candidates:
|
|
207
|
+
- Architecture/component diagrams when decisions span multiple components
|
|
208
|
+
- Sequence diagrams when decisions describe flows or protocols
|
|
209
|
+
- Relationship diagrams when there are supersession chains or amendment relationships
|
|
210
|
+
- Don't force diagrams if the decisions are simple or unrelated
|
|
211
|
+
- **Keep it proportional.** A project with 5 decisions needs a short overview. A project with 50 needs more structure. Scale the document to the content.
|
|
212
|
+
- **Group by namespace (namespaced projects) or by domain theme (flat projects).** For flat projects, identify natural domain groupings from tags and decision content.
|
|
213
|
+
|
|
214
|
+
### Diagram guidelines
|
|
215
|
+
|
|
216
|
+
When creating Mermaid diagrams:
|
|
217
|
+
- Use `graph TD` or `graph LR` for architecture/component/relationship diagrams
|
|
218
|
+
- Use `sequenceDiagram` for flow/protocol diagrams
|
|
219
|
+
- Use `flowchart` for process/workflow diagrams
|
|
220
|
+
- Keep diagrams focused — show the relationships that decisions actually govern, not a complete system map
|
|
221
|
+
- Label edges with the nature of the relationship
|
|
222
|
+
- Reference relevant decision IDs in node labels or notes where helpful
|
|
223
|
+
- **Always quote node labels** with `["..."]` to avoid parse errors from special characters
|
|
224
|
+
- **Escape `@` as `#64;`** inside node labels and edge labels — raw `@` breaks Mermaid parsing
|
|
225
|
+
- **Use `<br/>` for line breaks** inside quoted labels — do not use `\n` or literal newlines
|
|
226
|
+
- **Avoid special characters** (`(`, `)`, `[`, `]`, `{`, `}`, `|`, `#`, `&`) in unquoted labels — use quoted labels or HTML entities instead
|
|
227
|
+
|
|
228
|
+
## Step 5: Generate custom artifacts
|
|
229
|
+
|
|
230
|
+
Read the `snapshot_artifacts` key from `dld.config.yaml`. If the key is absent or the list is empty, skip this step entirely.
|
|
231
|
+
|
|
232
|
+
For each entry in `snapshot_artifacts`:
|
|
233
|
+
|
|
234
|
+
1. **Validate the `title`:**
|
|
235
|
+
- Must end in `.md`. If not, warn the user and skip this artifact.
|
|
236
|
+
- Must not collide (case-insensitive) with reserved filenames: `SNAPSHOT.md`, `OVERVIEW.md`, `INDEX.md`. If it collides, warn the user and skip this artifact.
|
|
237
|
+
|
|
238
|
+
2. **Generate `decisions/<title>`** using the collected decisions (from Step 2) as context and the `prompt` field as the generation instruction. The file must begin with this standard header:
|
|
239
|
+
|
|
240
|
+
```markdown
|
|
241
|
+
# <Title without .md extension>
|
|
242
|
+
|
|
243
|
+
> Auto-generated from the decision log on YYYY-MM-DD. Do not edit manually.
|
|
244
|
+
> Use `/dld-snapshot` to regenerate.
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Followed by the content generated according to the prompt.
|
|
248
|
+
|
|
249
|
+
Keep track of which custom artifacts were successfully generated — you will need the list for Step 6 and Step 7.
|
|
250
|
+
|
|
251
|
+
## Step 6: Update snapshot state
|
|
252
|
+
|
|
253
|
+
Pass any successfully generated custom artifact filenames as arguments:
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
{{dld}} update-snapshot-state [ARTIFACT_NAME...]
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
For example, if custom artifacts `ONBOARDING.md` and `API-CONTRACTS.md` were generated:
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
{{dld}} update-snapshot-state ONBOARDING.md API-CONTRACTS.md
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
If no custom artifacts were generated, run without arguments:
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
{{dld}} update-snapshot-state
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Step 7: Suggest next steps
|
|
272
|
+
|
|
273
|
+
> Snapshot generated:
|
|
274
|
+
> - `decisions/SNAPSHOT.md` — detailed reference (N active decisions)
|
|
275
|
+
> - `decisions/OVERVIEW.md` — narrative synthesis with diagrams
|
|
276
|
+
> - `decisions/<ARTIFACT>.md` — <one line per custom artifact generated, if any>
|
|
277
|
+
>
|
|
278
|
+
> Next steps:
|
|
279
|
+
> - Review the generated documents for accuracy
|
|
280
|
+
> - `/dld-decide` — record new decisions
|
|
281
|
+
> - `/dld-audit` — check for drift between decisions and code
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dld-status
|
|
3
|
+
description: Quick overview of the decision log state — counts by status, recent decisions, and run tracking info.
|
|
4
|
+
compatibility: No external dependencies.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# /dld-status — Decision Log Overview
|
|
8
|
+
|
|
9
|
+
You are generating a quick overview of the decision log state for the developer.
|
|
10
|
+
|
|
11
|
+
## Files read
|
|
12
|
+
|
|
13
|
+
This skill runs no commands. It reads decision files and state files directly:
|
|
14
|
+
- `dld.config.yaml` — project configuration (decisions directory, mode)
|
|
15
|
+
- `decisions/records/DL-*.md` — all decision records (scan YAML frontmatter for status, tags, timestamp, namespace)
|
|
16
|
+
- `decisions/.dld-state.yaml` — run tracking state for audit and snapshot (may not exist)
|
|
17
|
+
|
|
18
|
+
## Prerequisites
|
|
19
|
+
|
|
20
|
+
Check that `dld.config.yaml` exists at the repo root. If not, tell the user to run `/dld-init` first and stop.
|
|
21
|
+
|
|
22
|
+
## Read project context
|
|
23
|
+
|
|
24
|
+
1. Read `dld.config.yaml` to understand the project structure (flat vs namespaced, decisions directory)
|
|
25
|
+
2. Read all decision files in the records subdirectory (`decisions/records/`) to gather statistics
|
|
26
|
+
|
|
27
|
+
## Generate the overview
|
|
28
|
+
|
|
29
|
+
### 1. Count decisions by status
|
|
30
|
+
|
|
31
|
+
Scan all `DL-*.md` files in the records subdirectory (`decisions/records/`, including namespace subdirectories). Read the `status` field from each file's YAML frontmatter. Count:
|
|
32
|
+
- `proposed`
|
|
33
|
+
- `accepted`
|
|
34
|
+
- `deprecated`
|
|
35
|
+
- `superseded`
|
|
36
|
+
|
|
37
|
+
Present as:
|
|
38
|
+
```
|
|
39
|
+
## Decision Log Status
|
|
40
|
+
|
|
41
|
+
| Status | Count |
|
|
42
|
+
|--------|-------|
|
|
43
|
+
| proposed | 3 |
|
|
44
|
+
| accepted | 12 |
|
|
45
|
+
| deprecated | 2 |
|
|
46
|
+
| superseded | 1 |
|
|
47
|
+
| **Total** | **18** |
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 2. Recent decisions
|
|
51
|
+
|
|
52
|
+
Show the 5 most recent decisions (by timestamp), with ID, title, status:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
## Recent Decisions
|
|
56
|
+
|
|
57
|
+
| ID | Title | Status | Date |
|
|
58
|
+
|----|-------|--------|------|
|
|
59
|
+
| DL-018 | ... | proposed | 2026-03-07 |
|
|
60
|
+
| DL-017 | ... | accepted | 2026-03-06 |
|
|
61
|
+
| ...
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 3. Decisions by grouping
|
|
65
|
+
|
|
66
|
+
**Namespaced projects:** Show decision counts per namespace.
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
## By Namespace
|
|
70
|
+
|
|
71
|
+
| Namespace | Total | Proposed | Accepted |
|
|
72
|
+
|-----------|-------|----------|----------|
|
|
73
|
+
| billing | 8 | 1 | 7 |
|
|
74
|
+
| auth | 5 | 2 | 3 |
|
|
75
|
+
| shared | 5 | 0 | 5 |
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**All projects:** If there are tags in use, show the most active tags (those with the most decisions):
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
## Active Tags
|
|
82
|
+
|
|
83
|
+
| Tag | Decisions |
|
|
84
|
+
|-----|-----------|
|
|
85
|
+
| payment-gateway | 4 |
|
|
86
|
+
| auth-refactor | 3 |
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 4. Run tracking info
|
|
90
|
+
|
|
91
|
+
Read `decisions/.dld-state.yaml` if it exists. Report:
|
|
92
|
+
- Last audit run time and commit hash
|
|
93
|
+
- Last snapshot run time
|
|
94
|
+
|
|
95
|
+
If the file doesn't exist, note that no audits or snapshots have been run yet.
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
## Run History
|
|
99
|
+
|
|
100
|
+
- **Last audit:** 2026-03-06 at commit `a1b2c3d` (1 day ago)
|
|
101
|
+
- **Last snapshot:** 2026-03-05 (2 days ago, covers through DL-015)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Or:
|
|
105
|
+
```
|
|
106
|
+
## Run History
|
|
107
|
+
|
|
108
|
+
No audits or snapshots have been run yet. Use `/dld-audit` to check for drift.
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 5. Proposed decisions needing action
|
|
112
|
+
|
|
113
|
+
If there are any `proposed` decisions, list them as a call to action:
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
## Pending Implementation
|
|
117
|
+
|
|
118
|
+
These decisions are proposed but not yet implemented:
|
|
119
|
+
- **DL-016**: Rate limiting strategy
|
|
120
|
+
- **DL-017**: Cache invalidation approach
|
|
121
|
+
- **DL-018**: Error response format
|
|
122
|
+
|
|
123
|
+
Use `/dld-implement DL-NNN` to implement them.
|
|
124
|
+
```
|