km-spec-driven-development 0.1.0 → 0.2.0

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,71 @@
1
+ <!-- km-spec-template: feature/plan@1.0 -->
2
+ # Plan: {{FEATURE_NAME}}
3
+
4
+ | Field | Value |
5
+ |-------|-------|
6
+ | **Feature ID** | {{FEATURE_ID}} |
7
+ | **Linked Spec** | `spec.md` |
8
+ | **Linked Context** | `context.md` |
9
+ | **Status** | Draft |
10
+ | **Tier** | {{TIER}} |
11
+ | **Created** | {{CREATED_DATE}} |
12
+ | **Template** | feature/plan@{{TEMPLATE_VERSION}} |
13
+
14
+ <!--
15
+ AGENT INSTRUCTIONS
16
+ - plan.md is the implementation-planning artifact (absorbs former design.md duties).
17
+ - Do not mark Status Ready for implementation until approach is grounded in context.md
18
+ and confirmed requirements in spec.md.
19
+ - Record DEC-XXX for meaningful choices. Prefer [DECISION REQUIRED] over silent picks.
20
+ -->
21
+
22
+ ## Technical Approach
23
+
24
+ [NEEDS CLARIFICATION]: Describe the intended approach in 2–5 sentences after reading `spec.md` and `context.md`.
25
+
26
+ ## Affected Components
27
+
28
+ | Component | Responsibility | Location (expected) | Confidence |
29
+ |-----------|----------------|---------------------|------------|
30
+ | [NEEDS CLARIFICATION] | | | [NEEDS CLARIFICATION] |
31
+
32
+ ## Data and Interface Considerations
33
+
34
+ - **Data:** [NEEDS CLARIFICATION]: Schema, entities, or state changes (or N/A).
35
+ - **Interfaces:** [NEEDS CLARIFICATION]: Public APIs, events, CLI, or UI contracts (or N/A).
36
+
37
+ ## Error Handling
38
+
39
+ | Condition | Behavior | User / caller feedback |
40
+ |-----------|----------|------------------------|
41
+ | [NEEDS CLARIFICATION] | | |
42
+
43
+ ## Risks
44
+
45
+ - [NEEDS CLARIFICATION]: Implementation risks not already captured in `context.md`.
46
+
47
+ ## Decisions
48
+
49
+ | ID | Decision | Alternatives | Rationale | Confidence |
50
+ |----|----------|--------------|-----------|------------|
51
+ | — | [DECISION REQUIRED]: None yet. | | | |
52
+
53
+ ## Alternatives Considered
54
+
55
+ - [NEEDS CLARIFICATION]: List alternatives only after real evaluation; leave empty with marker until then.
56
+
57
+ ## Open Design Questions
58
+
59
+ - [ ] [NEEDS CLARIFICATION]: What is the smallest shippable technical slice?
60
+ - [ ] [DECISION REQUIRED]: Where should new code live per CONVENTIONS project structure?
61
+
62
+ {{COMPLEX_SECTIONS}}
63
+
64
+ ## Readiness Criteria
65
+
66
+ This `plan.md` is **Ready for implementation tasks** when:
67
+
68
+ - [ ] Technical approach is written and consistent with confirmed requirements.
69
+ - [ ] Affected components map to real or intentionally new paths justified by CONVENTIONS.
70
+ - [ ] Open design questions that block coding are resolved or tracked as blockers.
71
+ - [ ] For **complex** tier: component boundaries, data model, contracts, security, performance, rollout, observability, and rollback sections are filled or explicitly N/A with rationale.
@@ -0,0 +1,88 @@
1
+ <!-- km-spec-template: feature/spec@1.0 -->
2
+ # Feature: {{FEATURE_NAME}}
3
+
4
+ | Field | Value |
5
+ |-------|-------|
6
+ | **Feature ID** | {{FEATURE_ID}} |
7
+ | **Status** | Draft |
8
+ | **Tier** | {{TIER}} |
9
+ | **Created** | {{CREATED_DATE}} |
10
+ | **Template** | feature/spec@{{TEMPLATE_VERSION}} |
11
+
12
+ <!--
13
+ AGENT INSTRUCTIONS
14
+ - Do not invent product requirements, APIs, files, or behaviors.
15
+ - Values marked [INFERRED] are NOT requirements. Do not promote them to
16
+ [CONFIRMED] without evidence from the user, an approved brief, or code.
17
+ - Fill [NEEDS CLARIFICATION] before treating an item as implementable truth.
18
+ - Prefer fewer confirmed requirements over fabricated completeness.
19
+ -->
20
+
21
+ ## Overview
22
+
23
+ {{OVERVIEW_BLOCK}}
24
+
25
+ ## Confirmed Information
26
+
27
+ Only facts that are explicitly known. Do not invent product claims here.
28
+
29
+ {{CONFIRMED_BLOCK}}
30
+
31
+ ## Inferred Suggestions
32
+
33
+ **Not requirements.** Do not implement against this section until items are
34
+ promoted to Confirmed Information or Requirements with evidence or approval.
35
+
36
+ {{INFERRED_BLOCK}}
37
+
38
+ ## Requirements
39
+
40
+ | ID | Description | Priority | Confidence |
41
+ |----|-------------|----------|------------|
42
+ | REQ-001 | [NEEDS CLARIFICATION]: Write a specific, testable requirement. | Must Have | [NEEDS CLARIFICATION] |
43
+ | REQ-002 | [NEEDS CLARIFICATION]: Optional second requirement. Remove if unused. | Should Have | [NEEDS CLARIFICATION] |
44
+
45
+ <!-- Example format (delete when writing real REQs):
46
+ | REQ-001 | User can reset password via email link within 15 minutes | Must Have | [CONFIRMED] |
47
+ -->
48
+
49
+ ## Acceptance Criteria
50
+
51
+ Link each criterion to a requirement ID. Criteria must be observable and falsifiable.
52
+
53
+ - [ ] AC-001 (REQ-001): [NEEDS CLARIFICATION]: Specific check that proves REQ-001.
54
+ - [ ] AC-002 (REQ-002): [NEEDS CLARIFICATION]: Specific check that proves REQ-002.
55
+
56
+ ## Constraints
57
+
58
+ - [NEEDS CLARIFICATION]: Project non-negotiables that apply (see `.specs/project/PROJECT.md`).
59
+ - [NEEDS CLARIFICATION]: Feature-specific technical, security, or UX constraints.
60
+
61
+ ## Out of Scope
62
+
63
+ Explicit exclusions prevent scope creep.
64
+
65
+ - [NEEDS CLARIFICATION]: List what this feature will **not** do.
66
+ - <!-- Example: Push notifications, mobile apps, admin SSO -->
67
+
68
+ ## Open Questions
69
+
70
+ - [ ] [NEEDS CLARIFICATION]: What is the primary user journey for this feature?
71
+ - [ ] [DECISION REQUIRED]: Which existing modules or services own this behavior?
72
+ - [ ] [NEEDS CLARIFICATION]: What is the definition of done for the first shippable slice?
73
+
74
+ ## Change Log
75
+
76
+ | Date | Change | Author |
77
+ |------|--------|--------|
78
+ | {{CREATED_DATE}} | Initial scaffold (km-spec {{TEMPLATE_VERSION}}) | km-spec |
79
+
80
+ ## Document Completion Criteria
81
+
82
+ This `spec.md` is **Ready for plan** when:
83
+
84
+ - [ ] Overview is filled and marked with an appropriate confidence marker.
85
+ - [ ] Every Must Have requirement is specific and marked `[CONFIRMED]` (or explicitly accepted as a working assumption with owner note).
86
+ - [ ] Every Must Have requirement has at least one acceptance criterion.
87
+ - [ ] Out of scope lists concrete exclusions.
88
+ - [ ] Open questions that block implementation are resolved or tracked as blockers in `STATE.md`.
@@ -0,0 +1,290 @@
1
+ <!-- km-spec-template: feature/tasks@1.0 -->
2
+ # Tasks: {{FEATURE_NAME}}
3
+
4
+ | Field | Value |
5
+ |-------|-------|
6
+ | **Feature ID** | {{FEATURE_ID}} |
7
+ | **Linked Spec** | `spec.md` |
8
+ | **Linked Context** | `context.md` |
9
+ | **Linked Plan** | `plan.md` |
10
+ | **Linked Validation** | `validation.md` |
11
+ | **Tier** | {{TIER}} |
12
+ | **Created** | {{CREATED_DATE}} |
13
+ | **Template** | feature/tasks@{{TEMPLATE_VERSION}} |
14
+
15
+ ## Status Summary
16
+
17
+ | Status | Count |
18
+ |--------|-------|
19
+ | TODO | 4 |
20
+ | IN PROGRESS | 0 |
21
+ | DONE | 0 |
22
+ | BLOCKED | 0 |
23
+
24
+ ## Task States
25
+
26
+ | State | Meaning |
27
+ |-------|---------|
28
+ | `TODO` | Not started |
29
+ | `IN PROGRESS` | Actively being worked (prefer one per agent/session) |
30
+ | `DONE` | Completion criteria met **and** required validation evidence recorded |
31
+ | `BLOCKED` | Cannot proceed; reason recorded in Notes and `STATE.md` |
32
+
33
+ Rules:
34
+
35
+ - Do **not** mark `DONE` if required validation failed or was not run.
36
+ - Do **not** invent implementation tasks before requirements and codebase context are analyzed.
37
+ - Mark parallelizable tasks with `[P]` only when file sets are disjoint.
38
+
39
+ ---
40
+
41
+ ## TASK-001 — Confirm requirements in spec.md
42
+
43
+ **Objective:** Fill `spec.md` so Must Have requirements and acceptance criteria are explicit and confidence-marked.
44
+
45
+ **Status:** TODO
46
+
47
+ **Satisfies:** N/A (enables all REQs)
48
+
49
+ **Required context:**
50
+
51
+ - `.specs/project/STATE.md`
52
+ - `.specs/project/PROJECT.md`
53
+ - `spec.md`
54
+ - Product brief or user description if available
55
+
56
+ **Expected files:**
57
+
58
+ - `.specs/features/{{FEATURE_SLUG}}/spec.md`
59
+
60
+ **Constraints:**
61
+
62
+ - Do not invent product requirements.
63
+ - Do not promote `[INFERRED]` to `[CONFIRMED]` without evidence or explicit approval.
64
+
65
+ **Dependencies:** None
66
+
67
+ **Steps:**
68
+
69
+ 1. Read project goals and constraints.
70
+ 2. Write Overview with an appropriate confidence marker.
71
+ 3. Add only requirements that are confirmed or explicitly accepted working assumptions.
72
+ 4. Link acceptance criteria to each Must Have requirement.
73
+ 5. Record open questions and out-of-scope items.
74
+
75
+ **Completion criteria:**
76
+
77
+ - [ ] `spec.md` document completion criteria are satisfied or remaining gaps are listed as blockers.
78
+
79
+ **Validation commands:**
80
+
81
+ - N/A (documentation task). Review `spec.md` against the completion checklist.
82
+
83
+ **Required evidence:**
84
+
85
+ - Spec status moved toward Ready for plan; open blockers in `STATE.md` if any.
86
+
87
+ **Deviations:**
88
+
89
+ -
90
+
91
+ ---
92
+
93
+ ## TASK-002 — Build context from the codebase
94
+
95
+ **Objective:** Populate `context.md` from real repository inspection.
96
+
97
+ **Status:** TODO
98
+
99
+ **Satisfies:** N/A (enables safe implementation)
100
+
101
+ **Required context:**
102
+
103
+ - `spec.md`
104
+ - `.specs/codebase/CONVENTIONS.md`
105
+ - Repository source tree and relevant modules
106
+
107
+ **Expected files:**
108
+
109
+ - `.specs/features/{{FEATURE_SLUG}}/context.md`
110
+
111
+ **Constraints:**
112
+
113
+ - Do not invent file paths or APIs.
114
+ - Mark unknowns `[NEEDS CLARIFICATION]`.
115
+
116
+ **Dependencies:** TASK-001 recommended first (or proceed if requirements are already confirmed).
117
+
118
+ **Steps:**
119
+
120
+ 1. Inspect entry points and modules related to the feature domain.
121
+ 2. Record real related paths, patterns, and risks.
122
+ 3. List likely impacted files with reasons.
123
+
124
+ **Completion criteria:**
125
+
126
+ - [ ] `context.md` completion criteria are met.
127
+
128
+ **Validation commands:**
129
+
130
+ - N/A (documentation). Spot-check that listed paths exist.
131
+
132
+ **Required evidence:**
133
+
134
+ - Paths in `context.md` verified present (or explicitly planned as new files).
135
+
136
+ **Deviations:**
137
+
138
+ -
139
+
140
+ ---
141
+
142
+ ## TASK-003 — Draft implementation plan
143
+
144
+ **Objective:** Fill `plan.md` with a grounded technical approach (depth matches tier **{{TIER}}**).
145
+
146
+ **Status:** TODO
147
+
148
+ **Satisfies:** N/A (shapes implementation tasks)
149
+
150
+ **Required context:**
151
+
152
+ - `spec.md`, `context.md`, `CONVENTIONS.md`
153
+
154
+ **Expected files:**
155
+
156
+ - `.specs/features/{{FEATURE_SLUG}}/plan.md`
157
+
158
+ **Constraints:**
159
+
160
+ - Align with confirmed requirements only.
161
+ - For **complex** tier, complete the complex planning sections or mark N/A with rationale.
162
+
163
+ **Dependencies:** TASK-001, TASK-002
164
+
165
+ **Steps:**
166
+
167
+ 1. Write technical approach and affected components.
168
+ 2. Capture decisions as DEC-XXX when choosing among options.
169
+ 3. Resolve or track open design questions.
170
+
171
+ **Completion criteria:**
172
+
173
+ - [ ] `plan.md` readiness criteria are met for tier **{{TIER}}**.
174
+
175
+ **Validation commands:**
176
+
177
+ - N/A (documentation / design review).
178
+
179
+ **Required evidence:**
180
+
181
+ - Plan status Ready for implementation tasks (or blocker recorded).
182
+
183
+ **Deviations:**
184
+
185
+ -
186
+
187
+ ---
188
+
189
+ ## TASK-004 — Decompose implementation tasks
190
+
191
+ **Objective:** Append atomic implementation tasks (TASK-010+) after analysis. Do not invent them before TASK-001–003 are adequately done.
192
+
193
+ **Status:** TODO
194
+
195
+ **Satisfies:** All confirmed REQs via future tasks
196
+
197
+ **Required context:**
198
+
199
+ - `spec.md`, `context.md`, `plan.md`
200
+
201
+ **Expected files:**
202
+
203
+ - `.specs/features/{{FEATURE_SLUG}}/tasks.md` (this file)
204
+
205
+ **Constraints:**
206
+
207
+ - Each implementation task must reference REQ-IDs, expected files, completion criteria, and validation.
208
+ - Prefer small, reviewable tasks.
209
+ - Use `[P]` only for disjoint file sets.
210
+
211
+ **Dependencies:** TASK-003
212
+
213
+ **Steps:**
214
+
215
+ 1. Break the plan into atomic tasks using the template below.
216
+ 2. Set dependencies and parallelization markers.
217
+ 3. Update the status summary counts.
218
+
219
+ **Completion criteria:**
220
+
221
+ - [ ] Implementation tasks cover all Must Have requirements.
222
+ - [ ] No task lacks linked REQs, expected files, or validation expectations.
223
+
224
+ **Validation commands:**
225
+
226
+ - N/A (planning). Review traceability REQ → TASK.
227
+
228
+ **Required evidence:**
229
+
230
+ - Task graph ready for execution; first implementation task identified in `STATE.md`.
231
+
232
+ **Deviations:**
233
+
234
+ -
235
+
236
+ ---
237
+
238
+ ## Implementation Task Template
239
+
240
+ Copy and renumber starting at **TASK-010** (or next free id). Delete this section’s placeholder row only when real tasks exist—or leave the template for future tasks.
241
+
242
+ ### TASK-XXX — [Title] [P?]
243
+
244
+ **Objective:** [One sentence]
245
+
246
+ **Status:** TODO
247
+
248
+ **Satisfies:** REQ-XXX
249
+
250
+ **Required context:**
251
+
252
+ - `spec.md` (relevant REQs/ACs)
253
+ - `context.md` / `plan.md` sections
254
+ - Concrete source files to read
255
+
256
+ **Expected files:**
257
+
258
+ - `path/to/file` — create | modify
259
+
260
+ **Constraints:**
261
+
262
+ - [Project or task-specific constraints]
263
+
264
+ **Dependencies:** None | TASK-XXX
265
+
266
+ **Steps:**
267
+
268
+ 1. …
269
+ 2. …
270
+
271
+ **Completion criteria:**
272
+
273
+ - [ ] …
274
+
275
+ **Validation commands:**
276
+
277
+ - Use commands from `.specs/codebase/CONVENTIONS.md` → Testing (build, lint, typecheck, tests as applicable).
278
+ - [ ] Build
279
+ - [ ] Lint
280
+ - [ ] Typecheck
281
+ - [ ] Tests
282
+ - [ ] Acceptance criteria for linked REQs
283
+
284
+ **Required evidence:**
285
+
286
+ - Results recorded in this task’s notes and/or `validation.md`.
287
+
288
+ **Deviations:**
289
+
290
+ -
@@ -0,0 +1,52 @@
1
+ <!-- km-spec-template: feature/validation@1.0 -->
2
+ # Validation: {{FEATURE_NAME}}
3
+
4
+ | Field | Value |
5
+ |-------|-------|
6
+ | **Feature ID** | {{FEATURE_ID}} |
7
+ | **Status** | Pending |
8
+ | **Created** | {{CREATED_DATE}} |
9
+ | **Template** | feature/validation@{{TEMPLATE_VERSION}} |
10
+
11
+ This file is an **evidence ledger** only. Record what was run and the outcome.
12
+ Do not treat unchecked boxes as passed. Do not invent gate results.
13
+
14
+ ## Validation Summary
15
+
16
+ | Field | Value |
17
+ |-------|-------|
18
+ | Overall status | Pending |
19
+ | Last updated | |
20
+ | Related tasks | |
21
+
22
+ ## Evidence Ledger
23
+
24
+ | Gate | Result | Command / notes | Task | Date |
25
+ |------|--------|-----------------|------|------|
26
+ | Build | Pending | | | |
27
+ | Lint | Pending | | | |
28
+ | Static analysis / typecheck | Pending | | | |
29
+ | Tests | Pending | | | |
30
+ | Acceptance criteria | Pending | Map to AC-XXX / REQ-XXX | | |
31
+ | Review | Pending | Human or peer review | | |
32
+ | Security | Pending / N/A | Required for auth, data access, or external integrations | | |
33
+
34
+ ## Acceptance Criteria Trace
35
+
36
+ | Criterion | Result | Evidence |
37
+ |-----------|--------|----------|
38
+ | AC-001 | Pending | |
39
+ | AC-002 | Pending | |
40
+
41
+ ## Issues Found
42
+
43
+ None yet.
44
+
45
+ ## Final Result
46
+
47
+ Pending.
48
+
49
+ ## Notes
50
+
51
+ - Prefer commands documented in `.specs/codebase/CONVENTIONS.md` → Testing.
52
+ - A task is not `DONE` until applicable gates above have real evidence.
@@ -0,0 +1,53 @@
1
+ <!-- km-spec-template: quick/SUMMARY@1.0 -->
2
+ # Summary: {{FEATURE_NAME}}
3
+
4
+ | Field | Value |
5
+ |-------|-------|
6
+ | **Linked Task** | `TASK.md` |
7
+ | **Final status** | Pending |
8
+ | **Completed** | |
9
+ | **Template** | quick/SUMMARY@{{TEMPLATE_VERSION}} |
10
+
11
+ Fill this file **after** implementation. Do not invent results.
12
+
13
+ ## Final Status
14
+
15
+ Pending | DONE | BLOCKED | Cancelled (promoted to feature)
16
+
17
+ ## Files Changed
18
+
19
+ - `path/to/file` — [what changed]
20
+
21
+ ## Implementation Summary
22
+
23
+ [NEEDS CLARIFICATION until done]: What changed and why (2–5 sentences).
24
+
25
+ ## Commands Executed
26
+
27
+ ```text
28
+ # example
29
+ # npm test
30
+ ```
31
+
32
+ ## Validation Evidence
33
+
34
+ | Gate | Result | Notes |
35
+ |------|--------|-------|
36
+ | Build | Pending | |
37
+ | Lint | Pending | |
38
+ | Typecheck | Pending | |
39
+ | Tests | Pending | |
40
+ | Manual | Pending | |
41
+ | Acceptance criteria | Pending | |
42
+
43
+ ## Deviations
44
+
45
+ - None yet.
46
+
47
+ ## Remaining Risks
48
+
49
+ - None yet. / [describe]
50
+
51
+ ## Follow-up Work
52
+
53
+ - [ ] None / [ ] Create feature or follow-up quick task: …
@@ -0,0 +1,71 @@
1
+ <!-- km-spec-template: quick/TASK@1.0 -->
2
+ # Quick Task: {{FEATURE_NAME}}
3
+
4
+ | Field | Value |
5
+ |-------|-------|
6
+ | **Status** | TODO |
7
+ | **Created** | {{CREATED_DATE}} |
8
+ | **Template** | quick/TASK@{{TEMPLATE_VERSION}} |
9
+ | **Slug** | {{FEATURE_SLUG}} |
10
+
11
+ <!--
12
+ AGENT INSTRUCTIONS
13
+ - Quick tasks are for low-ambiguity work (typically ≤3 files).
14
+ - Do not invent file paths. Inspect the repository first.
15
+ - If scope grows beyond the promotion criteria, stop and create a feature instead.
16
+ -->
17
+
18
+ ## Objective
19
+
20
+ {{QUICK_OBJECTIVE}}
21
+
22
+ ## Description
23
+
24
+ {{QUICK_DESCRIPTION}}
25
+
26
+ ## Scope
27
+
28
+ Keep the change set small and reviewable.
29
+
30
+ ### Expected files
31
+
32
+ - [NEEDS CLARIFICATION]: `path/to/file` — create | modify
33
+
34
+ List files only after inspection. Prefer ≤3 files for quick mode.
35
+
36
+ ### Constraints
37
+
38
+ - Follow `.specs/codebase/CONVENTIONS.md`.
39
+ - Do not refactor unrelated code.
40
+ - Do not invent APIs or files.
41
+
42
+ ## Acceptance Criteria
43
+
44
+ - [ ] [NEEDS CLARIFICATION]: Observable outcome that proves the fix or change works.
45
+ - [ ] No unrelated behavior change.
46
+
47
+ ## Validation
48
+
49
+ Use project commands from `.specs/codebase/CONVENTIONS.md` → Testing when available.
50
+
51
+ - [ ] Build passes (if applicable)
52
+ - [ ] Lint passes (if available)
53
+ - [ ] Typecheck passes (if available)
54
+ - [ ] Relevant tests pass (if available)
55
+ - [ ] Manual check completed (if needed)
56
+
57
+ ## Out of Scope
58
+
59
+ - [NEEDS CLARIFICATION]: Explicit exclusions for this quick change.
60
+ - New product features that need REQs, plan, or multi-module design.
61
+
62
+ ## Promotion Criteria
63
+
64
+ **Promote to a feature** (`km-spec feature "..."`) when any of the following is true:
65
+
66
+ - More than 3 files are likely affected.
67
+ - Requirements are ambiguous or need stakeholder decisions.
68
+ - New public APIs, data models, or security-sensitive flows are introduced.
69
+ - Implementation planning needs more than a short inline step list (>5 steps or complex dependencies).
70
+
71
+ If promoting, leave this TASK with status BLOCKED or cancelled note and link the new feature path in `SUMMARY.md` / `STATE.md`.