sdlc-framework 1.0.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.
- package/LICENSE +21 -0
- package/README.md +321 -0
- package/bin/install.js +193 -0
- package/package.json +39 -0
- package/src/commands/close.md +200 -0
- package/src/commands/debug.md +124 -0
- package/src/commands/fast.md +149 -0
- package/src/commands/fix.md +104 -0
- package/src/commands/help.md +144 -0
- package/src/commands/hotfix.md +99 -0
- package/src/commands/impl.md +142 -0
- package/src/commands/init.md +93 -0
- package/src/commands/milestone.md +136 -0
- package/src/commands/pause.md +115 -0
- package/src/commands/research.md +136 -0
- package/src/commands/resume.md +103 -0
- package/src/commands/review.md +195 -0
- package/src/commands/spec.md +164 -0
- package/src/commands/status.md +118 -0
- package/src/commands/verify.md +153 -0
- package/src/references/clarification-strategy.md +352 -0
- package/src/references/engineering-laws.md +374 -0
- package/src/references/loop-phases.md +331 -0
- package/src/references/playwright-testing.md +298 -0
- package/src/references/prompt-detection.md +264 -0
- package/src/references/sub-agent-strategy.md +260 -0
- package/src/rules/commands.md +180 -0
- package/src/rules/style.md +354 -0
- package/src/rules/templates.md +238 -0
- package/src/rules/workflows.md +314 -0
- package/src/templates/HANDOFF.md +121 -0
- package/src/templates/LAWS.md +521 -0
- package/src/templates/PROJECT.md +112 -0
- package/src/templates/REVIEW.md +145 -0
- package/src/templates/ROADMAP.md +101 -0
- package/src/templates/SPEC.md +231 -0
- package/src/templates/STATE.md +106 -0
- package/src/templates/SUMMARY.md +126 -0
- package/src/workflows/close-phase.md +189 -0
- package/src/workflows/debug-flow.md +302 -0
- package/src/workflows/fast-forward.md +340 -0
- package/src/workflows/fix-findings.md +235 -0
- package/src/workflows/hotfix-flow.md +190 -0
- package/src/workflows/impl-phase.md +229 -0
- package/src/workflows/init-project.md +249 -0
- package/src/workflows/milestone-management.md +169 -0
- package/src/workflows/pause-work.md +153 -0
- package/src/workflows/research.md +219 -0
- package/src/workflows/resume-project.md +159 -0
- package/src/workflows/review-phase.md +337 -0
- package/src/workflows/spec-phase.md +379 -0
- package/src/workflows/transition-phase.md +203 -0
- package/src/workflows/verify-phase.md +280 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "src/templates/**/*.md"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Template Rules
|
|
7
|
+
|
|
8
|
+
Rules for editing files in `src/templates/`.
|
|
9
|
+
|
|
10
|
+
## File Structure
|
|
11
|
+
|
|
12
|
+
Template files have four sections in this order:
|
|
13
|
+
|
|
14
|
+
1. **Header** — Markdown H1 with the template name
|
|
15
|
+
2. **Introduction** — What the template produces and when to use it
|
|
16
|
+
3. **Template Block** — The actual template content inside a fenced code block or XML tag
|
|
17
|
+
4. **Field Documentation** — Description of every field in the template
|
|
18
|
+
|
|
19
|
+
```markdown
|
|
20
|
+
# Spec Template
|
|
21
|
+
|
|
22
|
+
Produces a specification document for a single task or feature.
|
|
23
|
+
Use during the SPEC phase after plan approval.
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
---
|
|
27
|
+
id: {plan-id}-{sequence}-SPEC
|
|
28
|
+
title: [Spec title — one line describing what is being specified]
|
|
29
|
+
phase: {phase-id}
|
|
30
|
+
status: draft
|
|
31
|
+
created: {date}
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Requirements
|
|
35
|
+
|
|
36
|
+
[List each functional requirement as a numbered item. Each requirement
|
|
37
|
+
must be independently testable.]
|
|
38
|
+
|
|
39
|
+
## Acceptance Criteria
|
|
40
|
+
|
|
41
|
+
[Write acceptance criteria in Given/When/Then format. One criterion
|
|
42
|
+
per requirement minimum.]
|
|
43
|
+
|
|
44
|
+
## Technical Constraints
|
|
45
|
+
|
|
46
|
+
[List architectural, performance, security, or compatibility constraints
|
|
47
|
+
that bound the implementation.]
|
|
48
|
+
|
|
49
|
+
## Out of Scope
|
|
50
|
+
|
|
51
|
+
[Explicitly list what this spec does NOT cover. Prevents scope creep
|
|
52
|
+
during implementation.]
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
## Field Documentation
|
|
56
|
+
|
|
57
|
+
| Field | Format | Description |
|
|
58
|
+
|-------|--------|-------------|
|
|
59
|
+
| `id` | `{plan-id}-{sequence}-SPEC` | Auto-generated from plan ID and sequence number |
|
|
60
|
+
| `title` | Free text | Human-readable summary of the spec's scope |
|
|
61
|
+
| `phase` | `NN-kebab-name` | Phase ID from PLAN.md |
|
|
62
|
+
| `status` | `draft`, `approved`, `implemented` | Lifecycle state of the spec |
|
|
63
|
+
| `created` | `YYYY-MM-DD` | Date the spec was created |
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Placeholder Conventions
|
|
67
|
+
|
|
68
|
+
### Square Brackets: `[Human-Fillable]`
|
|
69
|
+
|
|
70
|
+
Use square brackets for fields that require human judgment or creative input. The text inside the brackets is an instruction, not a default value.
|
|
71
|
+
|
|
72
|
+
```markdown
|
|
73
|
+
[Spec title — one line describing what is being specified]
|
|
74
|
+
[List each functional requirement as a numbered item]
|
|
75
|
+
[Describe the expected behavior when the input is valid]
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Rules:
|
|
79
|
+
- The instruction inside brackets tells the author what to write, not how to format it.
|
|
80
|
+
- Start with an imperative verb when the field requires generating content.
|
|
81
|
+
- Include constraints in the instruction when the field has specific requirements.
|
|
82
|
+
|
|
83
|
+
### Curly Braces: `{Variable}`
|
|
84
|
+
|
|
85
|
+
Use curly braces for fields that are auto-populated from system state, arguments, or computed values. The text inside the braces names the data source.
|
|
86
|
+
|
|
87
|
+
```markdown
|
|
88
|
+
{plan-id}
|
|
89
|
+
{date}
|
|
90
|
+
{phase-id}
|
|
91
|
+
{spec-id}
|
|
92
|
+
{command-output}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Rules:
|
|
96
|
+
- Variable names use `kebab-case`.
|
|
97
|
+
- Each variable must be documented in the Field Documentation table.
|
|
98
|
+
- Variables resolve at generation time — the template consumer fills them programmatically.
|
|
99
|
+
|
|
100
|
+
### Mixing Placeholders
|
|
101
|
+
|
|
102
|
+
A single field may combine both types:
|
|
103
|
+
|
|
104
|
+
```markdown
|
|
105
|
+
## {phase-id}: [Phase title describing the work]
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The variable part is auto-populated; the bracketed part requires human input.
|
|
109
|
+
|
|
110
|
+
## YAML Frontmatter in Templates
|
|
111
|
+
|
|
112
|
+
When a template contains YAML frontmatter, that frontmatter is example content to be generated — it is NOT metadata about the template file itself. The template file's own metadata (if any) lives in a separate frontmatter block at the very top of the file before the H1 header.
|
|
113
|
+
|
|
114
|
+
```markdown
|
|
115
|
+
---
|
|
116
|
+
paths:
|
|
117
|
+
- "src/templates/spec.md"
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
# Spec Template
|
|
121
|
+
|
|
122
|
+
<template>
|
|
123
|
+
---
|
|
124
|
+
id: {plan-id}-{sequence}-SPEC
|
|
125
|
+
title: [Spec title]
|
|
126
|
+
---
|
|
127
|
+
...
|
|
128
|
+
</template>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
The outer `---` block is file metadata (paths, tags). The inner `---` block inside `<template>` is the generated document's frontmatter.
|
|
132
|
+
|
|
133
|
+
## Self-Documenting Fields
|
|
134
|
+
|
|
135
|
+
Every field in the template must have a corresponding entry in the Field Documentation table. No undocumented fields.
|
|
136
|
+
|
|
137
|
+
### Field Documentation Table Format
|
|
138
|
+
|
|
139
|
+
| Column | Required | Description |
|
|
140
|
+
|--------|----------|-------------|
|
|
141
|
+
| Field | Yes | The field name as it appears in the template |
|
|
142
|
+
| Format | Yes | Expected format, enum values, or data type |
|
|
143
|
+
| Description | Yes | What the field represents and how to fill it |
|
|
144
|
+
|
|
145
|
+
### Field Description Rules
|
|
146
|
+
|
|
147
|
+
- State what the field represents, not just its type.
|
|
148
|
+
- Include valid values or ranges for constrained fields.
|
|
149
|
+
- Specify the data source for `{variable}` fields.
|
|
150
|
+
- Include an example for complex or ambiguous fields.
|
|
151
|
+
|
|
152
|
+
```markdown
|
|
153
|
+
| Field | Format | Description |
|
|
154
|
+
|-------|--------|-------------|
|
|
155
|
+
| `id` | `{plan-id}-{sequence}-SPEC` | Computed from plan ID and spec sequence. Example: `01-03-SPEC` |
|
|
156
|
+
| `title` | Free text, max 80 chars | One-line summary of the spec scope. Displayed in plan overviews |
|
|
157
|
+
| `status` | `draft` / `approved` / `implemented` | Lifecycle state. Transitions: draft -> approved -> implemented |
|
|
158
|
+
| `priority` | `critical` / `high` / `medium` / `low` | Implementation priority within the phase. Drives task ordering |
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Template Block Conventions
|
|
162
|
+
|
|
163
|
+
### Use `<template>` Tags
|
|
164
|
+
|
|
165
|
+
Wrap the actual template content in `<template>` tags. This separates the template from its documentation.
|
|
166
|
+
|
|
167
|
+
```xml
|
|
168
|
+
<template>
|
|
169
|
+
(template content here)
|
|
170
|
+
</template>
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Alternative: Fenced Code Blocks
|
|
174
|
+
|
|
175
|
+
When the template content is short (under 20 lines) and contains no markdown that would conflict with the outer document, use a fenced code block with the `template` language hint:
|
|
176
|
+
|
|
177
|
+
````markdown
|
|
178
|
+
```template
|
|
179
|
+
(template content here)
|
|
180
|
+
```
|
|
181
|
+
````
|
|
182
|
+
|
|
183
|
+
Prefer `<template>` tags for longer or markdown-heavy templates.
|
|
184
|
+
|
|
185
|
+
### Template Content Rules
|
|
186
|
+
|
|
187
|
+
- Include all required sections with their placeholders.
|
|
188
|
+
- Use markdown formatting inside the template as it will appear in the generated file.
|
|
189
|
+
- Do not include instructions or commentary inside the template block — put those in Field Documentation.
|
|
190
|
+
- Maintain consistent indentation within the template.
|
|
191
|
+
|
|
192
|
+
## Section-Level Templates
|
|
193
|
+
|
|
194
|
+
Some templates define section structures rather than full documents. These follow the same rules but wrap individual sections:
|
|
195
|
+
|
|
196
|
+
```xml
|
|
197
|
+
<template name="acceptance-criterion">
|
|
198
|
+
### AC-{sequence}: [Criterion title]
|
|
199
|
+
|
|
200
|
+
**Given** [precondition or initial state]
|
|
201
|
+
**When** [action or trigger]
|
|
202
|
+
**Then** [expected outcome or behavior]
|
|
203
|
+
|
|
204
|
+
**Verification**: [How to test this criterion — command, assertion, or manual check]
|
|
205
|
+
</template>
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Name section templates with a `name` attribute on the `<template>` tag. The name uses `kebab-case`.
|
|
209
|
+
|
|
210
|
+
## Composability
|
|
211
|
+
|
|
212
|
+
Templates may reference other templates by name. Use `@templates/{name}.md` to indicate composition.
|
|
213
|
+
|
|
214
|
+
```xml
|
|
215
|
+
<template>
|
|
216
|
+
## Acceptance Criteria
|
|
217
|
+
|
|
218
|
+
For each requirement, generate one criterion using @templates/acceptance-criterion.md.
|
|
219
|
+
</template>
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
The consuming workflow resolves the reference and inlines the sub-template at generation time.
|
|
223
|
+
|
|
224
|
+
## Validation Checklist
|
|
225
|
+
|
|
226
|
+
Before merging a template file, verify:
|
|
227
|
+
|
|
228
|
+
- [ ] H1 header matches the template's purpose
|
|
229
|
+
- [ ] Introduction explains what the template produces and when to use it
|
|
230
|
+
- [ ] Template block wrapped in `<template>` tags or fenced code block
|
|
231
|
+
- [ ] All `[square bracket]` placeholders contain actionable instructions
|
|
232
|
+
- [ ] All `{curly brace}` variables use kebab-case and are documented
|
|
233
|
+
- [ ] Field Documentation table covers every field in the template
|
|
234
|
+
- [ ] YAML inside `<template>` is example frontmatter, not file metadata
|
|
235
|
+
- [ ] No undocumented fields or placeholders
|
|
236
|
+
- [ ] No instructions or commentary inside the template block
|
|
237
|
+
- [ ] Imperative voice in all placeholder instructions
|
|
238
|
+
- [ ] No filler words (see style.md)
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "src/workflows/**/*.md"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Workflow Rules
|
|
7
|
+
|
|
8
|
+
Rules for editing files in `src/workflows/`.
|
|
9
|
+
|
|
10
|
+
## File Structure
|
|
11
|
+
|
|
12
|
+
Workflow files have NO YAML frontmatter. Start directly with the root XML element.
|
|
13
|
+
|
|
14
|
+
```xml
|
|
15
|
+
<workflow name="workflow-name">
|
|
16
|
+
<purpose>...</purpose>
|
|
17
|
+
<when_to_use>...</when_to_use>
|
|
18
|
+
<process>...</process>
|
|
19
|
+
</workflow>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The root `<workflow>` element's `name` attribute must match the filename (minus extension) in kebab-case.
|
|
23
|
+
|
|
24
|
+
## Section Order
|
|
25
|
+
|
|
26
|
+
Sections appear inside `<workflow>` in this exact order. Do not reorder.
|
|
27
|
+
|
|
28
|
+
### 1. `<purpose>` — REQUIRED
|
|
29
|
+
|
|
30
|
+
One to three sentences. State what the workflow accomplishes and why it exists in the SDLC loop. Write for a developer who has never seen this framework.
|
|
31
|
+
|
|
32
|
+
```xml
|
|
33
|
+
<purpose>
|
|
34
|
+
Create a specification document that anchors implementation, verification, and review.
|
|
35
|
+
Specifications translate task descriptions into structured, testable requirements.
|
|
36
|
+
Without a spec, downstream phases have no acceptance criteria to verify against.
|
|
37
|
+
</purpose>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 2. `<when_to_use>` — REQUIRED
|
|
41
|
+
|
|
42
|
+
Declare the expected loop phase, the prior command that triggers this workflow, and the next command that follows. This grounds the workflow in the SDLC loop.
|
|
43
|
+
|
|
44
|
+
```xml
|
|
45
|
+
<when_to_use>
|
|
46
|
+
Phase: SPEC
|
|
47
|
+
Prior command: /sdlc:plan
|
|
48
|
+
Next command: /sdlc:implement
|
|
49
|
+
Trigger: Called by /sdlc:create-spec command after plan is approved.
|
|
50
|
+
</when_to_use>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 3. `<required_reading>` — OPTIONAL
|
|
54
|
+
|
|
55
|
+
List files the workflow must read before executing. Use `@`-references. Include the reason each file is needed.
|
|
56
|
+
|
|
57
|
+
```xml
|
|
58
|
+
<required_reading>
|
|
59
|
+
@references/engineering-laws.md — Enforce SOLID, DRY, YAGNI constraints on spec content
|
|
60
|
+
@templates/spec.md — Structure for the output spec document
|
|
61
|
+
@.sdlc/PLAN.md — Phase breakdown and task decomposition
|
|
62
|
+
</required_reading>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 4. `<loop_context>` — OPTIONAL
|
|
66
|
+
|
|
67
|
+
Describe how this workflow interacts with the broader SDLC loop. Use when the workflow reads or writes shared state, or when its behavior changes based on loop phase.
|
|
68
|
+
|
|
69
|
+
```xml
|
|
70
|
+
<loop_context>
|
|
71
|
+
Reads STATE.md to determine the active phase and plan ID.
|
|
72
|
+
Writes the spec file path into STATE.md.current_artifacts.
|
|
73
|
+
Sets STATE.md.next_required_action to /sdlc:implement on success.
|
|
74
|
+
On failure, sets next_required_action to /sdlc:create-spec with error context.
|
|
75
|
+
</loop_context>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 5. `<process>` — REQUIRED
|
|
79
|
+
|
|
80
|
+
The core logic. Contains ordered `<step>` elements. This is where all detailed implementation logic lives (commands delegate here).
|
|
81
|
+
|
|
82
|
+
```xml
|
|
83
|
+
<process>
|
|
84
|
+
<step name="validate_preconditions">
|
|
85
|
+
...
|
|
86
|
+
</step>
|
|
87
|
+
<step name="gather_context">
|
|
88
|
+
...
|
|
89
|
+
</step>
|
|
90
|
+
<step name="generate_output">
|
|
91
|
+
...
|
|
92
|
+
</step>
|
|
93
|
+
<step name="update_state">
|
|
94
|
+
...
|
|
95
|
+
</step>
|
|
96
|
+
</process>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 6. `<references>` — OPTIONAL
|
|
100
|
+
|
|
101
|
+
List related workflows, commands, or external resources. Use when the workflow has dependencies or alternatives that contributors should know about.
|
|
102
|
+
|
|
103
|
+
```xml
|
|
104
|
+
<references>
|
|
105
|
+
@workflows/spec-review.md — Called if spec requires peer review
|
|
106
|
+
@workflows/plan-creation.md — Upstream workflow that produces the plan
|
|
107
|
+
@commands/create-spec.md — Command that invokes this workflow
|
|
108
|
+
</references>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Step Element Rules
|
|
112
|
+
|
|
113
|
+
### Naming
|
|
114
|
+
|
|
115
|
+
Use `snake_case` for the `name` attribute. The name describes the action, not the outcome.
|
|
116
|
+
|
|
117
|
+
```xml
|
|
118
|
+
<!-- Correct -->
|
|
119
|
+
<step name="validate_preconditions">
|
|
120
|
+
<step name="read_existing_specs">
|
|
121
|
+
<step name="write_spec_file">
|
|
122
|
+
|
|
123
|
+
<!-- Wrong -->
|
|
124
|
+
<step name="ValidatePreconditions">
|
|
125
|
+
<step name="step-1">
|
|
126
|
+
<step name="the_spec_is_written">
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Step Content
|
|
130
|
+
|
|
131
|
+
Each step contains:
|
|
132
|
+
|
|
133
|
+
1. **Why**: One sentence explaining why this step matters. Place it first. A junior developer reading the workflow must understand the purpose of each step without external context.
|
|
134
|
+
2. **What**: Imperative instructions for what to do.
|
|
135
|
+
3. **How** (optional): Implementation details, tool calls, or code patterns when the "what" is not self-evident.
|
|
136
|
+
|
|
137
|
+
```xml
|
|
138
|
+
<step name="validate_preconditions">
|
|
139
|
+
STATE.md must confirm the loop is in SPEC phase — executing spec work in
|
|
140
|
+
the wrong phase corrupts the loop state.
|
|
141
|
+
|
|
142
|
+
Read @.sdlc/STATE.md.
|
|
143
|
+
Verify current_phase equals "SPEC".
|
|
144
|
+
Verify active_plan is not empty.
|
|
145
|
+
|
|
146
|
+
If validation fails:
|
|
147
|
+
Report the mismatch to the user.
|
|
148
|
+
Do not proceed. Set next_required_action to the correct command for the current phase.
|
|
149
|
+
</step>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Step Constraints
|
|
153
|
+
|
|
154
|
+
- Maximum 20 lines per step. If a step exceeds 20 lines, split it.
|
|
155
|
+
- Maximum 12 steps per workflow. If more are needed, extract a sub-workflow.
|
|
156
|
+
- Each step starts with a "why" sentence.
|
|
157
|
+
- Use imperative voice for all instructions.
|
|
158
|
+
|
|
159
|
+
## Loop Phase Awareness
|
|
160
|
+
|
|
161
|
+
Every workflow operates within a specific SDLC loop phase. Declare the expected phase in `<when_to_use>` and validate it in the first process step.
|
|
162
|
+
|
|
163
|
+
### SDLC Loop Phases
|
|
164
|
+
|
|
165
|
+
| Phase | Purpose | Entry Command | Exit Command |
|
|
166
|
+
|-------|---------|---------------|--------------|
|
|
167
|
+
| SPEC | Define requirements | `/sdlc:create-spec` | `/sdlc:implement` |
|
|
168
|
+
| IMPL | Build the solution | `/sdlc:implement` | `/sdlc:verify` |
|
|
169
|
+
| VERIFY | Test and validate | `/sdlc:verify` | `/sdlc:review` |
|
|
170
|
+
| REVIEW | Assess quality | `/sdlc:review` | `/sdlc:close` |
|
|
171
|
+
| CLOSE | Finalize and commit | `/sdlc:close` | Loop complete |
|
|
172
|
+
|
|
173
|
+
### Phase Validation Pattern
|
|
174
|
+
|
|
175
|
+
Every workflow's first step must validate the current phase:
|
|
176
|
+
|
|
177
|
+
```xml
|
|
178
|
+
<step name="validate_phase">
|
|
179
|
+
Running a workflow in the wrong phase produces artifacts that conflict with
|
|
180
|
+
the loop's expected state progression.
|
|
181
|
+
|
|
182
|
+
Read @.sdlc/STATE.md.
|
|
183
|
+
Verify current_phase matches this workflow's expected phase.
|
|
184
|
+
|
|
185
|
+
If phase mismatch:
|
|
186
|
+
Report: "Expected phase {expected}, found {actual}."
|
|
187
|
+
Set next_required_action to the correct command for the actual phase.
|
|
188
|
+
Halt execution.
|
|
189
|
+
</step>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## STATE.md Updates
|
|
193
|
+
|
|
194
|
+
Every workflow must update STATE.md before completing. The update includes:
|
|
195
|
+
|
|
196
|
+
1. **Artifacts produced**: File paths added to `current_artifacts`.
|
|
197
|
+
2. **Next required action**: The `/sdlc:` command the user or agent must run next.
|
|
198
|
+
3. **Phase transition** (if applicable): Update `current_phase` when the workflow completes a phase.
|
|
199
|
+
|
|
200
|
+
```xml
|
|
201
|
+
<step name="update_state">
|
|
202
|
+
STATE.md is the single source of truth for loop progress. Failing to update
|
|
203
|
+
it breaks the deterministic command chain.
|
|
204
|
+
|
|
205
|
+
Update @.sdlc/STATE.md:
|
|
206
|
+
Add output file path to current_artifacts.
|
|
207
|
+
Set next_required_action to /sdlc:implement.
|
|
208
|
+
Set last_completed_action to /sdlc:create-spec.
|
|
209
|
+
</step>
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Conditional Logic Patterns
|
|
213
|
+
|
|
214
|
+
Use plain-language conditionals inside steps. Do not use code syntax. Do not use nested conditionals — flatten with guard clauses.
|
|
215
|
+
|
|
216
|
+
### Correct Pattern
|
|
217
|
+
|
|
218
|
+
```xml
|
|
219
|
+
<step name="check_existing_spec">
|
|
220
|
+
Overwriting an existing spec without acknowledgment loses prior requirements work.
|
|
221
|
+
|
|
222
|
+
Check if .sdlc/specs/{phase}/{spec-id}-SPEC.md exists.
|
|
223
|
+
|
|
224
|
+
If the file exists and $ARGUMENTS does not include --force:
|
|
225
|
+
Report: "Spec already exists. Run with --force to overwrite."
|
|
226
|
+
Halt execution.
|
|
227
|
+
|
|
228
|
+
If the file exists and $ARGUMENTS includes --force:
|
|
229
|
+
Back up existing file to .sdlc/specs/{phase}/{spec-id}-SPEC.md.bak.
|
|
230
|
+
Proceed to next step.
|
|
231
|
+
|
|
232
|
+
If the file does not exist:
|
|
233
|
+
Proceed to next step.
|
|
234
|
+
</step>
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Banned Patterns
|
|
238
|
+
|
|
239
|
+
- Nested if/else blocks deeper than 2 levels.
|
|
240
|
+
- Conditional logic that spans multiple steps (keep each condition self-contained).
|
|
241
|
+
- Implicit fallthrough — every branch must have an explicit instruction.
|
|
242
|
+
|
|
243
|
+
## Error Handling
|
|
244
|
+
|
|
245
|
+
Every workflow must handle failure at each step. Define what happens when a step fails.
|
|
246
|
+
|
|
247
|
+
### Error Handling Rules
|
|
248
|
+
|
|
249
|
+
1. **Fail fast**: If a precondition fails, halt immediately. Do not attempt partial execution.
|
|
250
|
+
2. **Report clearly**: State what failed, what was expected, and what the user should do.
|
|
251
|
+
3. **Update state on failure**: Set `next_required_action` in STATE.md to the recovery command.
|
|
252
|
+
4. **Never swallow errors**: Every failure path must produce visible output.
|
|
253
|
+
|
|
254
|
+
### Error Handling Pattern
|
|
255
|
+
|
|
256
|
+
```xml
|
|
257
|
+
<step name="write_spec_file">
|
|
258
|
+
The spec file is the primary deliverable. Write failures must be caught and
|
|
259
|
+
reported — silent failures leave the loop in an inconsistent state.
|
|
260
|
+
|
|
261
|
+
Write spec content to .sdlc/specs/{phase}/{spec-id}-SPEC.md.
|
|
262
|
+
|
|
263
|
+
If write fails:
|
|
264
|
+
Report: "Failed to write spec file: {error}."
|
|
265
|
+
Do not update STATE.md artifacts.
|
|
266
|
+
Set next_required_action to /sdlc:create-spec (retry).
|
|
267
|
+
Halt execution.
|
|
268
|
+
</step>
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Sub-Agent Delegation
|
|
272
|
+
|
|
273
|
+
Workflows may delegate steps to sub-agents for parallel execution. When delegating:
|
|
274
|
+
|
|
275
|
+
1. Define the sub-agent's task in a single imperative sentence.
|
|
276
|
+
2. Specify the input the sub-agent receives.
|
|
277
|
+
3. Specify the output the sub-agent must produce.
|
|
278
|
+
4. Define the success criteria for the sub-agent's work.
|
|
279
|
+
|
|
280
|
+
```xml
|
|
281
|
+
<step name="delegate_implementation">
|
|
282
|
+
Parallel implementation of independent modules reduces wall-clock time
|
|
283
|
+
without sacrificing quality — each sub-agent works within its bounded context.
|
|
284
|
+
|
|
285
|
+
For each independent module in the spec:
|
|
286
|
+
Spawn a sub-agent with:
|
|
287
|
+
Task: "Implement {module-name} per spec section {section-ref}."
|
|
288
|
+
Input: Spec section content, relevant source files.
|
|
289
|
+
Output: Implementation files, unit tests.
|
|
290
|
+
Success: All tests pass, no lint errors.
|
|
291
|
+
|
|
292
|
+
Wait for all sub-agents to complete.
|
|
293
|
+
Collect and validate outputs.
|
|
294
|
+
</step>
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
## Validation Checklist
|
|
298
|
+
|
|
299
|
+
Before merging a workflow file, verify:
|
|
300
|
+
|
|
301
|
+
- [ ] No YAML frontmatter — file starts with `<workflow>`
|
|
302
|
+
- [ ] `name` attribute on `<workflow>` matches filename
|
|
303
|
+
- [ ] `<purpose>` and `<when_to_use>` present
|
|
304
|
+
- [ ] `<process>` contains `<step>` elements with `snake_case` names
|
|
305
|
+
- [ ] First step validates the expected loop phase
|
|
306
|
+
- [ ] Last step updates STATE.md with next_required_action
|
|
307
|
+
- [ ] Every step starts with a "why" sentence
|
|
308
|
+
- [ ] No step exceeds 20 lines
|
|
309
|
+
- [ ] No more than 12 steps total
|
|
310
|
+
- [ ] All conditional branches have explicit instructions
|
|
311
|
+
- [ ] All failure paths report errors and update state
|
|
312
|
+
- [ ] All `@`-references point to files that exist
|
|
313
|
+
- [ ] Imperative voice throughout
|
|
314
|
+
- [ ] No filler words (see style.md)
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Session Handoff Template
|
|
2
|
+
|
|
3
|
+
This template defines the handoff document created when a developer stops working mid-loop. It is stored at `.sdlc/handoffs/HANDOFF-{{TIMESTAMP}}.md`. The handoff captures everything the next session (or the next developer) needs to continue without re-reading the entire codebase.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```markdown
|
|
8
|
+
# Session Handoff
|
|
9
|
+
|
|
10
|
+
## Metadata
|
|
11
|
+
|
|
12
|
+
- **Timestamp:** {{YYYY-MM-DD HH:MM UTC}}
|
|
13
|
+
- **Session duration:** {{APPROXIMATE_DURATION}}
|
|
14
|
+
- **Handed off by:** {{DEVELOPER_OR_AI_AGENT}}
|
|
15
|
+
|
|
16
|
+
## Current Position
|
|
17
|
+
|
|
18
|
+
- **Milestone:** {{MILESTONE_NAME}} ({{N}}/{{TOTAL}})
|
|
19
|
+
- **Phase:** {{PHASE_NAME}}
|
|
20
|
+
- **Plan:** {{PLAN_NUMBER}}/{{TOTAL_PLANS}} — {{PLAN_DESCRIPTION}}
|
|
21
|
+
- **Loop step:** {{spec/implement/verify/review/close}}
|
|
22
|
+
- **Spec file:** {{SPEC_FILE_PATH or "Not yet created"}}
|
|
23
|
+
- **State file:** .sdlc/STATE.md
|
|
24
|
+
|
|
25
|
+
## Work Completed This Session
|
|
26
|
+
|
|
27
|
+
### Completed Items
|
|
28
|
+
|
|
29
|
+
1. {{WHAT_WAS_DONE — specific, verifiable}}
|
|
30
|
+
2. {{WHAT_WAS_DONE}}
|
|
31
|
+
3. {{WHAT_WAS_DONE}}
|
|
32
|
+
|
|
33
|
+
### Files Created or Modified
|
|
34
|
+
|
|
35
|
+
| File | Change | Status |
|
|
36
|
+
|------|--------|--------|
|
|
37
|
+
| {{FILE_PATH}} | {{WHAT_CHANGED}} | {{complete/partial}} |
|
|
38
|
+
|
|
39
|
+
## In-Progress Items
|
|
40
|
+
|
|
41
|
+
Items that were started but not finished. These are the immediate priorities for the next session.
|
|
42
|
+
|
|
43
|
+
| # | Item | Current State | Remaining Work |
|
|
44
|
+
|---|------|---------------|----------------|
|
|
45
|
+
| IP-001 | {{WHAT_IS_IN_PROGRESS}} | {{WHERE_IT_STANDS}} | {{WHAT_IS_LEFT_TO_DO}} |
|
|
46
|
+
|
|
47
|
+
## Decisions Made
|
|
48
|
+
|
|
49
|
+
Decisions made during this session that affect future work:
|
|
50
|
+
|
|
51
|
+
| # | Decision | Context | Impact |
|
|
52
|
+
|---|----------|---------|--------|
|
|
53
|
+
| D-001 | {{WHAT_WAS_DECIDED}} | {{WHY}} | {{HOW_IT_AFFECTS_NEXT_STEPS}} |
|
|
54
|
+
|
|
55
|
+
## Blockers
|
|
56
|
+
|
|
57
|
+
Issues that prevent progress:
|
|
58
|
+
|
|
59
|
+
| # | Blocker | Impact | Suggested Resolution |
|
|
60
|
+
|---|---------|--------|----------------------|
|
|
61
|
+
| B-001 | {{WHAT_IS_BLOCKING}} | {{WHAT_CANNOT_PROCEED}} | {{HOW_TO_RESOLVE}} |
|
|
62
|
+
|
|
63
|
+
If no blockers: "No blockers."
|
|
64
|
+
|
|
65
|
+
## Next Action Required
|
|
66
|
+
|
|
67
|
+
> **This is the single most important field. It tells the next session exactly what to do first.**
|
|
68
|
+
|
|
69
|
+
**Action:** {{CONCRETE_NEXT_STEP}}
|
|
70
|
+
**Command:** `{{SDLC_COMMAND_TO_RUN}}`
|
|
71
|
+
**Context:** {{WHY_THIS_IS_THE_NEXT_STEP_AND_WHAT_TO_WATCH_FOR}}
|
|
72
|
+
|
|
73
|
+
## Files to Review on Resume
|
|
74
|
+
|
|
75
|
+
Files that the next session should read before doing anything else, in priority order:
|
|
76
|
+
|
|
77
|
+
1. **{{FILE_PATH}}** — {{WHY_TO_READ_THIS_FIRST}}
|
|
78
|
+
2. **{{FILE_PATH}}** — {{WHY}}
|
|
79
|
+
3. **{{FILE_PATH}}** — {{WHY}}
|
|
80
|
+
|
|
81
|
+
## Notes
|
|
82
|
+
|
|
83
|
+
{{ANY_ADDITIONAL_CONTEXT — gotchas, things that almost went wrong, observations about the codebase that are not captured elsewhere}}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Field Documentation
|
|
89
|
+
|
|
90
|
+
### Metadata
|
|
91
|
+
When the handoff happened and how long the session lasted. Duration helps estimate velocity for future planning.
|
|
92
|
+
|
|
93
|
+
### Current Position
|
|
94
|
+
Copied from STATE.md for convenience. The next session should not have to open STATE.md to know where things stand — the handoff is self-contained.
|
|
95
|
+
|
|
96
|
+
### Work Completed This Session
|
|
97
|
+
Specific, verifiable items. Not "worked on authentication" but "implemented JWT token generation in src/auth/token.service.ts, including refresh token rotation." The next session needs to know what is done so they do not redo it.
|
|
98
|
+
|
|
99
|
+
### In-Progress Items
|
|
100
|
+
The critical section. These are tasks that were started but not finished. Each entry must include:
|
|
101
|
+
- What the item is
|
|
102
|
+
- Where it currently stands (e.g., "function skeleton written, business logic not yet implemented")
|
|
103
|
+
- What remains (e.g., "add validation for edge cases, write unit tests")
|
|
104
|
+
|
|
105
|
+
### Decisions Made
|
|
106
|
+
Decisions that occurred outside of the spec's clarification phase. These must be recorded because they are not in any spec file. Without this record, the next session may make a conflicting decision.
|
|
107
|
+
|
|
108
|
+
### Blockers
|
|
109
|
+
Anything preventing progress. Each blocker must have a suggested resolution. If the blocker requires human input, say so explicitly.
|
|
110
|
+
|
|
111
|
+
### Next Action Required
|
|
112
|
+
This is the handoff's reason for existing. A clear, unambiguous next step. The developer opening this file should be able to start working within 2 minutes of reading it.
|
|
113
|
+
|
|
114
|
+
### Files to Review on Resume
|
|
115
|
+
Ordered by importance. The first file is the one that provides the most context for the next action. Usually this is the spec file or the file currently being implemented. Limit to 3-5 files — more than that and the developer loses focus.
|
|
116
|
+
|
|
117
|
+
### Notes
|
|
118
|
+
Free-form section for anything that does not fit elsewhere. Common entries:
|
|
119
|
+
- "The database migration must run before the service starts"
|
|
120
|
+
- "Test suite takes 45 seconds — use --grep to run specific tests"
|
|
121
|
+
- "The API returns 500 instead of 422 for invalid input — known issue, not in scope"
|