opencode-skills-collection 4.0.42 → 4.0.43
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/bundled-skills/.antigravity-install-manifest.json +3 -1
- package/bundled-skills/docs/integrations/jetski-cortex.md +3 -3
- package/bundled-skills/docs/integrations/jetski-gemini-loader/README.md +1 -1
- package/bundled-skills/docs/maintainers/repo-growth-seo.md +1 -1
- package/bundled-skills/docs/maintainers/skills-update-guide.md +1 -1
- package/bundled-skills/docs/users/aas-core.md +1 -1
- package/bundled-skills/docs/users/bundles.md +1 -1
- package/bundled-skills/docs/users/claude-code-skills.md +1 -1
- package/bundled-skills/docs/users/gemini-cli-skills.md +1 -1
- package/bundled-skills/docs/users/kiro-integration.md +1 -1
- package/bundled-skills/docs/users/usage.md +3 -3
- package/bundled-skills/docs/users/visual-guide.md +4 -4
- package/bundled-skills/lore/SKILL.md +104 -298
- package/bundled-skills/lore/references/audit-template.md +21 -4
- package/bundled-skills/lore/references/compatibility.md +51 -121
- package/bundled-skills/lore/references/config.md +22 -23
- package/bundled-skills/lore/references/entry-format.md +33 -3
- package/bundled-skills/lore/references/history-command.md +98 -2
- package/bundled-skills/lore/references/platform-mirrors.md +45 -16
- package/bundled-skills/lore/references/stale-new-markers.md +10 -8
- package/bundled-skills/lore/references/summary-template.md +8 -1
- package/bundled-skills/lore/references/workflows.md +192 -0
- package/bundled-skills/lore/scripts/README.md +14 -13
- package/bundled-skills/lore/scripts/README.zh-CN.md +14 -13
- package/bundled-skills/lore/scripts/find_duplicates.py +14 -4
- package/bundled-skills/lore/scripts/find_stale.py +68 -16
- package/bundled-skills/lore/scripts/history.py +235 -23
- package/bundled-skills/lore/scripts/id_hash.py +7 -4
- package/bundled-skills/lore/scripts/list_entries.py +82 -13
- package/bundled-skills/poka-yoke/SKILL.md +172 -0
- package/bundled-skills/project-state-governor/SKILL.md +1 -1
- package/bundled-skills/project-state-governor/references/project-state-schema.md +1 -1
- package/bundled-skills/spec-driven-loop/SKILL.md +203 -0
- package/bundled-skills/spec-driven-loop/references/agent-and-judge-contracts.md +120 -0
- package/bundled-skills/spec-driven-loop/references/document-templates.md +184 -0
- package/package.json +1 -1
- package/skills_index.json +67 -1
- package/bundled-skills/lore/README.md +0 -386
- package/bundled-skills/lore/README.zh-CN.md +0 -386
- package/bundled-skills/lore/WORKFLOWS.md +0 -216
- package/bundled-skills/lore/WORKFLOWS.zh-CN.md +0 -216
|
@@ -19,13 +19,15 @@ entry with these fields:
|
|
|
19
19
|
text entry body, with tags stripped
|
|
20
20
|
tags dict of tag name -> value, e.g. {"added": "2026-07-09", "verified": "2026-07-15"}
|
|
21
21
|
last_verified value of #verified tag, or None
|
|
22
|
+
replaced_by value of #superseded-by tag (replacement entry ID), or None
|
|
22
23
|
|
|
23
24
|
Used by:
|
|
24
|
-
- query / audit / compress workflows (pre-step enumeration)
|
|
25
|
+
- query / audit / compress / history workflows (pre-step enumeration)
|
|
25
26
|
- find_duplicates.py
|
|
26
27
|
- find_stale.py
|
|
27
28
|
"""
|
|
28
29
|
import json
|
|
30
|
+
import os
|
|
29
31
|
import re
|
|
30
32
|
import sys
|
|
31
33
|
from pathlib import Path
|
|
@@ -91,10 +93,40 @@ def parse_entry(line: str):
|
|
|
91
93
|
layer, date, h, rest = m.group(1), m.group(2), m.group(3), m.group(4)
|
|
92
94
|
eid = f"{layer}-{date}-{h}"
|
|
93
95
|
|
|
94
|
-
# Extract #tag:value pairs
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
# Extract #tag:value pairs.
|
|
97
|
+
# #superseded-by:<id> is special: its value is an entry ID, not a date,
|
|
98
|
+
# so we keep it on a separate `replaced_by` field rather than in `tags`.
|
|
99
|
+
ENTRY_ID = r"[A-Z]+-\d{4}-\d{2}-\d{2}-[a-f0-9]{4}"
|
|
100
|
+
tag_re = re.compile(
|
|
101
|
+
r"#(added|verified|stale):(\S+)"
|
|
102
|
+
r"|#superseded-by:(" + ENTRY_ID + r")"
|
|
103
|
+
)
|
|
104
|
+
tags = {}
|
|
105
|
+
replaced_by = None
|
|
106
|
+
for m in tag_re.finditer(rest):
|
|
107
|
+
if m.group(1):
|
|
108
|
+
tags[m.group(1)] = m.group(2)
|
|
109
|
+
elif m.group(3):
|
|
110
|
+
if replaced_by is None:
|
|
111
|
+
replaced_by = m.group(3)
|
|
112
|
+
else:
|
|
113
|
+
print(
|
|
114
|
+
f"[WARN] entry {eid} carries multiple #superseded-by "
|
|
115
|
+
"tags; keeping the first only.",
|
|
116
|
+
file=sys.stderr,
|
|
117
|
+
)
|
|
97
118
|
text = tag_re.sub("", rest).strip()
|
|
119
|
+
# Any #superseded-by still present after the valid-tag strip is
|
|
120
|
+
# malformed (value is not LAYER-YYYY-MM-DD-xxxx). Warn instead of
|
|
121
|
+
# dropping it silently: the entry stays intact in the file, but the
|
|
122
|
+
# chain cannot be resolved and replaced_by stays None.
|
|
123
|
+
for m in re.finditer(r"#superseded-by:(\S+)", text):
|
|
124
|
+
print(
|
|
125
|
+
f"[WARN] entry {eid} has a malformed #superseded-by value "
|
|
126
|
+
f"'{m.group(1)}' (expected LAYER-YYYY-MM-DD-xxxx); chain not "
|
|
127
|
+
"resolved.",
|
|
128
|
+
file=sys.stderr,
|
|
129
|
+
)
|
|
98
130
|
|
|
99
131
|
return {
|
|
100
132
|
"id": eid,
|
|
@@ -105,6 +137,7 @@ def parse_entry(line: str):
|
|
|
105
137
|
"text": text,
|
|
106
138
|
"tags": tags,
|
|
107
139
|
"last_verified": tags.get("verified"),
|
|
140
|
+
"replaced_by": replaced_by,
|
|
108
141
|
}
|
|
109
142
|
|
|
110
143
|
|
|
@@ -123,14 +156,43 @@ def collect_entries(root: Path):
|
|
|
123
156
|
layer_file = md_file.stem
|
|
124
157
|
try:
|
|
125
158
|
with open(md_file, encoding="utf-8") as f:
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
159
|
+
lines = f.readlines()
|
|
160
|
+
if lines:
|
|
161
|
+
# Strip a UTF-8 BOM (Windows editors / PowerShell
|
|
162
|
+
# Set-Content add one); otherwise the first entry of
|
|
163
|
+
# the file would fail to parse and be silently skipped.
|
|
164
|
+
lines[0] = lines[0].lstrip("\ufeff")
|
|
165
|
+
i = 0
|
|
166
|
+
while i < len(lines):
|
|
167
|
+
# Join wrapped continuation lines into one logical
|
|
168
|
+
# bullet before parsing. A continuation is a non-blank
|
|
169
|
+
# line starting with 2+ spaces (or a tab) that is not
|
|
170
|
+
# itself a new entry bullet. This matches the documented
|
|
171
|
+
# "2 lines or fewer" bullet format without silently
|
|
172
|
+
# truncating the entry text.
|
|
173
|
+
joined = lines[i].rstrip("\n")
|
|
174
|
+
j = i + 1
|
|
175
|
+
while j < len(lines):
|
|
176
|
+
nxt = lines[j].rstrip("\n")
|
|
177
|
+
if nxt.strip() == "":
|
|
178
|
+
break
|
|
179
|
+
if not re.match(r"^\s{2,}", nxt):
|
|
180
|
+
break
|
|
181
|
+
if re.match(r"^\s*-\s*\[", nxt):
|
|
182
|
+
break
|
|
183
|
+
joined += " " + nxt.strip()
|
|
184
|
+
j += 1
|
|
185
|
+
e = parse_entry(joined)
|
|
186
|
+
if e is None:
|
|
187
|
+
i += 1
|
|
188
|
+
continue
|
|
189
|
+
e["scope"] = scope
|
|
190
|
+
e["layer_file"] = layer_file
|
|
191
|
+
e["file"] = str(md_file.relative_to(root)).replace(
|
|
192
|
+
os.sep, "/"
|
|
193
|
+
)
|
|
194
|
+
entries.append(e)
|
|
195
|
+
i = j
|
|
134
196
|
except OSError as exc:
|
|
135
197
|
print(f"warning: cannot read {md_file}: {exc}", file=sys.stderr)
|
|
136
198
|
return entries
|
|
@@ -138,6 +200,10 @@ def collect_entries(root: Path):
|
|
|
138
200
|
|
|
139
201
|
def main():
|
|
140
202
|
args = sys.argv[1:]
|
|
203
|
+
try:
|
|
204
|
+
sys.stdout.reconfigure(encoding="utf-8")
|
|
205
|
+
except AttributeError: # Python < 3.7
|
|
206
|
+
pass
|
|
141
207
|
|
|
142
208
|
scope_filter = None
|
|
143
209
|
layer_filter = None
|
|
@@ -176,7 +242,10 @@ def main():
|
|
|
176
242
|
f" [verified:{e['last_verified']}]" if e["last_verified"] else ""
|
|
177
243
|
)
|
|
178
244
|
stale = " [STALE]" if "stale" in e["tags"] else ""
|
|
179
|
-
|
|
245
|
+
chain = (
|
|
246
|
+
f" -> {e['replaced_by']}" if e.get("replaced_by") else ""
|
|
247
|
+
)
|
|
248
|
+
print(f"[{e['file']}] {e['id']} {e['text']}{verified}{stale}{chain}")
|
|
180
249
|
|
|
181
250
|
|
|
182
251
|
if __name__ == "__main__":
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: poka-yoke
|
|
3
|
+
description: "Mistake-proof code, config and process: make the wrong action impossible or self-announcing rather than documented."
|
|
4
|
+
category: development
|
|
5
|
+
risk: safe
|
|
6
|
+
source: rainmanjam/poka-yoke
|
|
7
|
+
source_repo: rainmanjam/poka-yoke
|
|
8
|
+
source_type: community
|
|
9
|
+
date_added: "2026-08-25"
|
|
10
|
+
author: rainmanjam
|
|
11
|
+
tags: [mistake-proofing, code-review, api-design, guardrails, reliability]
|
|
12
|
+
tools: [claude, cursor, codex]
|
|
13
|
+
license: "MIT"
|
|
14
|
+
license_source: "https://github.com/rainmanjam/poka-yoke/blob/v0.1.2/LICENSE"
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Poka-Yoke: Mistake-Proofing for Software
|
|
18
|
+
|
|
19
|
+
Shigeo Shingo's insight, from the Toyota Production System: **people will always make
|
|
20
|
+
mistakes; that is not the problem worth solving. The problem is letting a mistake become a
|
|
21
|
+
defect.** So you stop trying to make humans more careful and start redesigning the work so
|
|
22
|
+
the mistake either cannot physically happen or announces itself immediately.
|
|
23
|
+
|
|
24
|
+
A poka-yoke ("poh-kah yoh-kay", ポカヨケ) is a *device*: a jig, a shape, a counter: not
|
|
25
|
+
an instruction. In software: a type, a constraint, a hook, a schema, a state machine. The
|
|
26
|
+
single most important consequence:
|
|
27
|
+
|
|
28
|
+
> **A comment, a docstring, a wiki page, a code review checklist, or a line in CLAUDE.md
|
|
29
|
+
> saying "don't do X" is not a poka-yoke.** It is training. Training degrades. A device
|
|
30
|
+
> does not. If your proposed fix relies on someone remembering something, keep going.
|
|
31
|
+
|
|
32
|
+
## When to Use This Skill
|
|
33
|
+
|
|
34
|
+
- Use when the user says "poka-yoke this", "mistake-proof it", or "make this harder to get wrong".
|
|
35
|
+
- Use when designing an interface, schema or state machine and the ask is "make invalid states unrepresentable" or "so callers cannot screw it up".
|
|
36
|
+
- Use when auditing existing code for footguns: "what could bite us here", "what is easy to misuse".
|
|
37
|
+
- Use after an incident, when the fix must close the class rather than the case: "make sure this never happens again", "this is the third time".
|
|
38
|
+
- Especially for money, auth, permissions, deletion, migrations and pipelines, where failure is silent.
|
|
39
|
+
|
|
40
|
+
## The two axes
|
|
41
|
+
|
|
42
|
+
Every real poka-yoke answers two questions. Use both when you classify a hazard or propose a
|
|
43
|
+
device. They are the difference between this method and generic code review.
|
|
44
|
+
|
|
45
|
+
### Axis 1, Regulatory function: what happens when the mistake occurs?
|
|
46
|
+
|
|
47
|
+
This is a strict preference ladder. Always reach for the highest rung you can afford.
|
|
48
|
+
|
|
49
|
+
| Rung | Name | What it does | Software examples |
|
|
50
|
+
|---|---|---|---|
|
|
51
|
+
| **1** | **Control** | The mistake is **impossible**. The work cannot proceed. | Type won't compile · `NOT NULL` / `CHECK` / unique constraint · required function argument · private constructor + smart constructor · PreToolUse hook returns deny · protected branch |
|
|
52
|
+
| **2** | **Warning** | The mistake is possible but **announced at the moment it happens**. | Lint error in the editor · failing CI gate · runtime assertion that throws · confirmation prompt naming the exact thing being destroyed |
|
|
53
|
+
| **3** | **Detection** | The mistake ships, and something **finds it afterward**. | Tests · monitoring · alerting · reconciliation job |
|
|
54
|
+
| **0** | *(not a poka-yoke)* | Relies on a human remembering. | Docs · comments · training · "be careful" · review checklists |
|
|
55
|
+
|
|
56
|
+
Shingo's rule: prefer **control** over **warning**, always, and only settle for warning when
|
|
57
|
+
control is genuinely too expensive, then say *why* out loud. In software the honest reason
|
|
58
|
+
is usually "the language can't express it" or "it would break every existing caller," and
|
|
59
|
+
both are worth stating explicitly so the tradeoff is visible.
|
|
60
|
+
|
|
61
|
+
### Axis 2, Setting function: how does the device notice?
|
|
62
|
+
|
|
63
|
+
Shingo's three detection methods map cleanly onto software. These are your **inspection
|
|
64
|
+
lenses**, run all three over any interface and you will find hazards that a general
|
|
65
|
+
code review misses.
|
|
66
|
+
|
|
67
|
+
| Method | Factory floor | The question to ask code | Software devices |
|
|
68
|
+
|---|---|---|---|
|
|
69
|
+
| **Contact** | The part physically won't seat unless it's the right shape and orientation | **Can the wrong thing fit?** | Distinct types instead of shared primitives · branded/newtype IDs · parse-don't-validate at boundaries · units in the type · discriminated unions instead of bags of optionals |
|
|
70
|
+
| **Fixed-value** | A counter says all 6 screws were fitted | **Can the wrong count or an incomplete set pass?** | Exhaustive `match`/`switch` over an enum · required fields · "all migrations applied" check · row-count guard on a bulk write · checksums · config validated as a whole at boot |
|
|
71
|
+
| **Motion-step** | A sensor confirms step 3 happened before step 4 | **Can the steps happen in the wrong order, or be skipped?** | Typestate · builder that cannot `.build()` until required steps run · state machines with illegal transitions unrepresentable · idempotency keys · RAII / `defer` / context managers · transactions |
|
|
72
|
+
|
|
73
|
+
### The third principle: inspect at the source
|
|
74
|
+
|
|
75
|
+
Shingo separated **source inspection** from **informative inspection**, which finds the defect
|
|
76
|
+
only after it exists and comes in two forms. Ranked best first, that is three places you can
|
|
77
|
+
put the device.
|
|
78
|
+
|
|
79
|
+
1. **Source inspection**: check the *conditions* before the error can occur. Designed in
|
|
80
|
+
where you can, enforced at runtime where you cannot.
|
|
81
|
+
The type, the constraint, the signature.
|
|
82
|
+
2. **Self-check** (informative): the work checks itself as it happens. Runtime. Assertions,
|
|
83
|
+
fail-fast, validation at the boundary.
|
|
84
|
+
3. **Successive check** (informative): the next station checks the previous one. Review, CI,
|
|
85
|
+
QA.
|
|
86
|
+
|
|
87
|
+
Push every device as far up this list as it will go. A CI gate that catches a bad migration
|
|
88
|
+
is good; a schema that makes the bad migration unwritable is better and costs less forever.
|
|
89
|
+
|
|
90
|
+
## How to use this skill
|
|
91
|
+
|
|
92
|
+
Apply the method directly to the subject in front of you. A Terraform module, a support
|
|
93
|
+
runbook, a spreadsheet everyone edits, a release checklist, a
|
|
94
|
+
prompt template, an onboarding process, a physical workflow: the method works on any of them,
|
|
95
|
+
because Shingo developed it on an assembly line, for people fitting springs into switches, and
|
|
96
|
+
not for software at all.
|
|
97
|
+
|
|
98
|
+
Applying it directly means four steps, in order:
|
|
99
|
+
|
|
100
|
+
1. **Name what is being done, and by whom.** A device protects a specific action taken by a
|
|
101
|
+
specific person or system. "The pipeline" is not an action; "an engineer re-runs the deploy
|
|
102
|
+
job after it fails halfway" is.
|
|
103
|
+
2. **Run the three lenses** over that action, can the wrong thing fit, can an incomplete or
|
|
104
|
+
wrong-sized set pass, can the steps happen in the wrong order. Most subjects yield
|
|
105
|
+
something on at least one.
|
|
106
|
+
3. **For each hazard found, state it as a mistake someone could make**, what happens when they
|
|
107
|
+
do, whether it is silent, and what exists today to stop it.
|
|
108
|
+
4. **Propose the highest-rung device you can afford**, and say which rung it reaches. If you
|
|
109
|
+
land on Warning, say what Control would have required and why you did not take it.
|
|
110
|
+
|
|
111
|
+
Then apply the two rules in *How to talk about this* below: name the mistake rather than the
|
|
112
|
+
mistaken, and never let the answer come out as "be more careful" or "document it". Those are
|
|
113
|
+
rung zero, and the whole method exists because they do not work.
|
|
114
|
+
|
|
115
|
+
**If the request is bare**, `/poka-yoke` with nothing attached, look at what is actually in
|
|
116
|
+
front of you: the current diff, the file under discussion, the thing the conversation has been
|
|
117
|
+
about. Say what you picked in one line before starting, so it is cheap to redirect you. If
|
|
118
|
+
there is genuinely no subject, ask what they want mistake-proofed rather than guessing.
|
|
119
|
+
|
|
120
|
+
## How to talk about this
|
|
121
|
+
|
|
122
|
+
Two habits keep the analysis honest and keep people from getting defensive:
|
|
123
|
+
|
|
124
|
+
**Name the mistake, not the mistaken.** "This signature lets a caller swap the two IDs" is
|
|
125
|
+
actionable and true. "The developer should have been more careful" is neither. Shingo was
|
|
126
|
+
emphatic that blaming the operator is how organizations avoid fixing the process. Write
|
|
127
|
+
findings about the code's affordances, never about who wrote it.
|
|
128
|
+
|
|
129
|
+
**Say which rung you achieved, and what stopped you going higher.** A recommendation that
|
|
130
|
+
reads "added a runtime assertion (warning), control would need a newtype, which touches 40
|
|
131
|
+
call sites" gives the reader a real decision. One that reads "added validation" does not.
|
|
132
|
+
|
|
133
|
+
## Example
|
|
134
|
+
|
|
135
|
+
Suppose a destructive API accepts `deleteAccount(accountId: string, tenantId: string)`.
|
|
136
|
+
The two identifiers can be swapped, and the call can target an account outside the caller's
|
|
137
|
+
tenant.
|
|
138
|
+
|
|
139
|
+
1. **Contact lens:** two plain strings have the same shape, so the wrong value fits.
|
|
140
|
+
2. **Motion-step lens:** deletion can run before tenant ownership is established.
|
|
141
|
+
3. **Control device:** replace the strings with distinct validated ID types and expose a
|
|
142
|
+
deletion operation that accepts only an account loaded through the authenticated tenant.
|
|
143
|
+
4. **Warning fallback:** if compatibility prevents that interface change, reject ownership
|
|
144
|
+
mismatches at the boundary and require a confirmation that names the exact account. State
|
|
145
|
+
explicitly that this is weaker than making the invalid call unrepresentable.
|
|
146
|
+
5. **Detection:** retain audit logging and reconciliation for failures the control does not
|
|
147
|
+
cover; do not present those after-the-fact checks as the poka-yoke itself.
|
|
148
|
+
|
|
149
|
+
## Applying changes
|
|
150
|
+
|
|
151
|
+
Propose before you edit. Show the hazard, the proposed device, and the rung it reaches, then
|
|
152
|
+
wait for a go-ahead before changing files: the whole point of this method is that it changes
|
|
153
|
+
the shape of an interface, and that is precisely the kind of change people want to see first.
|
|
154
|
+
Once approved, apply it and record the prevented mistake where future maintainers can verify
|
|
155
|
+
the constraint without mistaking the explanation itself for the device.
|
|
156
|
+
|
|
157
|
+
The exception is when someone has explicitly asked you to write new code: mistake-proofing
|
|
158
|
+
*is* the code they asked for, so build it, then narrate which hazards
|
|
159
|
+
you designed out and why.
|
|
160
|
+
|
|
161
|
+
## Limitations
|
|
162
|
+
|
|
163
|
+
- Poka-yoke reduces predictable misuse; it cannot prove that a design is correct or cover
|
|
164
|
+
hazards the analysis never identifies.
|
|
165
|
+
- The strongest control may be unavailable in the current language, platform or compatibility
|
|
166
|
+
envelope. When that happens, state the tradeoff and retain appropriate tests, monitoring and
|
|
167
|
+
recovery paths instead of presenting a warning as complete prevention.
|
|
168
|
+
- A guard can itself be wrong, overbroad or operationally expensive. Validate proposed devices
|
|
169
|
+
against real callers and failure modes, especially for destructive, financial, authentication
|
|
170
|
+
and authorization flows.
|
|
171
|
+
- This method complements, but does not replace, domain review, security review, testing,
|
|
172
|
+
observability or incident response.
|
|
@@ -31,7 +31,7 @@ detailed record no longer affects future work.
|
|
|
31
31
|
|
|
32
32
|
## Milestones
|
|
33
33
|
### [Milestone ID or name]
|
|
34
|
-
- Status: PROPOSED | ACTIVE | BLOCKED | PAUSED | DONE | DEFERRED
|
|
34
|
+
- Status: PROPOSED | ACTIVE | BLOCKED | PAUSED | DONE | CANCELLED | DEFERRED
|
|
35
35
|
- Goal: ...
|
|
36
36
|
- DoD: ...
|
|
37
37
|
- Parent: ...
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spec-driven-loop
|
|
3
|
+
description: Freeze PRD, technical design, and acceptance criteria before medium-to-large Codex work; coordinate agents with explicit ownership, then judge delivery from diffs, tests, and evidence.
|
|
4
|
+
category: development
|
|
5
|
+
risk: safe
|
|
6
|
+
source: self
|
|
7
|
+
source_repo: Linji-x/spec-driven-loop
|
|
8
|
+
source_type: self
|
|
9
|
+
license: MIT
|
|
10
|
+
license_source: https://github.com/Linji-x/spec-driven-loop/blob/v1.0.0/LICENSE
|
|
11
|
+
date_added: "2026-08-25"
|
|
12
|
+
author: Linji-x
|
|
13
|
+
tags:
|
|
14
|
+
- codex
|
|
15
|
+
- spec-driven-development
|
|
16
|
+
- multi-agent
|
|
17
|
+
- agent-orchestration
|
|
18
|
+
- acceptance-testing
|
|
19
|
+
tools:
|
|
20
|
+
- codex
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
# Spec-Driven Loop
|
|
24
|
+
|
|
25
|
+
Turn an uncertain software request into an approved specification, a controlled implementation, and evidence-backed acceptance. Keep project documents in the repository's established location; otherwise use `docs/spec-driven/<feature-slug>/`.
|
|
26
|
+
|
|
27
|
+
## When to Use
|
|
28
|
+
|
|
29
|
+
Use this skill for new products, medium-to-large features, cross-module changes, or requests that need PRD/technical design, active clarification, multi-agent execution, or a main-agent judge. Do not use it for a small single-file change, a tiny bug fix, code explanation, review-only or diagnostic work, pure research, or a simple task whose specification is already complete.
|
|
30
|
+
|
|
31
|
+
## Quick Example
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
$spec-driven-loop Build a multi-tenant job dashboard with role-based access and evidence-backed acceptance.
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Limitations
|
|
38
|
+
|
|
39
|
+
- Not intended for small isolated edits, review-only work, diagnosis, or pure research.
|
|
40
|
+
- Does not replace environment-specific testing or grant authorization for unrelated changes or external actions.
|
|
41
|
+
- Production implementation cannot start until the user explicitly approves the frozen specification and acceptance contract.
|
|
42
|
+
|
|
43
|
+
Follow repository instructions and authorization boundaries throughout. Match generated project documents to the user's language or the repository's existing documentation language; keep identifiers such as `FR-001` and `AC-001` stable.
|
|
44
|
+
|
|
45
|
+
## Operating Invariants
|
|
46
|
+
|
|
47
|
+
- Facts are the agent's responsibility. Decisions belong to the user.
|
|
48
|
+
- Investigate discoverable facts before asking questions. Ask only for real product decisions or consequential technical tradeoffs.
|
|
49
|
+
- Never write or modify production code until the user explicitly approves the specification, scope, and acceptance contract for implementation.
|
|
50
|
+
- Never disguise uncertainty. Mark it `TBD`, `ASSUMPTION`, or `BLOCKED`.
|
|
51
|
+
- A subagent's completion report is evidence, not acceptance. The main agent owns integration and the final judgment.
|
|
52
|
+
- Freeze shared interfaces, data structures, and public types before parallel work. Assign non-overlapping file ownership; serialize overlapping work.
|
|
53
|
+
- Update the durable documents after every decision or implementation loop. A chat transcript is not the source of truth.
|
|
54
|
+
- If implementation reveals a requirement change rather than a code defect, stop affected work, revise the specification, obtain renewed user approval, and then resume.
|
|
55
|
+
- Preserve the user's authorization scope. A specification approval authorizes the approved implementation, not unrelated changes or external actions.
|
|
56
|
+
|
|
57
|
+
The requirements-grilling stage is informed by Matt Pocock's MIT-licensed `grill-me` / `grilling` decision-tree and frontier method.
|
|
58
|
+
|
|
59
|
+
## Document Boundaries
|
|
60
|
+
|
|
61
|
+
Keep each fact in one authoritative document and reference its stable ID elsewhere:
|
|
62
|
+
|
|
63
|
+
- `PRD.md`: why and what the product must do; owns scope, user behavior, business rules, assumptions, and product decisions.
|
|
64
|
+
- `TECH_DESIGN.md`: how the approved product behavior will work; owns architecture, contracts, data, operations, security, and technical decisions.
|
|
65
|
+
- `ACCEPTANCE.md`: observable proof that frozen requirements are met; owns pass/fail criteria and required evidence.
|
|
66
|
+
- `AGENT_PLAN.md`: who performs approved implementation work; owns dependencies, file ownership, validation, and agent task contracts.
|
|
67
|
+
- `LOOP.md`: current recoverable execution state and append-only loop history; owns attempts, evidence, judgments, rework, risks, and next action.
|
|
68
|
+
|
|
69
|
+
Read [references/document-templates.md](references/document-templates.md) when creating or updating these five documents. Read [references/agent-and-judge-contracts.md](references/agent-and-judge-contracts.md) before assigning implementation tasks, integrating agent work, judging acceptance, or issuing rework.
|
|
70
|
+
|
|
71
|
+
## 1. Inspect the Current System
|
|
72
|
+
|
|
73
|
+
Before asking the user questions:
|
|
74
|
+
|
|
75
|
+
1. Read applicable `AGENTS.md`, project instructions, existing specifications, and repository conventions.
|
|
76
|
+
2. Inspect the relevant architecture, modules, interfaces, database, tests, deployment method, and code conventions.
|
|
77
|
+
3. Identify established domain terms and documentation locations.
|
|
78
|
+
4. Resolve facts from code, files, tools, and documentation. Record findings and sources in the draft rather than asking the user to rediscover them.
|
|
79
|
+
5. Separate product choices from technical choices and note decision dependencies.
|
|
80
|
+
|
|
81
|
+
If frozen, approved PRD, Tech Design, and Acceptance documents already exist, verify their status, consistency, and applicability. Resume from planning or the current `LOOP.md` instead of repeating resolved grilling. If approval is absent or the request changes frozen behavior, return to the appropriate specification stage.
|
|
82
|
+
|
|
83
|
+
## 2. Draft `PRD.md`
|
|
84
|
+
|
|
85
|
+
Create the best initial PRD from the request and inspected system. Include:
|
|
86
|
+
|
|
87
|
+
- problem and context;
|
|
88
|
+
- users and stakeholders;
|
|
89
|
+
- product goals and measurable success metrics;
|
|
90
|
+
- user flows;
|
|
91
|
+
- functional requirements with stable IDs (`FR-001`, `FR-002`, ...);
|
|
92
|
+
- business rules and data lifecycle;
|
|
93
|
+
- in scope, out of scope, and non-goals;
|
|
94
|
+
- assumptions;
|
|
95
|
+
- open product decisions;
|
|
96
|
+
- decision log.
|
|
97
|
+
|
|
98
|
+
Do not turn unknowns into requirements. Label each unresolved item `TBD`, `ASSUMPTION`, or `BLOCKED`, and show which FRs it affects.
|
|
99
|
+
|
|
100
|
+
## 3. Grill Product Decisions
|
|
101
|
+
|
|
102
|
+
Represent unresolved decisions as a dependency tree. The current **frontier** contains only high-impact questions whose upstream decisions are resolved.
|
|
103
|
+
|
|
104
|
+
For each round:
|
|
105
|
+
|
|
106
|
+
1. Select one to three independent frontier questions that the user can answer now.
|
|
107
|
+
2. For every question, state why it matters, concrete options, the impact of each option, a recommended option, and the reason for that recommendation.
|
|
108
|
+
3. Prefer a reversible explicit assumption for a low-risk issue that does not affect acceptance behavior.
|
|
109
|
+
4. After the answer, immediately update `PRD.md` and its decision log, then recompute the frontier.
|
|
110
|
+
5. Continue until no important unresolved branch remains. Do not dump a backlog of dependent questions or repeat resolved questions.
|
|
111
|
+
|
|
112
|
+
Never auto-assume core product behavior, data ownership, permission or security behavior, migrations, external compatibility, payments or money movement, destructive actions, explicit performance targets, or behavior that changes final acceptance. Keep these as blockers.
|
|
113
|
+
|
|
114
|
+
When the product frontier is clear, summarize confirmed decisions, accepted assumptions, non-goals, deferred items, and remaining risks. Ask the user to confirm that the PRD reflects the shared product understanding before treating it as frozen.
|
|
115
|
+
|
|
116
|
+
## 4. Draft and Grill `TECH_DESIGN.md`
|
|
117
|
+
|
|
118
|
+
After product behavior is understood, document:
|
|
119
|
+
|
|
120
|
+
- current system state and overall approach;
|
|
121
|
+
- module boundaries and responsibilities;
|
|
122
|
+
- interface contracts;
|
|
123
|
+
- data models and migrations;
|
|
124
|
+
- state transitions;
|
|
125
|
+
- concurrency, consistency, and idempotency;
|
|
126
|
+
- authentication, authorization, privacy, and security;
|
|
127
|
+
- failures, retries, recovery, and degradation;
|
|
128
|
+
- performance and capacity;
|
|
129
|
+
- logs, metrics, and alerts;
|
|
130
|
+
- compatibility;
|
|
131
|
+
- release and rollback;
|
|
132
|
+
- test boundaries;
|
|
133
|
+
- alternatives and technical decision log;
|
|
134
|
+
- technical issues blocked by product decisions.
|
|
135
|
+
|
|
136
|
+
Mark a design item `BLOCKED` when it depends on an unresolved product decision. Grill consequential technical choices with the same decision-tree/frontier method: one to three answerable questions per round, options and impacts, a recommendation with rationale, immediate document updates, and no hidden high-risk assumptions. Resolve ordinary implementation facts by inspecting the system.
|
|
137
|
+
|
|
138
|
+
## 5. Freeze `ACCEPTANCE.md` and Request Approval
|
|
139
|
+
|
|
140
|
+
After the PRD and Tech Design share a stable understanding, write the acceptance contract. Give each criterion a stable ID (`AC-001`, `AC-002`, ...), link it to one or more FRs, and specify:
|
|
141
|
+
|
|
142
|
+
- scenario and preconditions;
|
|
143
|
+
- action or event;
|
|
144
|
+
- observable expected result;
|
|
145
|
+
- required evidence;
|
|
146
|
+
- whether it is release-blocking.
|
|
147
|
+
|
|
148
|
+
Cover applicable happy paths, boundary and invalid inputs, permissions, failure and recovery, repeated requests and idempotency, concurrency, compatibility, performance and capacity, migration, rollback, regression, and existing quality gates. Distinguish In Scope, Out of Scope, Non-goals, Deferred, Assumptions, Release Blockers, and Definition of Done.
|
|
149
|
+
|
|
150
|
+
Do not accept subjective criteria such as "good experience", "good performance", "high code quality", or "mostly works". Every blocking AC needs observable evidence such as automated tests, API responses, database state, logs, metrics, screenshots, performance results, or a precise manual check.
|
|
151
|
+
|
|
152
|
+
Show the user a concise specification summary and ask: **The specification, scope, and acceptance conditions are defined. Do you approve implementation?** Record the answer. Do not write production code without explicit approval.
|
|
153
|
+
|
|
154
|
+
## 6. Create `AGENT_PLAN.md`
|
|
155
|
+
|
|
156
|
+
Only after implementation approval, split work into independently verifiable vertical slices rather than mechanically separating frontend, backend, and tests. For each task include:
|
|
157
|
+
|
|
158
|
+
- Task ID and objective;
|
|
159
|
+
- linked FR and AC IDs;
|
|
160
|
+
- inputs and dependencies;
|
|
161
|
+
- exact allowed files or directories;
|
|
162
|
+
- exact forbidden files or directories;
|
|
163
|
+
- required code, tests, or documentation;
|
|
164
|
+
- required checks and evidence;
|
|
165
|
+
- stop-and-report conditions.
|
|
166
|
+
|
|
167
|
+
Before parallel delegation, freeze shared interfaces, schemas, and public types. Confirm that writes do not overlap. Serialize any tasks with overlapping ownership or unresolved dependencies. Use multiple agents only when at least two tasks are truly independent and delegation is available and authorized; do not create agents merely to display parallelism.
|
|
168
|
+
|
|
169
|
+
The main agent maintains the specification, approves ownership changes, handles dependencies and conflicts, integrates results, runs system-level verification, and judges final acceptance. Subagents may not expand scope, change acceptance criteria, unilaterally change shared contracts, cross ownership boundaries, lower test requirements, or declare the whole project complete.
|
|
170
|
+
|
|
171
|
+
## 7. Create and Maintain `LOOP.md`
|
|
172
|
+
|
|
173
|
+
Create `LOOP.md` before production implementation. Its top section must expose enough state for a new session to resume after reading only the top status and current loop. Use exactly one current state:
|
|
174
|
+
|
|
175
|
+
`drafting`, `grilling`, `awaiting-spec-approval`, `ready`, `implementing`, `judging`, `changes-requested`, `blocked`, or `accepted`.
|
|
176
|
+
|
|
177
|
+
Each loop records its Loop ID, objective, FR/AC IDs, assignments, dependencies, outputs, changed files, commands/checks, results, evidence, main-agent judgment, failure conditions, rework requirements, unresolved risks, next state, and next action. Update the top state when reality changes. Never delete or overwrite a failed loop; append the next attempt.
|
|
178
|
+
|
|
179
|
+
## 8. Execute Approved Work
|
|
180
|
+
|
|
181
|
+
Give each subagent only the context required by its task contract. Require the completion-report format from [references/agent-and-judge-contracts.md](references/agent-and-judge-contracts.md). Treat contract deviations, new blockers, interface changes, and ownership conflicts as stop-and-report events.
|
|
182
|
+
|
|
183
|
+
Integrate in dependency order. Inspect actual changes instead of relying on summaries. Keep `LOOP.md` current with files, checks, results, evidence, risks, and status.
|
|
184
|
+
|
|
185
|
+
## 9. Judge Independently
|
|
186
|
+
|
|
187
|
+
The main agent must:
|
|
188
|
+
|
|
189
|
+
1. Compare the actual diff and behavior with the frozen specification.
|
|
190
|
+
2. Check ownership compliance and scope expansion.
|
|
191
|
+
3. Check cross-module contracts and data structures.
|
|
192
|
+
4. Run the highest feasible end-to-end validation plus necessary unit, integration, and regression tests.
|
|
193
|
+
5. Exercise applicable failure, permission, idempotency, concurrency, migration, rollback, and recovery behavior.
|
|
194
|
+
6. Produce evidence for every blocking AC.
|
|
195
|
+
7. Record an acceptance matrix: `Acceptance ID | Result | Evidence | Defect/Caveat`.
|
|
196
|
+
|
|
197
|
+
Allowed conclusions are `ACCEPTED`, `CHANGES_REQUESTED`, `BLOCKED`, and `ACCEPTED_WITH_CAVEATS`. Missing evidence for a blocking AC is a failure. Existing code, passing unit tests, a subagent's claim, or majority agreement is never sufficient by itself; only the frozen acceptance contract determines the result.
|
|
198
|
+
|
|
199
|
+
For `CHANGES_REQUESTED`, append a new loop for only the failed ACs, include reproduction evidence, constrain the minimum repair scope, and require regression coverage. Never weaken acceptance to manufacture a pass. After the same AC fails judgment in three consecutive loops, stop automatic rework and ask the user to choose redesign, scope change, accepted limitation, or termination of that part.
|
|
200
|
+
|
|
201
|
+
## 10. Deliver
|
|
202
|
+
|
|
203
|
+
Lead with the result, then report completed scope, incomplete or deferred scope, the acceptance matrix, test and validation evidence, key design decisions, remaining risks, accepted assumptions, and suggested next steps. Ensure the final `LOOP.md` state matches the real outcome.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Agent and Judge Contracts
|
|
2
|
+
|
|
3
|
+
Read this reference only after the specification and acceptance contract are frozen and the user has approved implementation. The main agent owns these contracts, integration, and final judgment.
|
|
4
|
+
|
|
5
|
+
## Subagent Task Contract
|
|
6
|
+
|
|
7
|
+
```markdown
|
|
8
|
+
Task ID:
|
|
9
|
+
Objective:
|
|
10
|
+
Related FR IDs:
|
|
11
|
+
Related AC IDs:
|
|
12
|
+
|
|
13
|
+
Inputs:
|
|
14
|
+
Dependencies and prerequisite state:
|
|
15
|
+
Frozen contracts/types/schemas:
|
|
16
|
+
|
|
17
|
+
Allowed files or directories:
|
|
18
|
+
Forbidden files or directories:
|
|
19
|
+
|
|
20
|
+
Required implementation outputs:
|
|
21
|
+
Required tests or documentation:
|
|
22
|
+
Checks that must be executed:
|
|
23
|
+
Evidence that must be returned:
|
|
24
|
+
|
|
25
|
+
Stop and report if:
|
|
26
|
+
- a requirement or acceptance condition must change;
|
|
27
|
+
- a frozen shared contract must change;
|
|
28
|
+
- an allowed path is insufficient;
|
|
29
|
+
- another task owns a required file;
|
|
30
|
+
- a dependency is missing or inconsistent;
|
|
31
|
+
- a security, data-loss, migration, or external-compatibility risk appears.
|
|
32
|
+
|
|
33
|
+
Completion authority: Report task results and evidence only. Do not declare overall acceptance.
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Subagent Completion Report
|
|
37
|
+
|
|
38
|
+
Require this exact field set so integration evidence is comparable:
|
|
39
|
+
|
|
40
|
+
```text
|
|
41
|
+
Status:
|
|
42
|
+
Acceptance IDs addressed:
|
|
43
|
+
Files changed:
|
|
44
|
+
Behavior implemented:
|
|
45
|
+
Checks executed:
|
|
46
|
+
Results:
|
|
47
|
+
Evidence:
|
|
48
|
+
Assumptions:
|
|
49
|
+
Risks:
|
|
50
|
+
Contract deviations:
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
`Status` describes the assigned task only. Any non-empty `Contract deviations` field is a main-agent review trigger, not an implicit approval.
|
|
54
|
+
|
|
55
|
+
## File Ownership Rules
|
|
56
|
+
|
|
57
|
+
1. Express ownership with explicit repository-relative paths or narrowly defined directory trees; never use phrases such as "related files" or "files as needed".
|
|
58
|
+
2. Freeze shared interfaces, schemas, generated clients, public types, and migration ordering before parallel work.
|
|
59
|
+
3. Give each writable file to one task at a time. Read access may overlap; write ownership may not.
|
|
60
|
+
4. If two tasks require the same file, order them serially or assign the shared edit to a separate prerequisite task.
|
|
61
|
+
5. A subagent must stop and request an ownership amendment before editing outside its allowed scope.
|
|
62
|
+
6. Only the main agent may approve an ownership amendment, recheck overlap, update `AGENT_PLAN.md`, and notify affected tasks.
|
|
63
|
+
7. Changes beyond the frozen scope return to specification approval; they are not ownership amendments.
|
|
64
|
+
|
|
65
|
+
## Main-Agent Integration Checklist
|
|
66
|
+
|
|
67
|
+
- Inspect actual diffs and changed files, not only reports.
|
|
68
|
+
- Compare changed paths with every task's ownership contract.
|
|
69
|
+
- Confirm shared contracts match the frozen version across modules.
|
|
70
|
+
- Integrate in dependency order and resolve conflicts centrally.
|
|
71
|
+
- Check that no task expanded requirements or weakened tests/acceptance.
|
|
72
|
+
- Run the highest feasible end-to-end path.
|
|
73
|
+
- Run applicable unit, integration, regression, migration, rollback, permission, invalid-input, idempotency, concurrency, failure, and recovery checks.
|
|
74
|
+
- Collect observable evidence for every blocking AC.
|
|
75
|
+
- Update the current `LOOP.md` attempt before reaching a judgment.
|
|
76
|
+
|
|
77
|
+
## Acceptance Matrix
|
|
78
|
+
|
|
79
|
+
```markdown
|
|
80
|
+
| Acceptance ID | Result | Evidence | Defect/Caveat |
|
|
81
|
+
|---|---|---|---|
|
|
82
|
+
| AC-001 | Pass | <test/log/API/DB/screenshot/metric/manual check> | None |
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Use only `Pass`, `Fail`, or `Blocked` per row. A blocking row without adequate evidence cannot be `Pass`. After evaluating all rows, choose exactly one overall judgment:
|
|
86
|
+
|
|
87
|
+
- `ACCEPTED`: every blocking AC passes and the Definition of Done is met.
|
|
88
|
+
- `ACCEPTED_WITH_CAVEATS`: every blocking AC passes; documented non-blocking limitations remain.
|
|
89
|
+
- `CHANGES_REQUESTED`: one or more ACs fail and a bounded repair is feasible.
|
|
90
|
+
- `BLOCKED`: required validation or implementation cannot proceed because of an unresolved dependency or decision.
|
|
91
|
+
|
|
92
|
+
## Rework Task Contract
|
|
93
|
+
|
|
94
|
+
```markdown
|
|
95
|
+
Rework Task ID:
|
|
96
|
+
Source Loop ID:
|
|
97
|
+
Failed AC IDs:
|
|
98
|
+
Reproduction evidence:
|
|
99
|
+
Observed versus expected behavior:
|
|
100
|
+
Minimum repair scope:
|
|
101
|
+
Allowed files or directories:
|
|
102
|
+
Forbidden files or directories:
|
|
103
|
+
Required regression test:
|
|
104
|
+
Checks and evidence required:
|
|
105
|
+
Unchanged frozen contracts:
|
|
106
|
+
Stop and report if:
|
|
107
|
+
Attempt number for each failed AC:
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Append rework as a new loop. Do not erase the failed attempt, broaden the repair beyond failed ACs, or lower an acceptance condition to produce a pass.
|
|
111
|
+
|
|
112
|
+
## Three-Consecutive-Failures Stop Rule
|
|
113
|
+
|
|
114
|
+
Track failure counts per AC, not per project. When the same AC fails main-agent judgment in three consecutive loops:
|
|
115
|
+
|
|
116
|
+
1. stop automatic rework for that AC;
|
|
117
|
+
2. set `LOOP.md` to `blocked` unless other independent work may safely continue;
|
|
118
|
+
3. present the three attempts and evidence to the user;
|
|
119
|
+
4. ask the user to choose redesign, scope change, acceptance of a documented limitation, or termination of that part;
|
|
120
|
+
5. obtain renewed specification approval before continuing after redesign or scope/acceptance changes.
|