@kynetic-ai/spec 0.3.0 → 0.5.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/dist/cli/batch-exec.d.ts +0 -9
- package/dist/cli/batch-exec.d.ts.map +1 -1
- package/dist/cli/batch-exec.js +16 -4
- package/dist/cli/batch-exec.js.map +1 -1
- package/dist/cli/commands/derive.d.ts.map +1 -1
- package/dist/cli/commands/derive.js +2 -1
- package/dist/cli/commands/derive.js.map +1 -1
- package/dist/cli/commands/guard.d.ts +43 -0
- package/dist/cli/commands/guard.d.ts.map +1 -0
- package/dist/cli/commands/guard.js +200 -0
- package/dist/cli/commands/guard.js.map +1 -0
- package/dist/cli/commands/index.d.ts +1 -0
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +1 -0
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/item.d.ts.map +1 -1
- package/dist/cli/commands/item.js +18 -0
- package/dist/cli/commands/item.js.map +1 -1
- package/dist/cli/commands/log.d.ts.map +1 -1
- package/dist/cli/commands/log.js +5 -4
- package/dist/cli/commands/log.js.map +1 -1
- package/dist/cli/commands/meta.d.ts.map +1 -1
- package/dist/cli/commands/meta.js +2 -1
- package/dist/cli/commands/meta.js.map +1 -1
- package/dist/cli/commands/plan-import.d.ts.map +1 -1
- package/dist/cli/commands/plan-import.js +100 -30
- package/dist/cli/commands/plan-import.js.map +1 -1
- package/dist/cli/commands/ralph.d.ts.map +1 -1
- package/dist/cli/commands/ralph.js +143 -330
- package/dist/cli/commands/ralph.js.map +1 -1
- package/dist/cli/commands/session.d.ts +73 -1
- package/dist/cli/commands/session.d.ts.map +1 -1
- package/dist/cli/commands/session.js +607 -162
- package/dist/cli/commands/session.js.map +1 -1
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +97 -217
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/cli/commands/skill-install.d.ts +4 -1
- package/dist/cli/commands/skill-install.d.ts.map +1 -1
- package/dist/cli/commands/skill-install.js +62 -5
- package/dist/cli/commands/skill-install.js.map +1 -1
- package/dist/cli/commands/task.d.ts.map +1 -1
- package/dist/cli/commands/task.js +128 -59
- package/dist/cli/commands/task.js.map +1 -1
- package/dist/cli/commands/tasks.d.ts.map +1 -1
- package/dist/cli/commands/tasks.js +2 -4
- package/dist/cli/commands/tasks.js.map +1 -1
- package/dist/cli/commands/triage.d.ts.map +1 -1
- package/dist/cli/commands/triage.js +12 -98
- package/dist/cli/commands/triage.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +18 -4
- package/dist/cli/output.js.map +1 -1
- package/dist/daemon/routes/triage.ts +4 -70
- package/dist/parser/config.d.ts +106 -0
- package/dist/parser/config.d.ts.map +1 -1
- package/dist/parser/config.js +47 -0
- package/dist/parser/config.js.map +1 -1
- package/dist/parser/file-lock.d.ts +14 -0
- package/dist/parser/file-lock.d.ts.map +1 -0
- package/dist/parser/file-lock.js +124 -0
- package/dist/parser/file-lock.js.map +1 -0
- package/dist/parser/index.d.ts +1 -0
- package/dist/parser/index.d.ts.map +1 -1
- package/dist/parser/index.js +1 -0
- package/dist/parser/index.js.map +1 -1
- package/dist/parser/plan-document.d.ts +44 -0
- package/dist/parser/plan-document.d.ts.map +1 -1
- package/dist/parser/plan-document.js +76 -8
- package/dist/parser/plan-document.js.map +1 -1
- package/dist/parser/plans.d.ts.map +1 -1
- package/dist/parser/plans.js +28 -102
- package/dist/parser/plans.js.map +1 -1
- package/dist/parser/shadow.d.ts.map +1 -1
- package/dist/parser/shadow.js +11 -7
- package/dist/parser/shadow.js.map +1 -1
- package/dist/parser/yaml.d.ts.map +1 -1
- package/dist/parser/yaml.js +322 -297
- package/dist/parser/yaml.js.map +1 -1
- package/dist/ralph/events.d.ts.map +1 -1
- package/dist/ralph/events.js +24 -0
- package/dist/ralph/events.js.map +1 -1
- package/dist/ralph/index.d.ts +1 -1
- package/dist/ralph/index.d.ts.map +1 -1
- package/dist/ralph/index.js +1 -1
- package/dist/ralph/index.js.map +1 -1
- package/dist/ralph/subagent.d.ts +12 -1
- package/dist/ralph/subagent.d.ts.map +1 -1
- package/dist/ralph/subagent.js +22 -3
- package/dist/ralph/subagent.js.map +1 -1
- package/dist/schema/batch.d.ts +2 -0
- package/dist/schema/batch.d.ts.map +1 -1
- package/dist/schema/common.d.ts +6 -0
- package/dist/schema/common.d.ts.map +1 -1
- package/dist/schema/common.js +8 -0
- package/dist/schema/common.js.map +1 -1
- package/dist/schema/task.d.ts +22 -0
- package/dist/schema/task.d.ts.map +1 -1
- package/dist/schema/task.js +7 -0
- package/dist/schema/task.js.map +1 -1
- package/dist/sessions/store.d.ts +226 -1
- package/dist/sessions/store.d.ts.map +1 -1
- package/dist/sessions/store.js +712 -38
- package/dist/sessions/store.js.map +1 -1
- package/dist/sessions/types.d.ts +51 -2
- package/dist/sessions/types.d.ts.map +1 -1
- package/dist/sessions/types.js +25 -0
- package/dist/sessions/types.js.map +1 -1
- package/dist/strings/errors.d.ts +4 -0
- package/dist/strings/errors.d.ts.map +1 -1
- package/dist/strings/errors.js +2 -0
- package/dist/strings/errors.js.map +1 -1
- package/dist/strings/labels.d.ts +2 -0
- package/dist/strings/labels.d.ts.map +1 -1
- package/dist/strings/labels.js +2 -0
- package/dist/strings/labels.js.map +1 -1
- package/dist/triage/actions.d.ts +27 -0
- package/dist/triage/actions.d.ts.map +1 -0
- package/dist/triage/actions.js +95 -0
- package/dist/triage/actions.js.map +1 -0
- package/dist/triage/constants.d.ts +6 -0
- package/dist/triage/constants.d.ts.map +1 -0
- package/dist/triage/constants.js +7 -0
- package/dist/triage/constants.js.map +1 -0
- package/dist/triage/index.d.ts +3 -0
- package/dist/triage/index.d.ts.map +1 -0
- package/dist/triage/index.js +3 -0
- package/dist/triage/index.js.map +1 -0
- package/dist/utils/git.d.ts +2 -0
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +21 -5
- package/dist/utils/git.js.map +1 -1
- package/package.json +1 -1
- package/plugin/.claude-plugin/marketplace.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/plugins/kspec/skills/create-workflow/SKILL.md +235 -0
- package/plugin/plugins/kspec/skills/observations/SKILL.md +143 -0
- package/plugin/plugins/kspec/skills/plan/SKILL.md +343 -0
- package/plugin/plugins/kspec/skills/reflect/SKILL.md +161 -0
- package/plugin/plugins/kspec/skills/review/SKILL.md +230 -0
- package/plugin/plugins/kspec/skills/task-work/SKILL.md +319 -0
- package/plugin/plugins/kspec/skills/triage-automation/SKILL.md +140 -0
- package/plugin/plugins/kspec/skills/triage-inbox/SKILL.md +232 -0
- package/plugin/plugins/kspec/skills/writing-specs/SKILL.md +354 -0
- package/templates/agents-sections/03-task-lifecycle.md +2 -2
- package/templates/agents-sections/04-pr-workflow.md +3 -3
- package/templates/agents-sections/05-commit-convention.md +14 -0
- package/templates/skills/create-workflow/SKILL.md +228 -0
- package/templates/skills/manifest.yaml +45 -0
- package/templates/skills/observations/SKILL.md +137 -0
- package/templates/skills/plan/SKILL.md +336 -0
- package/templates/skills/reflect/SKILL.md +155 -0
- package/templates/skills/review/SKILL.md +223 -0
- package/templates/skills/task-work/SKILL.md +312 -0
- package/templates/skills/triage-automation/SKILL.md +134 -0
- package/templates/skills/triage-inbox/SKILL.md +225 -0
- package/templates/skills/writing-specs/SKILL.md +347 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: triage-inbox
|
|
3
|
+
description: Process inbox items using the record-act pattern. Categorize,
|
|
4
|
+
promote to spec/task, merge duplicates, defer, or delete stale items with full
|
|
5
|
+
audit trail.
|
|
6
|
+
---
|
|
7
|
+
<!-- kspec-managed -->
|
|
8
|
+
# Inbox Triage
|
|
9
|
+
|
|
10
|
+
Systematically process inbox items using the **record → act** pattern. Records decisions with audit trail, then executes actions.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- Processing accumulated inbox items
|
|
15
|
+
- During a triage session (`kspec workflow start @inbox-triage`)
|
|
16
|
+
- When inbox count is growing and needs attention
|
|
17
|
+
|
|
18
|
+
## Core Concept: Record → Act
|
|
19
|
+
|
|
20
|
+
Triage separates **decision-making** from **execution**:
|
|
21
|
+
|
|
22
|
+
1. **Record** the decision (what to do + why)
|
|
23
|
+
2. **Act** on the decision (execute it)
|
|
24
|
+
|
|
25
|
+
This enables review, override, and audit trails.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Step 1: Record what you want to do
|
|
29
|
+
kspec triage record @inbox-ref --action promote --reasoning "Clear feature request"
|
|
30
|
+
|
|
31
|
+
# Step 2: Execute the decision
|
|
32
|
+
kspec triage act @triage-ref
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Actions
|
|
36
|
+
|
|
37
|
+
| Action | What `act` does |
|
|
38
|
+
|--------|-----------------|
|
|
39
|
+
| `promote` | Creates task from inbox item snapshot |
|
|
40
|
+
| `delete` | Deletes the inbox item |
|
|
41
|
+
| `defer` | Records deferral, no side effect |
|
|
42
|
+
| `spec-gap` | Creates observation tagged spec-gap |
|
|
43
|
+
| `duplicate` | Deletes the inbox item |
|
|
44
|
+
|
|
45
|
+
### Lifecycle
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
record (with action) override (optional) act
|
|
49
|
+
→ triaged → triaged → acted_on
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Workflow
|
|
53
|
+
|
|
54
|
+
### 1. Gather Context
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
kspec session start --full
|
|
58
|
+
kspec inbox list
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 2. Categorize Items
|
|
62
|
+
|
|
63
|
+
Group inbox items by type:
|
|
64
|
+
- **Bugs** — implementation issues, errors
|
|
65
|
+
- **Spec gaps** — missing or incomplete specs
|
|
66
|
+
- **Quick wins** — small, well-defined improvements
|
|
67
|
+
- **Larger features** — need plan mode to design
|
|
68
|
+
- **Process/workflow** — meta improvements
|
|
69
|
+
- **Delete candidates** — outdated, duplicates, already done
|
|
70
|
+
|
|
71
|
+
Present categories to user for alignment.
|
|
72
|
+
|
|
73
|
+
### 3. Triage Each Item
|
|
74
|
+
|
|
75
|
+
**Interactive mode** (recommended for multiple items):
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
kspec triage start
|
|
79
|
+
# Presents untriaged items one by one
|
|
80
|
+
# Prompts for action + reasoning
|
|
81
|
+
# Ctrl+C preserves all previously committed records
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Individual recording** (for targeted decisions):
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
kspec triage record @ref --action promote --reasoning "Clear feature request with spec coverage"
|
|
88
|
+
kspec triage record @ref --action delete --reasoning "Already implemented in PR #123"
|
|
89
|
+
kspec triage record @ref --action defer --reasoning "Depends on auth system redesign"
|
|
90
|
+
kspec triage record @ref --action spec-gap --reasoning "No spec covers error handling for this flow"
|
|
91
|
+
kspec triage record @ref --action duplicate --reasoning "Covered by @existing-spec"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 4. Review and Execute Decisions
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Review what was recorded
|
|
98
|
+
kspec triage list --status triaged
|
|
99
|
+
|
|
100
|
+
# Preview before executing
|
|
101
|
+
kspec triage act @triage-ref --dry-run
|
|
102
|
+
|
|
103
|
+
# Execute decisions
|
|
104
|
+
kspec triage act @triage-ref
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 5. Override If Needed
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Override changes the action while preserving the audit trail
|
|
111
|
+
kspec triage override @triage-ref --action defer --reasoning "Reconsidered - not ready"
|
|
112
|
+
|
|
113
|
+
# Then act on the updated decision
|
|
114
|
+
kspec triage act @triage-ref
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Spec-First Processing
|
|
118
|
+
|
|
119
|
+
For behavior changes, check spec coverage before promoting:
|
|
120
|
+
|
|
121
|
+
1. **Check coverage**: `kspec search "<relevant keyword>"` or `kspec item get @ref`
|
|
122
|
+
2. **Identify gaps**: Does spec have description AND acceptance criteria?
|
|
123
|
+
3. **Update spec**:
|
|
124
|
+
```bash
|
|
125
|
+
kspec item set @ref --description "..."
|
|
126
|
+
kspec item ac add @ref --given "..." --when "..." --then "..."
|
|
127
|
+
```
|
|
128
|
+
4. **Record and act**:
|
|
129
|
+
```bash
|
|
130
|
+
kspec triage record @inbox-ref --action promote --reasoning "Spec updated" --evidence @spec-ref
|
|
131
|
+
kspec triage act @triage-ref
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Plan Mode for Larger Items
|
|
135
|
+
|
|
136
|
+
When an item needs design work:
|
|
137
|
+
|
|
138
|
+
1. Enter plan mode
|
|
139
|
+
2. Explore codebase for patterns/context
|
|
140
|
+
3. Design spec structure and implementation approach
|
|
141
|
+
4. Write plan, exit for approval
|
|
142
|
+
5. Execute: create spec, add AC, derive task
|
|
143
|
+
|
|
144
|
+
## Observation Processing
|
|
145
|
+
|
|
146
|
+
During triage sessions, you may also process pending observations:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
kspec meta observations --pending-resolution
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
For each observation:
|
|
153
|
+
|
|
154
|
+
| Type | How to Process |
|
|
155
|
+
|------|----------------|
|
|
156
|
+
| **friction** | Reveals spec gap? → Create spec or inbox item. Already addressed? → Resolve |
|
|
157
|
+
| **success** | Document in relevant spec or AGENTS.md if broadly useful → Resolve |
|
|
158
|
+
| **question** | Answer if you can. Needs investigation? → Promote to task |
|
|
159
|
+
| **idea** | Clear scope? → Inbox or task. Unclear? → Leave or delete if stale |
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# Promote observation to task
|
|
163
|
+
kspec meta promote @ref --title "Add bulk AC command" --priority 2
|
|
164
|
+
|
|
165
|
+
# Resolve observation
|
|
166
|
+
kspec meta resolve @ref "Resolution notes"
|
|
167
|
+
kspec meta resolve --refs @ref1 @ref2 --resolution "Batch resolution"
|
|
168
|
+
|
|
169
|
+
# Convert inbox item to observation (if it's a pattern, not a task)
|
|
170
|
+
kspec meta observe --from-inbox @ref
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Export for Context
|
|
174
|
+
|
|
175
|
+
Share triage decisions with other agents or sessions:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
# Markdown context blocks (for agent handoff)
|
|
179
|
+
kspec triage export --format context
|
|
180
|
+
|
|
181
|
+
# Full structured data
|
|
182
|
+
kspec triage export --format json
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Bulk Operations with Batch
|
|
186
|
+
|
|
187
|
+
When triaging many items, use `kspec batch` for atomic operations:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
kspec batch --commands '[
|
|
191
|
+
{"command":"triage record","args":{"ref":"@ref1","action":"delete","reasoning":"Stale"}},
|
|
192
|
+
{"command":"triage record","args":{"ref":"@ref2","action":"promote","reasoning":"Clear scope"}}
|
|
193
|
+
]'
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Use `--dry-run` to preview. See `/kspec:help` for full batch documentation.
|
|
197
|
+
|
|
198
|
+
## Common Patterns
|
|
199
|
+
|
|
200
|
+
| Pattern | Action |
|
|
201
|
+
|---------|--------|
|
|
202
|
+
| Already implemented | Verify impl exists → check spec gaps → record delete |
|
|
203
|
+
| Duplicate of existing | Verify original covers scope → record duplicate |
|
|
204
|
+
| Small flag/option | Update spec + AC → record promote |
|
|
205
|
+
| New command | Plan mode → design spec → record promote with evidence |
|
|
206
|
+
| Bug report | Check spec coverage → update spec → record promote |
|
|
207
|
+
| Vague idea | Record defer, or leave untriaged for later |
|
|
208
|
+
| Missing spec | Record spec-gap → creates observation for follow-up |
|
|
209
|
+
|
|
210
|
+
## Key Principles
|
|
211
|
+
|
|
212
|
+
- **Record before act** — Separate decisions from execution for audit trail
|
|
213
|
+
- **Ask one question at a time** — Don't batch decisions in interactive mode
|
|
214
|
+
- **Spec before task** — Fill spec gaps before promoting to tasks
|
|
215
|
+
- **AC is required** — Specs without acceptance criteria are incomplete
|
|
216
|
+
- **Use CLI, not YAML** — All changes through kspec commands
|
|
217
|
+
- **Delete freely** — Outdated or duplicate items should go
|
|
218
|
+
|
|
219
|
+
## Progress Tracking
|
|
220
|
+
|
|
221
|
+
At session end, provide summary:
|
|
222
|
+
- Items triaged (recorded decisions)
|
|
223
|
+
- Actions executed (promoted, deleted, deferred, spec-gap, duplicate)
|
|
224
|
+
- Tasks created/updated
|
|
225
|
+
- Observations resolved
|
|
226
|
+
- Remaining items
|
|
227
|
+
|
|
228
|
+
## Integration
|
|
229
|
+
|
|
230
|
+
- **`/kspec:reflect`** — Session reflection may generate inbox items for triage
|
|
231
|
+
- **`/kspec:observations`** — Captures systemic patterns found during triage
|
|
232
|
+
- **`kspec session start`** — Shows inbox count for triage awareness
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: writing-specs
|
|
3
|
+
description: Create and maintain specification items — modules, features,
|
|
4
|
+
requirements, acceptance criteria, and traits. The source of truth for what to
|
|
5
|
+
build.
|
|
6
|
+
---
|
|
7
|
+
<!-- kspec-managed -->
|
|
8
|
+
# Writing Specs
|
|
9
|
+
|
|
10
|
+
Create and maintain specification items — the source of truth for what to build. This skill covers spec structure, writing good acceptance criteria, using traits, and organizing specs in the hierarchy.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- Creating a new feature, requirement, or constraint spec
|
|
15
|
+
- Adding or refining acceptance criteria
|
|
16
|
+
- Applying traits for cross-cutting behaviors
|
|
17
|
+
- Organizing specs under the right module/parent
|
|
18
|
+
- Reviewing spec quality before deriving tasks
|
|
19
|
+
|
|
20
|
+
**Not for:** Task management (use `/kspec:task-work`), plan-to-spec translation (use `/kspec:plan`), or triage (use `/kspec:triage`).
|
|
21
|
+
|
|
22
|
+
## Finding Things
|
|
23
|
+
|
|
24
|
+
Use CLI commands to discover and inspect specs. **Do NOT search `.kspec/` YAML files manually.**
|
|
25
|
+
|
|
26
|
+
| Need | Command |
|
|
27
|
+
|------|---------|
|
|
28
|
+
| View spec + all ACs | `kspec item get @ref` |
|
|
29
|
+
| Search by keyword | `kspec search "keyword"` |
|
|
30
|
+
| List by type | `kspec item list --type feature` |
|
|
31
|
+
| All modules | `kspec item list --type module` |
|
|
32
|
+
| All traits | `kspec trait list` |
|
|
33
|
+
| Trait details + ACs | `kspec item get @trait-slug` |
|
|
34
|
+
| Items under a parent | `kspec item list --under @parent` |
|
|
35
|
+
|
|
36
|
+
## Core Principles
|
|
37
|
+
|
|
38
|
+
1. **Spec defines WHAT, not HOW** — Describe the desired behavior, not the implementation
|
|
39
|
+
2. **Every spec needs AC** — A spec without acceptance criteria is incomplete
|
|
40
|
+
3. **Given/When/Then is testable** — Each AC should map to at least one test
|
|
41
|
+
4. **Traits eliminate duplication** — Cross-cutting concerns belong in traits, not copied across specs
|
|
42
|
+
5. **Use CLI, not YAML** — All changes through `kspec` commands for auto-commit
|
|
43
|
+
|
|
44
|
+
## Spec Hierarchy
|
|
45
|
+
|
|
46
|
+
Specs live in modules and form a tree:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
module (organizational grouping)
|
|
50
|
+
├── feature (user-facing capability)
|
|
51
|
+
│ ├── requirement (specific testable behavior)
|
|
52
|
+
│ └── constraint (limitation or boundary)
|
|
53
|
+
├── feature
|
|
54
|
+
│ └── requirement
|
|
55
|
+
└── decision (architectural choice, ADR-style)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Choosing the Right Type
|
|
59
|
+
|
|
60
|
+
| Type | Use when | Example |
|
|
61
|
+
|------|----------|---------|
|
|
62
|
+
| `module` | Grouping related features | "CLI Commands", "Web UI", "Schema" |
|
|
63
|
+
| `feature` | User-facing capability | "JSON Export", "Inbox Triage", "Shadow Sync" |
|
|
64
|
+
| `requirement` | Specific testable behavior within a feature | "Export validates output format", "Triage records audit trail" |
|
|
65
|
+
| `constraint` | Non-functional limit or boundary | "Response time < 200ms", "Max 1000 items per module" |
|
|
66
|
+
| `decision` | Architectural choice with rationale | "Use YAML over JSON for spec files" |
|
|
67
|
+
| `trait` | Reusable AC bundle for cross-cutting behaviors | "JSON output mode", "Confirmation prompts" |
|
|
68
|
+
|
|
69
|
+
**Rule of thumb:** If it has acceptance criteria that a user could verify, it's a feature or requirement. If it constrains how something works, it's a constraint. If multiple specs need the same behavior, extract a trait.
|
|
70
|
+
|
|
71
|
+
## Writing Acceptance Criteria
|
|
72
|
+
|
|
73
|
+
AC are the heart of a spec. They define what "done" means.
|
|
74
|
+
|
|
75
|
+
### Format
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
Given: precondition (state before the action)
|
|
79
|
+
When: action (what triggers the behavior)
|
|
80
|
+
Then: outcome (observable, verifiable result)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Good AC Patterns
|
|
84
|
+
|
|
85
|
+
**Specific and testable:**
|
|
86
|
+
```bash
|
|
87
|
+
kspec item ac add @json-export \
|
|
88
|
+
--given "user has 3 tasks in project" \
|
|
89
|
+
--when "user runs 'kspec tasks list --json'" \
|
|
90
|
+
--then "stdout contains valid JSON array with 3 task objects"
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Covers error cases:**
|
|
94
|
+
```bash
|
|
95
|
+
kspec item ac add @json-export \
|
|
96
|
+
--given "project has no tasks" \
|
|
97
|
+
--when "user runs 'kspec tasks list --json'" \
|
|
98
|
+
--then "stdout contains empty JSON array []"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Boundary behavior:**
|
|
102
|
+
```bash
|
|
103
|
+
kspec item ac add @bulk-delete \
|
|
104
|
+
--given "user passes 50 refs (maximum supported)" \
|
|
105
|
+
--when "user runs bulk delete" \
|
|
106
|
+
--then "all 50 items deleted in single operation"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### AC Anti-patterns
|
|
110
|
+
|
|
111
|
+
| Anti-pattern | Problem | Better |
|
|
112
|
+
|-------------|---------|--------|
|
|
113
|
+
| "System works correctly" | Not testable | Describe specific observable outcome |
|
|
114
|
+
| "User is happy" | Subjective | Describe what they can do or see |
|
|
115
|
+
| "Fast performance" | Not measurable | "Response returns within 200ms" |
|
|
116
|
+
| "Handles errors" | Vague | Specific error scenario + expected behavior |
|
|
117
|
+
| Duplicating trait AC | Maintenance burden | Apply the trait instead |
|
|
118
|
+
|
|
119
|
+
### AC Naming Convention
|
|
120
|
+
|
|
121
|
+
AC IDs are auto-generated (`ac-1`, `ac-2`, ...) or can be explicit:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# Auto-generated
|
|
125
|
+
kspec item ac add @feature --given "..." --when "..." --then "..."
|
|
126
|
+
|
|
127
|
+
# Explicit ID for clarity
|
|
128
|
+
kspec item ac add @feature --id ac-json-valid --given "..." --when "..." --then "..."
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### How Many ACs?
|
|
132
|
+
|
|
133
|
+
- **Minimum 1** — Every spec needs at least one
|
|
134
|
+
- **Typical: 2-5** — Happy path + key error cases
|
|
135
|
+
- **If 8+** — Consider splitting the spec into smaller requirements
|
|
136
|
+
- **Each AC = one behavior** — Don't combine multiple verifiable outcomes
|
|
137
|
+
|
|
138
|
+
## Working with Traits
|
|
139
|
+
|
|
140
|
+
Traits are reusable bundles of acceptance criteria. When a spec implements a trait, it inherits all the trait's ACs.
|
|
141
|
+
|
|
142
|
+
### When to Use Traits
|
|
143
|
+
|
|
144
|
+
Apply a trait when a spec needs a standard cross-cutting behavior:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# Discover available traits
|
|
148
|
+
kspec trait list
|
|
149
|
+
|
|
150
|
+
# View trait details (shows ACs that will be inherited)
|
|
151
|
+
kspec trait get @trait-json-output
|
|
152
|
+
|
|
153
|
+
# Apply trait to spec
|
|
154
|
+
kspec item trait add @my-command @trait-json-output
|
|
155
|
+
|
|
156
|
+
# Apply multiple traits
|
|
157
|
+
kspec item trait add @my-command @trait-json-output @trait-dry-run
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Common Traits
|
|
161
|
+
|
|
162
|
+
| Trait | When to apply |
|
|
163
|
+
|-------|---------------|
|
|
164
|
+
| `@trait-json-output` | Command produces machine-readable output |
|
|
165
|
+
| `@trait-dry-run` | Command supports preview before execution |
|
|
166
|
+
| `@trait-confirmation-prompt` | Command is destructive |
|
|
167
|
+
| `@trait-filterable-list` | Command lists items with filter options |
|
|
168
|
+
| `@trait-shadow-commit` | Command modifies `.kspec/` data |
|
|
169
|
+
| `@trait-semantic-exit-codes` | Command exit code carries meaning |
|
|
170
|
+
| `@trait-error-guidance` | Command gives recovery suggestions on errors |
|
|
171
|
+
| `@trait-multi-ref-batch` | Command accepts multiple references |
|
|
172
|
+
| `@trait-priority-parameter` | Command accepts priority option |
|
|
173
|
+
|
|
174
|
+
### Creating New Traits
|
|
175
|
+
|
|
176
|
+
If 3+ specs need the same behavior, consider extracting a trait:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# Create the trait
|
|
180
|
+
kspec trait add "Pagination Support" --description "Commands that paginate large result sets" --slug trait-pagination
|
|
181
|
+
|
|
182
|
+
# Add ACs to the trait
|
|
183
|
+
kspec item ac add @trait-pagination --given "result set > page size" --when "command runs" --then "first page shown with pagination indicator"
|
|
184
|
+
kspec item ac add @trait-pagination --given "user requests next page" --when "user passes --page 2" --then "second page of results shown"
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Trait AC Coverage
|
|
188
|
+
|
|
189
|
+
When implementing specs with traits, all inherited ACs must be covered by tests:
|
|
190
|
+
|
|
191
|
+
```javascript
|
|
192
|
+
// AC: @trait-json-output ac-1
|
|
193
|
+
it('should output valid JSON with --json flag', () => { ... });
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Run `kspec validate` to check for uncovered trait ACs.
|
|
197
|
+
|
|
198
|
+
## Creating Specs
|
|
199
|
+
|
|
200
|
+
### New Feature Under a Module
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
# 1. Find the right parent module
|
|
204
|
+
kspec item list --type module
|
|
205
|
+
|
|
206
|
+
# 2. Create the feature
|
|
207
|
+
kspec item add --under @cli-module --title "Bulk Operations" --type feature --slug bulk-ops
|
|
208
|
+
|
|
209
|
+
# 3. Add description
|
|
210
|
+
kspec item set @bulk-ops --description "Support batch operations on multiple items in a single command"
|
|
211
|
+
|
|
212
|
+
# 4. Add acceptance criteria
|
|
213
|
+
kspec item ac add @bulk-ops \
|
|
214
|
+
--given "user provides 3 item refs" \
|
|
215
|
+
--when "user runs bulk delete" \
|
|
216
|
+
--then "all 3 items deleted and confirmation shown"
|
|
217
|
+
|
|
218
|
+
kspec item ac add @bulk-ops \
|
|
219
|
+
--given "one of 3 refs is invalid" \
|
|
220
|
+
--when "user runs bulk delete" \
|
|
221
|
+
--then "error reported for invalid ref, valid refs still processed"
|
|
222
|
+
|
|
223
|
+
# 5. Apply relevant traits
|
|
224
|
+
kspec item trait add @bulk-ops @trait-confirmation-prompt @trait-dry-run
|
|
225
|
+
|
|
226
|
+
# 6. Validate
|
|
227
|
+
kspec validate
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Requirement Under a Feature
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
kspec item add --under @bulk-ops --title "Ref validation in batch mode" --type requirement --slug bulk-ref-validation
|
|
234
|
+
kspec item ac add @bulk-ref-validation \
|
|
235
|
+
--given "batch contains mix of valid and invalid refs" \
|
|
236
|
+
--when "batch executes" \
|
|
237
|
+
--then "report lists each ref with success/failure status"
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Updating Existing Specs
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
# View current state
|
|
244
|
+
kspec item get @feature-slug
|
|
245
|
+
|
|
246
|
+
# Update description
|
|
247
|
+
kspec item set @feature-slug --description "Updated description"
|
|
248
|
+
|
|
249
|
+
# Add missing AC
|
|
250
|
+
kspec item ac add @feature-slug --given "..." --when "..." --then "..."
|
|
251
|
+
|
|
252
|
+
# Update existing AC
|
|
253
|
+
kspec item ac set @feature-slug ac-2 --then "updated expected outcome"
|
|
254
|
+
|
|
255
|
+
# Mark implementation status
|
|
256
|
+
kspec item set @feature-slug --status implemented
|
|
257
|
+
|
|
258
|
+
# Add relationships
|
|
259
|
+
kspec item set @feature-slug --depends-on @other-feature
|
|
260
|
+
kspec item set @feature-slug --relates-to @related-item
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## Spec Quality Checklist
|
|
264
|
+
|
|
265
|
+
Before deriving a task from a spec, verify:
|
|
266
|
+
|
|
267
|
+
- [ ] **Description** — Explains what and why (not how)
|
|
268
|
+
- [ ] **AC coverage** — At least happy path + primary error case
|
|
269
|
+
- [ ] **AC testability** — Each AC maps to a concrete test
|
|
270
|
+
- [ ] **Traits applied** — Cross-cutting behaviors use traits, not duplicated AC
|
|
271
|
+
- [ ] **Correct parent** — Placed under the right module/feature
|
|
272
|
+
- [ ] **No implementation details** — AC describes behavior, not code structure
|
|
273
|
+
- [ ] **Validation passes** — `kspec validate` reports no errors for this item
|
|
274
|
+
|
|
275
|
+
## Validation
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
# Full validation
|
|
279
|
+
kspec validate
|
|
280
|
+
|
|
281
|
+
# Completeness check
|
|
282
|
+
kspec validate --completeness
|
|
283
|
+
|
|
284
|
+
# Spec-task alignment
|
|
285
|
+
kspec validate --alignment
|
|
286
|
+
|
|
287
|
+
# Strict mode (warnings → errors)
|
|
288
|
+
kspec validate --strict
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
**Exit codes:** `0` = success, `4` = errors, `6` = warnings only.
|
|
292
|
+
|
|
293
|
+
Validation catches:
|
|
294
|
+
- Missing acceptance criteria
|
|
295
|
+
- Broken references (`@slug` pointing to nonexistent items)
|
|
296
|
+
- Missing descriptions
|
|
297
|
+
- Orphaned specs (no linked tasks)
|
|
298
|
+
- Uncovered trait ACs
|
|
299
|
+
|
|
300
|
+
## Command Reference
|
|
301
|
+
|
|
302
|
+
### Item Management
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
kspec item list [--type <type>] # List items
|
|
306
|
+
kspec item get <ref> # Get item details with ACs and traits
|
|
307
|
+
kspec item add --under <parent> --title "..." --type <type> [--slug <slug>]
|
|
308
|
+
kspec item set <ref> --title "..." # Update fields
|
|
309
|
+
kspec item set <ref> --description "..."
|
|
310
|
+
kspec item set <ref> --status <status> # implementation status
|
|
311
|
+
kspec item set <ref> --depends-on <ref>
|
|
312
|
+
kspec item set <ref> --relates-to <ref>
|
|
313
|
+
kspec item patch <ref> --data '{...}' # Complex updates
|
|
314
|
+
kspec item delete <ref> [--force]
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Acceptance Criteria
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
kspec item ac list <ref> # List ACs for item
|
|
321
|
+
kspec item ac add <ref> --given "..." --when "..." --then "..."
|
|
322
|
+
kspec item ac add <ref> --id <id> --given "..." --when "..." --then "..."
|
|
323
|
+
kspec item ac set <ref> <ac-id> --then "updated"
|
|
324
|
+
kspec item ac remove <ref> <ac-id> [--force]
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### Traits
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
kspec trait list # All traits with AC counts
|
|
331
|
+
kspec trait get <ref> # Trait details
|
|
332
|
+
kspec trait add "Name" --description "..." [--slug <slug>]
|
|
333
|
+
kspec item trait add <spec> <trait> [<trait2> ...]
|
|
334
|
+
kspec item trait remove <spec> <trait> [<trait2> ...]
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### Deriving Tasks
|
|
338
|
+
|
|
339
|
+
Once a spec is ready, derive a task to track implementation:
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
kspec derive @feature-slug # Create task linked to spec
|
|
343
|
+
kspec derive @feature-slug --priority 2
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
The derived task gets `spec_ref: @feature-slug` automatically.
|
|
347
|
+
|
|
348
|
+
## Integration
|
|
349
|
+
|
|
350
|
+
- **`/kspec:plan`** — Plans create specs via import or manual creation
|
|
351
|
+
- **`/kspec:task-work`** — Tasks reference specs; AC guides implementation
|
|
352
|
+
- **`/kspec:triage`** — Inbox items may reveal spec gaps
|
|
353
|
+
- **`/kspec:observations`** — Friction may indicate missing specs
|
|
354
|
+
- **`/kspec:review`** — Reviews check AC coverage
|
|
@@ -35,8 +35,8 @@ See `kspec help task` for transition commands and options.
|
|
|
35
35
|
### Creating Work
|
|
36
36
|
|
|
37
37
|
- **Clear scope?** → Create task directly
|
|
38
|
-
- **Unclear scope?** → `kspec inbox add "idea"` → triage later with `/triage`
|
|
39
|
-
- **Learning/friction?** → `kspec meta observe friction "..."` → review
|
|
38
|
+
- **Unclear scope?** → `kspec inbox add "idea"` → triage later with `/kspec:triage`
|
|
39
|
+
- **Learning/friction?** → `kspec meta observe friction "..."` → review during reflection
|
|
40
40
|
|
|
41
41
|
### Staying Aligned During Work
|
|
42
42
|
|
|
@@ -4,9 +4,9 @@ Before creating a PR, mark the task: `kspec task submit @ref` (transitions to `p
|
|
|
4
4
|
|
|
5
5
|
The full PR lifecycle has three steps — **all required, in order:**
|
|
6
6
|
|
|
7
|
-
1.
|
|
8
|
-
2.
|
|
9
|
-
3.
|
|
7
|
+
1. **Local review** — Quality gates: AC coverage, test quality, test isolation. Run this FIRST.
|
|
8
|
+
2. **Create PR** — Push branch and open pull request.
|
|
9
|
+
3. **Review and merge** — `kspec workflow start @pr-review-merge`.
|
|
10
10
|
|
|
11
11
|
**Quality gates (never skip without explicit approval):**
|
|
12
12
|
- All CI checks passing
|
|
@@ -25,3 +25,17 @@ def test_validates_input():
|
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
Every AC SHOULD have at least one test with this annotation.
|
|
28
|
+
|
|
29
|
+
### N/A Trait ACs
|
|
30
|
+
|
|
31
|
+
When a trait AC doesn't apply to a specific spec, annotate it as N/A with a reason:
|
|
32
|
+
|
|
33
|
+
```javascript
|
|
34
|
+
// AC: @trait-slug ac-N — N/A: reason why it doesn't apply
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
# AC: @trait-slug ac-N — N/A: reason why it doesn't apply
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Group N/A annotations together in a dedicated test or at the top of the test file. The `AC:` annotation marker with language-appropriate comment prefix is required — do not use prose comments or bullet lists. The annotation must be machine-parseable.
|