@kynetic-ai/spec 0.3.0 → 0.4.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/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 +50 -19
- 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 +18 -7
- package/dist/cli/commands/ralph.js.map +1 -1
- package/dist/cli/commands/session.d.ts.map +1 -1
- package/dist/cli/commands/session.js +6 -7
- 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 +41 -7
- 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 +35 -24
- 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/output.d.ts.map +1 -1
- package/dist/cli/output.js +4 -2
- 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/plan-document.d.ts +8 -0
- package/dist/parser/plan-document.d.ts.map +1 -1
- package/dist/parser/plan-document.js +1 -0
- package/dist/parser/plan-document.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/sessions/store.d.ts +8 -0
- package/dist/sessions/store.d.ts.map +1 -1
- package/dist/sessions/store.js +219 -37
- package/dist/sessions/store.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/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/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 +193 -0
- package/plugin/plugins/kspec/skills/task-work/SKILL.md +303 -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 +340 -0
- package/templates/agents-sections/03-task-lifecycle.md +2 -2
- package/templates/agents-sections/04-pr-workflow.md +3 -3
- 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 +186 -0
- package/templates/skills/task-work/SKILL.md +296 -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 +333 -0
|
@@ -0,0 +1,340 @@
|
|
|
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
|
+
## Core Principles
|
|
23
|
+
|
|
24
|
+
1. **Spec defines WHAT, not HOW** — Describe the desired behavior, not the implementation
|
|
25
|
+
2. **Every spec needs AC** — A spec without acceptance criteria is incomplete
|
|
26
|
+
3. **Given/When/Then is testable** — Each AC should map to at least one test
|
|
27
|
+
4. **Traits eliminate duplication** — Cross-cutting concerns belong in traits, not copied across specs
|
|
28
|
+
5. **Use CLI, not YAML** — All changes through `kspec` commands for auto-commit
|
|
29
|
+
|
|
30
|
+
## Spec Hierarchy
|
|
31
|
+
|
|
32
|
+
Specs live in modules and form a tree:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
module (organizational grouping)
|
|
36
|
+
├── feature (user-facing capability)
|
|
37
|
+
│ ├── requirement (specific testable behavior)
|
|
38
|
+
│ └── constraint (limitation or boundary)
|
|
39
|
+
├── feature
|
|
40
|
+
│ └── requirement
|
|
41
|
+
└── decision (architectural choice, ADR-style)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Choosing the Right Type
|
|
45
|
+
|
|
46
|
+
| Type | Use when | Example |
|
|
47
|
+
|------|----------|---------|
|
|
48
|
+
| `module` | Grouping related features | "CLI Commands", "Web UI", "Schema" |
|
|
49
|
+
| `feature` | User-facing capability | "JSON Export", "Inbox Triage", "Shadow Sync" |
|
|
50
|
+
| `requirement` | Specific testable behavior within a feature | "Export validates output format", "Triage records audit trail" |
|
|
51
|
+
| `constraint` | Non-functional limit or boundary | "Response time < 200ms", "Max 1000 items per module" |
|
|
52
|
+
| `decision` | Architectural choice with rationale | "Use YAML over JSON for spec files" |
|
|
53
|
+
| `trait` | Reusable AC bundle for cross-cutting behaviors | "JSON output mode", "Confirmation prompts" |
|
|
54
|
+
|
|
55
|
+
**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.
|
|
56
|
+
|
|
57
|
+
## Writing Acceptance Criteria
|
|
58
|
+
|
|
59
|
+
AC are the heart of a spec. They define what "done" means.
|
|
60
|
+
|
|
61
|
+
### Format
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
Given: precondition (state before the action)
|
|
65
|
+
When: action (what triggers the behavior)
|
|
66
|
+
Then: outcome (observable, verifiable result)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Good AC Patterns
|
|
70
|
+
|
|
71
|
+
**Specific and testable:**
|
|
72
|
+
```bash
|
|
73
|
+
kspec item ac add @json-export \
|
|
74
|
+
--given "user has 3 tasks in project" \
|
|
75
|
+
--when "user runs 'kspec tasks list --json'" \
|
|
76
|
+
--then "stdout contains valid JSON array with 3 task objects"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Covers error cases:**
|
|
80
|
+
```bash
|
|
81
|
+
kspec item ac add @json-export \
|
|
82
|
+
--given "project has no tasks" \
|
|
83
|
+
--when "user runs 'kspec tasks list --json'" \
|
|
84
|
+
--then "stdout contains empty JSON array []"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Boundary behavior:**
|
|
88
|
+
```bash
|
|
89
|
+
kspec item ac add @bulk-delete \
|
|
90
|
+
--given "user passes 50 refs (maximum supported)" \
|
|
91
|
+
--when "user runs bulk delete" \
|
|
92
|
+
--then "all 50 items deleted in single operation"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### AC Anti-patterns
|
|
96
|
+
|
|
97
|
+
| Anti-pattern | Problem | Better |
|
|
98
|
+
|-------------|---------|--------|
|
|
99
|
+
| "System works correctly" | Not testable | Describe specific observable outcome |
|
|
100
|
+
| "User is happy" | Subjective | Describe what they can do or see |
|
|
101
|
+
| "Fast performance" | Not measurable | "Response returns within 200ms" |
|
|
102
|
+
| "Handles errors" | Vague | Specific error scenario + expected behavior |
|
|
103
|
+
| Duplicating trait AC | Maintenance burden | Apply the trait instead |
|
|
104
|
+
|
|
105
|
+
### AC Naming Convention
|
|
106
|
+
|
|
107
|
+
AC IDs are auto-generated (`ac-1`, `ac-2`, ...) or can be explicit:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Auto-generated
|
|
111
|
+
kspec item ac add @feature --given "..." --when "..." --then "..."
|
|
112
|
+
|
|
113
|
+
# Explicit ID for clarity
|
|
114
|
+
kspec item ac add @feature --id ac-json-valid --given "..." --when "..." --then "..."
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### How Many ACs?
|
|
118
|
+
|
|
119
|
+
- **Minimum 1** — Every spec needs at least one
|
|
120
|
+
- **Typical: 2-5** — Happy path + key error cases
|
|
121
|
+
- **If 8+** — Consider splitting the spec into smaller requirements
|
|
122
|
+
- **Each AC = one behavior** — Don't combine multiple verifiable outcomes
|
|
123
|
+
|
|
124
|
+
## Working with Traits
|
|
125
|
+
|
|
126
|
+
Traits are reusable bundles of acceptance criteria. When a spec implements a trait, it inherits all the trait's ACs.
|
|
127
|
+
|
|
128
|
+
### When to Use Traits
|
|
129
|
+
|
|
130
|
+
Apply a trait when a spec needs a standard cross-cutting behavior:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Discover available traits
|
|
134
|
+
kspec trait list
|
|
135
|
+
|
|
136
|
+
# View trait details (shows ACs that will be inherited)
|
|
137
|
+
kspec trait get @trait-json-output
|
|
138
|
+
|
|
139
|
+
# Apply trait to spec
|
|
140
|
+
kspec item trait add @my-command @trait-json-output
|
|
141
|
+
|
|
142
|
+
# Apply multiple traits
|
|
143
|
+
kspec item trait add @my-command @trait-json-output @trait-dry-run
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Common Traits
|
|
147
|
+
|
|
148
|
+
| Trait | When to apply |
|
|
149
|
+
|-------|---------------|
|
|
150
|
+
| `@trait-json-output` | Command produces machine-readable output |
|
|
151
|
+
| `@trait-dry-run` | Command supports preview before execution |
|
|
152
|
+
| `@trait-confirmation-prompt` | Command is destructive |
|
|
153
|
+
| `@trait-filterable-list` | Command lists items with filter options |
|
|
154
|
+
| `@trait-shadow-commit` | Command modifies `.kspec/` data |
|
|
155
|
+
| `@trait-semantic-exit-codes` | Command exit code carries meaning |
|
|
156
|
+
| `@trait-error-guidance` | Command gives recovery suggestions on errors |
|
|
157
|
+
| `@trait-multi-ref-batch` | Command accepts multiple references |
|
|
158
|
+
| `@trait-priority-parameter` | Command accepts priority option |
|
|
159
|
+
|
|
160
|
+
### Creating New Traits
|
|
161
|
+
|
|
162
|
+
If 3+ specs need the same behavior, consider extracting a trait:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
# Create the trait
|
|
166
|
+
kspec trait add "Pagination Support" --description "Commands that paginate large result sets" --slug trait-pagination
|
|
167
|
+
|
|
168
|
+
# Add ACs to the trait
|
|
169
|
+
kspec item ac add @trait-pagination --given "result set > page size" --when "command runs" --then "first page shown with pagination indicator"
|
|
170
|
+
kspec item ac add @trait-pagination --given "user requests next page" --when "user passes --page 2" --then "second page of results shown"
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Trait AC Coverage
|
|
174
|
+
|
|
175
|
+
When implementing specs with traits, all inherited ACs must be covered by tests:
|
|
176
|
+
|
|
177
|
+
```javascript
|
|
178
|
+
// AC: @trait-json-output ac-1
|
|
179
|
+
it('should output valid JSON with --json flag', () => { ... });
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Run `kspec validate` to check for uncovered trait ACs.
|
|
183
|
+
|
|
184
|
+
## Creating Specs
|
|
185
|
+
|
|
186
|
+
### New Feature Under a Module
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
# 1. Find the right parent module
|
|
190
|
+
kspec item list --type module
|
|
191
|
+
|
|
192
|
+
# 2. Create the feature
|
|
193
|
+
kspec item add --under @cli-module --title "Bulk Operations" --type feature --slug bulk-ops
|
|
194
|
+
|
|
195
|
+
# 3. Add description
|
|
196
|
+
kspec item set @bulk-ops --description "Support batch operations on multiple items in a single command"
|
|
197
|
+
|
|
198
|
+
# 4. Add acceptance criteria
|
|
199
|
+
kspec item ac add @bulk-ops \
|
|
200
|
+
--given "user provides 3 item refs" \
|
|
201
|
+
--when "user runs bulk delete" \
|
|
202
|
+
--then "all 3 items deleted and confirmation shown"
|
|
203
|
+
|
|
204
|
+
kspec item ac add @bulk-ops \
|
|
205
|
+
--given "one of 3 refs is invalid" \
|
|
206
|
+
--when "user runs bulk delete" \
|
|
207
|
+
--then "error reported for invalid ref, valid refs still processed"
|
|
208
|
+
|
|
209
|
+
# 5. Apply relevant traits
|
|
210
|
+
kspec item trait add @bulk-ops @trait-confirmation-prompt @trait-dry-run
|
|
211
|
+
|
|
212
|
+
# 6. Validate
|
|
213
|
+
kspec validate
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Requirement Under a Feature
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
kspec item add --under @bulk-ops --title "Ref validation in batch mode" --type requirement --slug bulk-ref-validation
|
|
220
|
+
kspec item ac add @bulk-ref-validation \
|
|
221
|
+
--given "batch contains mix of valid and invalid refs" \
|
|
222
|
+
--when "batch executes" \
|
|
223
|
+
--then "report lists each ref with success/failure status"
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Updating Existing Specs
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
# View current state
|
|
230
|
+
kspec item get @feature-slug
|
|
231
|
+
|
|
232
|
+
# Update description
|
|
233
|
+
kspec item set @feature-slug --description "Updated description"
|
|
234
|
+
|
|
235
|
+
# Add missing AC
|
|
236
|
+
kspec item ac add @feature-slug --given "..." --when "..." --then "..."
|
|
237
|
+
|
|
238
|
+
# Update existing AC
|
|
239
|
+
kspec item ac set @feature-slug ac-2 --then "updated expected outcome"
|
|
240
|
+
|
|
241
|
+
# Mark implementation status
|
|
242
|
+
kspec item set @feature-slug --status implemented
|
|
243
|
+
|
|
244
|
+
# Add relationships
|
|
245
|
+
kspec item set @feature-slug --depends-on @other-feature
|
|
246
|
+
kspec item set @feature-slug --relates-to @related-item
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
## Spec Quality Checklist
|
|
250
|
+
|
|
251
|
+
Before deriving a task from a spec, verify:
|
|
252
|
+
|
|
253
|
+
- [ ] **Description** — Explains what and why (not how)
|
|
254
|
+
- [ ] **AC coverage** — At least happy path + primary error case
|
|
255
|
+
- [ ] **AC testability** — Each AC maps to a concrete test
|
|
256
|
+
- [ ] **Traits applied** — Cross-cutting behaviors use traits, not duplicated AC
|
|
257
|
+
- [ ] **Correct parent** — Placed under the right module/feature
|
|
258
|
+
- [ ] **No implementation details** — AC describes behavior, not code structure
|
|
259
|
+
- [ ] **Validation passes** — `kspec validate` reports no errors for this item
|
|
260
|
+
|
|
261
|
+
## Validation
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
# Full validation
|
|
265
|
+
kspec validate
|
|
266
|
+
|
|
267
|
+
# Completeness check
|
|
268
|
+
kspec validate --completeness
|
|
269
|
+
|
|
270
|
+
# Spec-task alignment
|
|
271
|
+
kspec validate --alignment
|
|
272
|
+
|
|
273
|
+
# Strict mode (warnings → errors)
|
|
274
|
+
kspec validate --strict
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
**Exit codes:** `0` = success, `4` = errors, `6` = warnings only.
|
|
278
|
+
|
|
279
|
+
Validation catches:
|
|
280
|
+
- Missing acceptance criteria
|
|
281
|
+
- Broken references (`@slug` pointing to nonexistent items)
|
|
282
|
+
- Missing descriptions
|
|
283
|
+
- Orphaned specs (no linked tasks)
|
|
284
|
+
- Uncovered trait ACs
|
|
285
|
+
|
|
286
|
+
## Command Reference
|
|
287
|
+
|
|
288
|
+
### Item Management
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
kspec item list [--type <type>] # List items
|
|
292
|
+
kspec item get <ref> # Get item details with ACs and traits
|
|
293
|
+
kspec item add --under <parent> --title "..." --type <type> [--slug <slug>]
|
|
294
|
+
kspec item set <ref> --title "..." # Update fields
|
|
295
|
+
kspec item set <ref> --description "..."
|
|
296
|
+
kspec item set <ref> --status <status> # implementation status
|
|
297
|
+
kspec item set <ref> --depends-on <ref>
|
|
298
|
+
kspec item set <ref> --relates-to <ref>
|
|
299
|
+
kspec item patch <ref> --data '{...}' # Complex updates
|
|
300
|
+
kspec item delete <ref> [--force]
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### Acceptance Criteria
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
kspec item ac list <ref> # List ACs for item
|
|
307
|
+
kspec item ac add <ref> --given "..." --when "..." --then "..."
|
|
308
|
+
kspec item ac add <ref> --id <id> --given "..." --when "..." --then "..."
|
|
309
|
+
kspec item ac set <ref> <ac-id> --then "updated"
|
|
310
|
+
kspec item ac remove <ref> <ac-id> [--force]
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Traits
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
kspec trait list # All traits with AC counts
|
|
317
|
+
kspec trait get <ref> # Trait details
|
|
318
|
+
kspec trait add "Name" --description "..." [--slug <slug>]
|
|
319
|
+
kspec item trait add <spec> <trait> [<trait2> ...]
|
|
320
|
+
kspec item trait remove <spec> <trait> [<trait2> ...]
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### Deriving Tasks
|
|
324
|
+
|
|
325
|
+
Once a spec is ready, derive a task to track implementation:
|
|
326
|
+
|
|
327
|
+
```bash
|
|
328
|
+
kspec derive @feature-slug # Create task linked to spec
|
|
329
|
+
kspec derive @feature-slug --priority 2
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
The derived task gets `spec_ref: @feature-slug` automatically.
|
|
333
|
+
|
|
334
|
+
## Integration
|
|
335
|
+
|
|
336
|
+
- **`/kspec:plan`** — Plans create specs via import or manual creation
|
|
337
|
+
- **`/kspec:task-work`** — Tasks reference specs; AC guides implementation
|
|
338
|
+
- **`/kspec:triage`** — Inbox items may reveal spec gaps
|
|
339
|
+
- **`/kspec:observations`** — Friction may indicate missing specs
|
|
340
|
+
- **`/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
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# Create Workflow
|
|
2
|
+
|
|
3
|
+
Formalize repeatable patterns into trackable kspec workflows. A meta-workflow for building new workflows with consistent structure.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- Formalizing a repeated process into a trackable workflow
|
|
8
|
+
- Converting step-by-step documentation into executable steps
|
|
9
|
+
- Adding quality gates that are easy to skip without structure
|
|
10
|
+
|
|
11
|
+
**Not for:** Running existing workflows (use `kspec workflow start @id`), one-off processes, or tasks that don't repeat.
|
|
12
|
+
|
|
13
|
+
## Identifying Good Candidates
|
|
14
|
+
|
|
15
|
+
Look for processes that are:
|
|
16
|
+
|
|
17
|
+
| Signal | Example |
|
|
18
|
+
|--------|---------|
|
|
19
|
+
| Step-by-step instructions in docs | "To release: bump version, tag, push, create release" |
|
|
20
|
+
| Checklists that get skipped | "Before merge: check CI, resolve threads, verify AC" |
|
|
21
|
+
| Repeated command sequences | "Start daemon, run tests, check output, stop daemon" |
|
|
22
|
+
| Quality gates with multiple criteria | "Review: AC coverage, test quality, code style, regressions" |
|
|
23
|
+
|
|
24
|
+
Good sources: AGENTS.md, existing skills, task notes, session reflections.
|
|
25
|
+
|
|
26
|
+
## Workflow Structure
|
|
27
|
+
|
|
28
|
+
Every workflow has:
|
|
29
|
+
|
|
30
|
+
```yaml
|
|
31
|
+
id: kebab-case-name
|
|
32
|
+
description: What this workflow does
|
|
33
|
+
trigger: when-it-starts
|
|
34
|
+
mode: interactive # or loop
|
|
35
|
+
steps:
|
|
36
|
+
- id: step-1
|
|
37
|
+
type: action # action, check, or decision
|
|
38
|
+
content: What to do in this step
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Triggers
|
|
42
|
+
|
|
43
|
+
| Trigger | When |
|
|
44
|
+
|---------|------|
|
|
45
|
+
| `manual` | Invoked explicitly |
|
|
46
|
+
| `session-start` | Beginning of work session |
|
|
47
|
+
| `session-end` | End of work session |
|
|
48
|
+
| `task-complete` | After completing a task |
|
|
49
|
+
| `behavior-change` | Before implementing changes |
|
|
50
|
+
| `pre-release` | Before creating a release |
|
|
51
|
+
| `pr-merge` | Before merging a PR |
|
|
52
|
+
|
|
53
|
+
### Step Types
|
|
54
|
+
|
|
55
|
+
| Type | Purpose | Example |
|
|
56
|
+
|------|---------|---------|
|
|
57
|
+
| `action` | Do something | "Run tests and verify all pass" |
|
|
58
|
+
| `check` | Verify a condition | "All CI checks passing?" |
|
|
59
|
+
| `decision` | Choose a path | "Import or manual path?" |
|
|
60
|
+
|
|
61
|
+
### Modes
|
|
62
|
+
|
|
63
|
+
- **interactive** — Pauses for user input at each step
|
|
64
|
+
- **loop** — Auto-resolves decisions, no user prompts (for automated agents)
|
|
65
|
+
|
|
66
|
+
Loop mode workflows typically have a `based_on` field referencing the interactive version.
|
|
67
|
+
|
|
68
|
+
## Creating a Workflow
|
|
69
|
+
|
|
70
|
+
### Step 1: Design the Steps
|
|
71
|
+
|
|
72
|
+
Before creating, outline your steps on paper:
|
|
73
|
+
|
|
74
|
+
1. What's the trigger?
|
|
75
|
+
2. What steps are needed?
|
|
76
|
+
3. Which are actions vs checks vs decisions?
|
|
77
|
+
4. What inputs does each step need?
|
|
78
|
+
5. What's the exit criteria?
|
|
79
|
+
|
|
80
|
+
### Step 2: Create the Workflow
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
kspec meta add workflow \
|
|
84
|
+
--id my-workflow \
|
|
85
|
+
--trigger manual \
|
|
86
|
+
--description "Description of what this workflow does" \
|
|
87
|
+
--tag category \
|
|
88
|
+
--steps '[
|
|
89
|
+
{"id":"step-1","type":"action","content":"First action to take"},
|
|
90
|
+
{"id":"step-2","type":"check","content":"Verify the condition"},
|
|
91
|
+
{"id":"step-3","type":"decision","content":"Choose path A or B"}
|
|
92
|
+
]'
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Step 3: Test the Workflow
|
|
96
|
+
|
|
97
|
+
Run through it end-to-end:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
kspec workflow start @my-workflow
|
|
101
|
+
kspec workflow next --notes "Testing step 1"
|
|
102
|
+
kspec workflow next --input decision="path-a" --notes "Chose A because..."
|
|
103
|
+
# Continue through all steps
|
|
104
|
+
kspec workflow show # Verify inputs and notes captured
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Step 4: Consider a Matching Skill
|
|
108
|
+
|
|
109
|
+
A workflow may benefit from a matching skill when:
|
|
110
|
+
|
|
111
|
+
| Create a skill when | Skip the skill when |
|
|
112
|
+
|---------------------|---------------------|
|
|
113
|
+
| Steps need detailed context | Workflow is self-contained |
|
|
114
|
+
| Multiple sub-documents help | Context exists elsewhere |
|
|
115
|
+
| Users need a `/command` entrypoint | Workflow is internal/automated |
|
|
116
|
+
| Complex decision logic | Simple sequential steps |
|
|
117
|
+
|
|
118
|
+
If creating a skill, write it to `templates/skills/<name>/SKILL.md` and add a manifest entry.
|
|
119
|
+
|
|
120
|
+
### Step 5: Commit
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Workflow definition auto-committed to shadow branch by kspec
|
|
124
|
+
# Skill files (if created) need manual commit to main branch
|
|
125
|
+
git add templates/skills/<name>/SKILL.md
|
|
126
|
+
git commit -m "feat: add <name> skill for workflow integration"
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Step Design Guidelines
|
|
130
|
+
|
|
131
|
+
### Action Steps
|
|
132
|
+
|
|
133
|
+
Clear, specific instructions:
|
|
134
|
+
|
|
135
|
+
```yaml
|
|
136
|
+
- id: run-tests
|
|
137
|
+
type: action
|
|
138
|
+
content: |
|
|
139
|
+
Run the full test suite. Fix any failures before proceeding.
|
|
140
|
+
Verify both unit and integration tests pass.
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Check Steps
|
|
144
|
+
|
|
145
|
+
Binary yes/no verification:
|
|
146
|
+
|
|
147
|
+
```yaml
|
|
148
|
+
- id: ci-passing
|
|
149
|
+
type: check
|
|
150
|
+
content: |
|
|
151
|
+
Verify all CI checks are passing on the current HEAD.
|
|
152
|
+
If not, wait for CI or fix failures.
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Decision Steps
|
|
156
|
+
|
|
157
|
+
Clear options with guidance:
|
|
158
|
+
|
|
159
|
+
```yaml
|
|
160
|
+
- id: choose-path
|
|
161
|
+
type: decision
|
|
162
|
+
content: |
|
|
163
|
+
Choose execution path:
|
|
164
|
+
- Import: 3+ specs, structured document, batch creation
|
|
165
|
+
- Manual: 1-2 specs, incremental, quick additions
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Tips
|
|
169
|
+
|
|
170
|
+
- Keep steps atomic — one action per step
|
|
171
|
+
- Include the "why" when it's not obvious
|
|
172
|
+
- Decision steps should list all options
|
|
173
|
+
- Check steps should describe what to do on failure
|
|
174
|
+
- Use `content` for detailed multi-line instructions
|
|
175
|
+
|
|
176
|
+
## Loop Mode Variants
|
|
177
|
+
|
|
178
|
+
For automated agents, create a loop variant:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
kspec meta add workflow \
|
|
182
|
+
--id my-workflow-loop \
|
|
183
|
+
--trigger manual \
|
|
184
|
+
--mode loop \
|
|
185
|
+
--based-on @my-workflow \
|
|
186
|
+
--description "Automated variant of my-workflow" \
|
|
187
|
+
--steps '[...]'
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Loop variants typically:
|
|
191
|
+
- Auto-resolve decisions (pick the most common path)
|
|
192
|
+
- Skip user confirmation steps
|
|
193
|
+
- Add higher confidence thresholds
|
|
194
|
+
- Include automated exit conditions
|
|
195
|
+
|
|
196
|
+
## Workflow Lifecycle
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# Create
|
|
200
|
+
kspec meta add workflow --id ... --steps '[...]'
|
|
201
|
+
|
|
202
|
+
# Run
|
|
203
|
+
kspec workflow start @id
|
|
204
|
+
kspec workflow next --notes "..."
|
|
205
|
+
kspec workflow next --input key=value
|
|
206
|
+
|
|
207
|
+
# Manage
|
|
208
|
+
kspec workflow show # Check progress
|
|
209
|
+
kspec workflow pause # Pause for later
|
|
210
|
+
kspec workflow resume # Resume paused run
|
|
211
|
+
|
|
212
|
+
# Update (edit the meta YAML)
|
|
213
|
+
kspec meta set workflow @id --steps '[...]'
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Regenerate Agent Instructions
|
|
217
|
+
|
|
218
|
+
After creating a workflow, regenerate agent instructions so the workflow appears in the available workflows list:
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
kspec agents generate
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Integration
|
|
225
|
+
|
|
226
|
+
- **`/kspec:reflect`** — Session reflections surface patterns worth formalizing
|
|
227
|
+
- **`/kspec:observations`** — Friction observations may reveal missing workflows
|
|
228
|
+
- **`kspec agents generate`** — Regenerate after creating workflows
|
|
@@ -8,8 +8,53 @@ skills:
|
|
|
8
8
|
description: Get help with kspec commands and workflows
|
|
9
9
|
platforms:
|
|
10
10
|
- claude-code
|
|
11
|
+
- id: observations
|
|
12
|
+
name: Observations
|
|
13
|
+
description: Capture and act on systemic patterns — friction, successes, questions, and ideas. The feedback loop that drives process improvement.
|
|
14
|
+
platforms:
|
|
15
|
+
- claude-code
|
|
16
|
+
- id: reflect
|
|
17
|
+
name: Session Reflection
|
|
18
|
+
description: Structured reflection at the end of work sessions. Identifies learnings, friction points, and improvements for system evolution.
|
|
19
|
+
platforms:
|
|
20
|
+
- claude-code
|
|
11
21
|
- id: triage
|
|
12
22
|
name: Triage
|
|
13
23
|
description: Triage inbox items systematically. Records decisions with audit trail, then executes actions. Supports inbox, observations, and automation eligibility triage.
|
|
14
24
|
platforms:
|
|
15
25
|
- claude-code
|
|
26
|
+
- id: triage-inbox
|
|
27
|
+
name: Inbox Triage
|
|
28
|
+
description: Process inbox items using the record-act pattern. Categorize, promote to spec/task, merge duplicates, defer, or delete stale items with full audit trail.
|
|
29
|
+
platforms:
|
|
30
|
+
- claude-code
|
|
31
|
+
- id: triage-automation
|
|
32
|
+
name: Automation Triage
|
|
33
|
+
description: Assess and prepare tasks for automation eligibility. Verify spec coverage, acceptance criteria, and task readiness for automated agents.
|
|
34
|
+
platforms:
|
|
35
|
+
- claude-code
|
|
36
|
+
- id: writing-specs
|
|
37
|
+
name: Writing Specs
|
|
38
|
+
description: Create and maintain specification items — modules, features, requirements, acceptance criteria, and traits. The source of truth for what to build.
|
|
39
|
+
platforms:
|
|
40
|
+
- claude-code
|
|
41
|
+
- id: plan
|
|
42
|
+
name: Plan to Spec
|
|
43
|
+
description: Translate approved plans into specs and tasks. Import structured documents or create incrementally. Plans persist as durable artifacts with audit trail.
|
|
44
|
+
platforms:
|
|
45
|
+
- claude-code
|
|
46
|
+
- id: task-work
|
|
47
|
+
name: Task Work
|
|
48
|
+
description: Structured task lifecycle — start, work, note, submit, complete. Fix cycle handling, scope management, loop mode for automation, and quality gates.
|
|
49
|
+
platforms:
|
|
50
|
+
- claude-code
|
|
51
|
+
- id: create-workflow
|
|
52
|
+
name: Create Workflow
|
|
53
|
+
description: Formalize repeatable patterns into trackable kspec workflows. Design steps, choose triggers, create loop variants, and integrate with skills.
|
|
54
|
+
platforms:
|
|
55
|
+
- claude-code
|
|
56
|
+
- id: review
|
|
57
|
+
name: Review
|
|
58
|
+
description: Kspec-specific review gates — spec alignment, own AC coverage, trait AC coverage, and validation integration. Building block for project-specific review workflows.
|
|
59
|
+
platforms:
|
|
60
|
+
- claude-code
|