@runecraft/grimoire 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +21 -0
- package/catalog.json +9 -0
- package/dist/grimoire.js +1758 -0
- package/package.json +54 -0
- package/references/definition-of-done.md +67 -0
- package/references/testing-patterns.md +260 -0
- package/skills/code-review-and-quality/README.md +13 -0
- package/skills/code-review-and-quality/SKILL.md +389 -0
- package/skills/code-simplification/README.md +13 -0
- package/skills/code-simplification/SKILL.md +338 -0
- package/skills/debugging-and-error-recovery/README.md +13 -0
- package/skills/debugging-and-error-recovery/SKILL.md +343 -0
- package/skills/debugging-and-error-recovery/scripts/__pycache__/triage_state.cpython-314.pyc +0 -0
- package/skills/debugging-and-error-recovery/scripts/triage_state.py +206 -0
- package/skills/deprecation-and-migration/README.md +13 -0
- package/skills/deprecation-and-migration/SKILL.md +248 -0
- package/skills/deprecation-and-migration/scripts/__pycache__/migration_tracker.cpython-314.pyc +0 -0
- package/skills/deprecation-and-migration/scripts/migration_tracker.py +237 -0
- package/skills/doubt-driven-development/README.md +13 -0
- package/skills/doubt-driven-development/SKILL.md +251 -0
- package/skills/git-commit-learning/.skill-meta.json +14 -0
- package/skills/git-commit-learning/README.md +205 -0
- package/skills/git-commit-learning/SKILL.md +435 -0
- package/skills/git-commit-learning/references/commit-patterns.md +595 -0
- package/skills/git-worktree/README.md +13 -0
- package/skills/git-worktree/SKILL.md +220 -0
- package/skills/idea-refine/README.md +13 -0
- package/skills/idea-refine/SKILL.md +186 -0
- package/skills/interview-me/README.md +13 -0
- package/skills/interview-me/SKILL.md +233 -0
- package/skills/linkedin-audit/SKILL.md +98 -0
- package/skills/linkedin-audit/references/dashboard-spec.md +43 -0
- package/skills/memory-management/README.md +13 -0
- package/skills/memory-management/SKILL.md +198 -0
- package/skills/security-and-hardening/README.md +13 -0
- package/skills/security-and-hardening/SKILL.md +472 -0
- package/skills/shipping-and-launch/README.md +13 -0
- package/skills/shipping-and-launch/SKILL.md +317 -0
- package/skills/skill-forge/README.md +153 -0
- package/skills/skill-forge/SKILL.md +291 -0
- package/skills/skill-forge/assets/SKILL.template.md +73 -0
- package/skills/skill-forge/references/authoring-patterns.md +249 -0
- package/skills/skill-forge/references/description-optimization.md +171 -0
- package/skills/skill-forge/references/output-evaluation.md +276 -0
- package/skills/skill-forge/references/scripts-guide.md +232 -0
- package/skills/skill-forge/references/spec.md +175 -0
- package/skills/skill-forge/scripts/validate.py +536 -0
- package/skills/spec-driven/.skill-meta.json +14 -0
- package/skills/spec-driven/README.md +335 -0
- package/skills/spec-driven/SKILL.md +174 -0
- package/skills/spec-driven/references/code-analysis.md +98 -0
- package/skills/spec-driven/references/coding-principles.md +56 -0
- package/skills/spec-driven/references/context-limits.md +31 -0
- package/skills/spec-driven/references/design.md +199 -0
- package/skills/spec-driven/references/discuss.md +136 -0
- package/skills/spec-driven/references/implement.md +425 -0
- package/skills/spec-driven/references/lessons.md +113 -0
- package/skills/spec-driven/references/memory.md +126 -0
- package/skills/spec-driven/references/specify.md +210 -0
- package/skills/spec-driven/references/sub-agents.md +96 -0
- package/skills/spec-driven/references/tasks.md +484 -0
- package/skills/spec-driven/references/validate.md +350 -0
- package/skills/spec-driven/scripts/__pycache__/lessons.cpython-314.pyc +0 -0
- package/skills/spec-driven/scripts/lessons.py +370 -0
- package/skills/spec-loop/README.md +36 -0
- package/skills/spec-loop/SKILL.md +61 -0
- package/skills/test-driven-development/README.md +13 -0
- package/skills/test-driven-development/SKILL.md +388 -0
- package/skills/typescript-patterns/README.md +13 -0
- package/skills/typescript-patterns/SKILL.md +346 -0
- package/skills/using-agent-skills/README.md +13 -0
- package/skills/using-agent-skills/SKILL.md +187 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
migration_tracker.py — deterministic per-consumer migration tracking.
|
|
4
|
+
|
|
5
|
+
Tracks migration status for a single deprecation effort (identified by --slug).
|
|
6
|
+
Canonical state lives in .migrations/<slug>/state.json; a human-readable
|
|
7
|
+
STATUS.md is regenerated on every write.
|
|
8
|
+
|
|
9
|
+
Pure standard library. No dependencies. Run from the project root (the dir
|
|
10
|
+
that contains .migrations), or pass --root.
|
|
11
|
+
|
|
12
|
+
Commands:
|
|
13
|
+
add-consumer Register a consumer with a migration status.
|
|
14
|
+
mark-migrated Flip a consumer to migrated with an evidence note.
|
|
15
|
+
status Print aggregate counts (total, pending, migrating, done).
|
|
16
|
+
list-pending Print consumers not yet migrated.
|
|
17
|
+
|
|
18
|
+
Exit codes: 0 ok, 2 usage/validation error.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
import argparse
|
|
22
|
+
import datetime as _dt
|
|
23
|
+
import json
|
|
24
|
+
import os
|
|
25
|
+
import sys
|
|
26
|
+
|
|
27
|
+
MIGRATIONS_DIR = ".migrations"
|
|
28
|
+
|
|
29
|
+
VALID_STATUSES = {"pending", "migrating", "done"}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _now():
|
|
33
|
+
return _dt.datetime.now(_dt.timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _store_path(root, slug):
|
|
37
|
+
return os.path.join(root, MIGRATIONS_DIR, slug, "state.json")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _render_path(root, slug):
|
|
41
|
+
return os.path.join(root, MIGRATIONS_DIR, slug, "STATUS.md")
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _slug_dir(root, slug):
|
|
45
|
+
return os.path.join(root, MIGRATIONS_DIR, slug)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _load(root, slug):
|
|
49
|
+
path = _store_path(root, slug)
|
|
50
|
+
if not os.path.exists(path):
|
|
51
|
+
return {"slug": slug, "consumers": []}
|
|
52
|
+
with open(path, "r", encoding="utf-8") as f:
|
|
53
|
+
data = json.load(f)
|
|
54
|
+
data.setdefault("slug", slug)
|
|
55
|
+
data.setdefault("consumers", [])
|
|
56
|
+
return data
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _save(root, slug, data):
|
|
60
|
+
os.makedirs(_slug_dir(root, slug), exist_ok=True)
|
|
61
|
+
with open(_store_path(root, slug), "w", encoding="utf-8") as f:
|
|
62
|
+
json.dump(data, f, indent=2, ensure_ascii=False)
|
|
63
|
+
f.write("\n")
|
|
64
|
+
_render(root, slug, data)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def _find_consumer(data, name):
|
|
68
|
+
for c in data["consumers"]:
|
|
69
|
+
if c["name"] == name:
|
|
70
|
+
return c
|
|
71
|
+
return None
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _render(root, slug, data):
|
|
75
|
+
consumers = data["consumers"]
|
|
76
|
+
total = len(consumers)
|
|
77
|
+
pending = sum(1 for c in consumers if c["status"] == "pending")
|
|
78
|
+
migrating = sum(1 for c in consumers if c["status"] == "migrating")
|
|
79
|
+
done = sum(1 for c in consumers if c["status"] == "done")
|
|
80
|
+
|
|
81
|
+
lines = []
|
|
82
|
+
lines.append(f"# Migration Status: `{slug}`")
|
|
83
|
+
lines.append("")
|
|
84
|
+
lines.append("> Auto-maintained by `scripts/migration_tracker.py`. Do NOT hand-edit.")
|
|
85
|
+
lines.append(f"> Canonical state lives in `.migrations/{slug}/state.json`.")
|
|
86
|
+
lines.append("")
|
|
87
|
+
lines.append("## Summary")
|
|
88
|
+
lines.append("")
|
|
89
|
+
lines.append("| Metric | Count |")
|
|
90
|
+
lines.append("| ------ | ----- |")
|
|
91
|
+
lines.append(f"| Total | {total} |")
|
|
92
|
+
lines.append(f"| Pending | {pending} |")
|
|
93
|
+
lines.append(f"| Migrating | {migrating} |")
|
|
94
|
+
lines.append(f"| Done | {done} |")
|
|
95
|
+
lines.append("")
|
|
96
|
+
|
|
97
|
+
if not consumers:
|
|
98
|
+
lines.append("_(no consumers registered)_")
|
|
99
|
+
lines.append("")
|
|
100
|
+
else:
|
|
101
|
+
lines.append("## Consumers")
|
|
102
|
+
lines.append("")
|
|
103
|
+
lines.append("| Consumer | Status | Evidence | Last Updated |")
|
|
104
|
+
lines.append("| -------- | ------ | -------- | ------------ |")
|
|
105
|
+
for c in sorted(consumers, key=lambda x: x.get("created", "")):
|
|
106
|
+
evidence = c.get("evidence_note") or "\u2014"
|
|
107
|
+
updated = c.get("updated", c.get("created", "\u2014"))
|
|
108
|
+
lines.append(f"| {c['name']} | {c['status']} | {evidence} | {updated} |")
|
|
109
|
+
lines.append("")
|
|
110
|
+
|
|
111
|
+
with open(_render_path(root, slug), "w", encoding="utf-8") as f:
|
|
112
|
+
f.write("\n".join(lines).rstrip() + "\n")
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
# ----------------------------- commands -----------------------------
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def cmd_add_consumer(root, args):
|
|
119
|
+
slug = args.slug
|
|
120
|
+
consumer_name = args.consumer
|
|
121
|
+
status = args.status
|
|
122
|
+
|
|
123
|
+
data = _load(root, slug)
|
|
124
|
+
existing = _find_consumer(data, consumer_name)
|
|
125
|
+
now = _now()
|
|
126
|
+
|
|
127
|
+
if existing:
|
|
128
|
+
existing["status"] = status
|
|
129
|
+
existing["updated"] = now
|
|
130
|
+
_save(root, slug, data)
|
|
131
|
+
print(f"UPDATED {consumer_name} -> {status}")
|
|
132
|
+
else:
|
|
133
|
+
data["consumers"].append({
|
|
134
|
+
"name": consumer_name,
|
|
135
|
+
"status": status,
|
|
136
|
+
"evidence_note": None,
|
|
137
|
+
"created": now,
|
|
138
|
+
"updated": now,
|
|
139
|
+
})
|
|
140
|
+
_save(root, slug, data)
|
|
141
|
+
print(f"ADDED {consumer_name} -> {status}")
|
|
142
|
+
return 0
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def cmd_mark_migrated(root, args):
|
|
146
|
+
slug = args.slug
|
|
147
|
+
consumer_name = args.consumer
|
|
148
|
+
note = (args.note or "").strip()
|
|
149
|
+
|
|
150
|
+
data = _load(root, slug)
|
|
151
|
+
existing = _find_consumer(data, consumer_name)
|
|
152
|
+
|
|
153
|
+
if not existing:
|
|
154
|
+
print(f"ERROR: consumer '{consumer_name}' not registered for slug '{slug}'. Use add-consumer first.", file=sys.stderr)
|
|
155
|
+
return 2
|
|
156
|
+
|
|
157
|
+
now = _now()
|
|
158
|
+
existing["status"] = "done"
|
|
159
|
+
existing["evidence_note"] = note if note else None
|
|
160
|
+
existing["updated"] = now
|
|
161
|
+
_save(root, slug, data)
|
|
162
|
+
print(f"MIGRATED {consumer_name} ({note if note else 'no note'})")
|
|
163
|
+
return 0
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def cmd_status(root, args):
|
|
167
|
+
slug = args.slug
|
|
168
|
+
data = _load(root, slug)
|
|
169
|
+
consumers = data["consumers"]
|
|
170
|
+
|
|
171
|
+
if not consumers:
|
|
172
|
+
print("(no consumers registered)")
|
|
173
|
+
return 0
|
|
174
|
+
|
|
175
|
+
total = len(consumers)
|
|
176
|
+
pending = sum(1 for c in consumers if c["status"] == "pending")
|
|
177
|
+
migrating = sum(1 for c in consumers if c["status"] == "migrating")
|
|
178
|
+
done = sum(1 for c in consumers if c["status"] == "done")
|
|
179
|
+
|
|
180
|
+
print(f"{slug}: {total} total | pending={pending} migrating={migrating} done={done}")
|
|
181
|
+
return 0
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def cmd_list_pending(root, args):
|
|
185
|
+
slug = args.slug
|
|
186
|
+
data = _load(root, slug)
|
|
187
|
+
|
|
188
|
+
if not data["consumers"]:
|
|
189
|
+
print("(no consumers registered)")
|
|
190
|
+
return 0
|
|
191
|
+
|
|
192
|
+
pending = [c for c in data["consumers"] if c["status"] in ("pending", "migrating")]
|
|
193
|
+
|
|
194
|
+
if not pending:
|
|
195
|
+
print("(no pending consumers)")
|
|
196
|
+
return 0
|
|
197
|
+
|
|
198
|
+
for c in sorted(pending, key=lambda x: x.get("created", "")):
|
|
199
|
+
print(f"{c['name']} ({c['status']})")
|
|
200
|
+
return 0
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
def main(argv=None):
|
|
204
|
+
p = argparse.ArgumentParser(
|
|
205
|
+
prog="migration_tracker.py",
|
|
206
|
+
description="Deterministic per-consumer migration tracking.",
|
|
207
|
+
)
|
|
208
|
+
p.add_argument("--root", default=".", help="Project root containing .migrations/ (default: current dir)")
|
|
209
|
+
sub = p.add_subparsers(dest="cmd", required=True)
|
|
210
|
+
|
|
211
|
+
sp = sub.add_parser("add-consumer", help="Register a consumer with a migration status")
|
|
212
|
+
sp.add_argument("--slug", required=True, help="Migration effort slug")
|
|
213
|
+
sp.add_argument("--consumer", required=True, help="Consumer name")
|
|
214
|
+
sp.add_argument("--status", required=True, choices=sorted(VALID_STATUSES), help="Migration status")
|
|
215
|
+
sp.set_defaults(fn=cmd_add_consumer)
|
|
216
|
+
|
|
217
|
+
sp = sub.add_parser("mark-migrated", help="Flip a consumer to migrated with an evidence note")
|
|
218
|
+
sp.add_argument("--slug", required=True, help="Migration effort slug")
|
|
219
|
+
sp.add_argument("--consumer", required=True, help="Consumer name")
|
|
220
|
+
sp.add_argument("--note", required=True, help="Evidence note for the migration")
|
|
221
|
+
sp.set_defaults(fn=cmd_mark_migrated)
|
|
222
|
+
|
|
223
|
+
sp = sub.add_parser("status", help="Print aggregate counts")
|
|
224
|
+
sp.add_argument("--slug", required=True, help="Migration effort slug")
|
|
225
|
+
sp.set_defaults(fn=cmd_status)
|
|
226
|
+
|
|
227
|
+
sp = sub.add_parser("list-pending", help="Print consumers not yet migrated")
|
|
228
|
+
sp.add_argument("--slug", required=True, help="Migration effort slug")
|
|
229
|
+
sp.set_defaults(fn=cmd_list_pending)
|
|
230
|
+
|
|
231
|
+
args = p.parse_args(argv)
|
|
232
|
+
root = os.path.abspath(args.root)
|
|
233
|
+
return args.fn(root, args)
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
if __name__ == "__main__":
|
|
237
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# doubt-driven-development
|
|
2
|
+
|
|
3
|
+
Adversarial review of every non-trivial decision before it stands: CLAIM → EXTRACT → DOUBT → RECONCILE → STOP.
|
|
4
|
+
|
|
5
|
+
| Field | Value |
|
|
6
|
+
|-------|-------|
|
|
7
|
+
| Version | 1.0.0 |
|
|
8
|
+
| Trigger | `/harden`, "stress-test this", "play devil's advocate", "fresh-context review" |
|
|
9
|
+
| PT trigger | `/endurecer`, "questionar decisão", "será que tô certo?" |
|
|
10
|
+
|
|
11
|
+
**Do not use for** trivial changes where the cost of doubt exceeds the cost of a bug, or for finished artifact review (that's `/review`).
|
|
12
|
+
|
|
13
|
+
See [SKILL.md](SKILL.md) for the full process.
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: doubt-driven-development
|
|
3
|
+
description: >
|
|
4
|
+
Subjects every non-trivial decision to a fresh-context adversarial review (CLAIM → EXTRACT →
|
|
5
|
+
DOUBT → RECONCILE → STOP) before it stands. Use when correctness matters more than speed,
|
|
6
|
+
in unfamiliar code, or when stakes are high (production, security-sensitive logic, irreversible ops).
|
|
7
|
+
EN triggers: /harden, "stress-test this", "play devil's advocate", fresh-context review, CLAIM EXTRACT DOUBT.
|
|
8
|
+
PT triggers: /endurecer, questionar decisão, revisar com olhos novos, "será que tô certo?".
|
|
9
|
+
Do NOT use for: trivial changes where the cost of doubt exceeds the cost of a bug, or for finished
|
|
10
|
+
artifact review (that's /review).
|
|
11
|
+
license: CC-BY-4.0
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Doubt-Driven Development
|
|
15
|
+
|
|
16
|
+
## Overview
|
|
17
|
+
|
|
18
|
+
A confident answer is not a correct one. Long sessions accumulate context that quietly turns assumptions into "facts" without anyone noticing. Doubt-driven development is the discipline of materializing a fresh-context reviewer — biased to **disprove**, not approve — before any non-trivial output stands.
|
|
19
|
+
|
|
20
|
+
This is not `/review`. `/review` is a verdict on a finished artifact. This is an in-flight posture: non-trivial decisions get cross-examined while course-correction is still cheap.
|
|
21
|
+
|
|
22
|
+
## When to Use
|
|
23
|
+
|
|
24
|
+
A decision is **non-trivial** when at least one of these is true:
|
|
25
|
+
|
|
26
|
+
- It introduces or modifies branching logic
|
|
27
|
+
- It crosses a module or service boundary
|
|
28
|
+
- It asserts a property the type system or compiler cannot verify (thread safety, idempotence, ordering, invariants)
|
|
29
|
+
- Its correctness depends on context the future reader cannot see
|
|
30
|
+
- Its blast radius is irreversible (production deploy, data migration, public API change)
|
|
31
|
+
|
|
32
|
+
Apply the skill when:
|
|
33
|
+
|
|
34
|
+
- About to make an architectural decision under uncertainty
|
|
35
|
+
- About to commit non-trivial code
|
|
36
|
+
- About to claim a non-obvious fact ("this is safe", "this scales", "this matches the spec")
|
|
37
|
+
- Working in code you don't fully understand
|
|
38
|
+
|
|
39
|
+
**When NOT to use:**
|
|
40
|
+
|
|
41
|
+
- Mechanical operations (renaming, formatting, file moves)
|
|
42
|
+
- Following a clear, unambiguous user instruction
|
|
43
|
+
- Reading or summarizing existing code
|
|
44
|
+
- One-line changes with obvious correctness
|
|
45
|
+
- Pure tooling operations (running tests, listing files)
|
|
46
|
+
- The user has explicitly asked for speed over verification
|
|
47
|
+
|
|
48
|
+
If you doubt every keystroke, you ship nothing. The skill applies only to non-trivial decisions as defined above.
|
|
49
|
+
|
|
50
|
+
## Loading Constraints
|
|
51
|
+
|
|
52
|
+
This skill is designed for the **main-session orchestrator**, where Step 3 (DOUBT, detailed below) can spawn a fresh-context reviewer.
|
|
53
|
+
|
|
54
|
+
- **Do NOT add this skill to a persona's `skills:` frontmatter.** A persona that follows Step 3 would spawn another persona — the orchestration anti-pattern ("personas do not invoke other personas").
|
|
55
|
+
- **If you find yourself applying this skill from inside a subagent context** (where Claude Code prevents nested subagent spawn): the preferred path is to surface to the user that doubt-driven cannot run nested and let the main session handle it. As a last resort only, a degraded self-questioning fallback exists — rewrite ARTIFACT + CONTRACT as a fresh self-prompt with a hard mental separator from your prior reasoning, and walk Steps 1–5. This is **not fresh-context review** (you carry your own context with you), so flag the result as degraded and prefer escalation whenever the user is reachable.
|
|
56
|
+
|
|
57
|
+
## The Process
|
|
58
|
+
|
|
59
|
+
Copy this checklist when applying the skill:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
Doubt cycle:
|
|
63
|
+
- [ ] Step 1: CLAIM — wrote the claim + why-it-matters
|
|
64
|
+
- [ ] Step 2: EXTRACT — isolated artifact + contract, stripped reasoning
|
|
65
|
+
- [ ] Step 3: DOUBT — invoked fresh-context reviewer with adversarial prompt
|
|
66
|
+
- [ ] Step 4: RECONCILE — classified every finding against the artifact text
|
|
67
|
+
- [ ] Step 5: STOP — met stop condition (trivial findings, 3 cycles, or user override)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Step 1: CLAIM — Surface what stands
|
|
71
|
+
|
|
72
|
+
Name the decision in two or three lines:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
CLAIM: "The new caching layer is thread-safe under the
|
|
76
|
+
read-heavy workload described in the spec."
|
|
77
|
+
WHY THIS MATTERS: a race here corrupts user data and is
|
|
78
|
+
hard to detect in QA.
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
If you can't write the claim that compactly, you have a vibe, not a decision. Surface it before scrutinizing it.
|
|
82
|
+
|
|
83
|
+
### Step 2: EXTRACT — Smallest reviewable unit
|
|
84
|
+
|
|
85
|
+
A fresh-context reviewer needs the **artifact** and the **contract**, not the journey.
|
|
86
|
+
|
|
87
|
+
- Code: the diff or the function — not the whole file
|
|
88
|
+
- Decision: the proposal in 3–5 sentences plus the constraints it has to satisfy
|
|
89
|
+
- Assertion: the claim plus the evidence that supposedly supports it (kept distinct from the Step 1 CLAIM block, which is the orchestrator's hypothesis under scrutiny)
|
|
90
|
+
|
|
91
|
+
Strip your reasoning. If you hand over conclusions, you'll get back validation of your conclusions. The unit must be small enough that a reviewer can hold it in mind in one read — if it's a 500-line PR, decompose first.
|
|
92
|
+
|
|
93
|
+
### Step 3: DOUBT — Invoke the fresh-context reviewer
|
|
94
|
+
|
|
95
|
+
The reviewer's prompt **must be adversarial**. Framing decides the answer.
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
Adversarial review. Find what is wrong with this artifact.
|
|
99
|
+
Assume the author is overconfident. Look for:
|
|
100
|
+
- Unstated assumptions
|
|
101
|
+
- Edge cases not handled
|
|
102
|
+
- Hidden coupling or shared state
|
|
103
|
+
- Ways the contract could be violated
|
|
104
|
+
- Existing conventions this might break
|
|
105
|
+
- Failure modes under unexpected input
|
|
106
|
+
|
|
107
|
+
Do NOT validate. Do NOT summarize. Find issues, or state
|
|
108
|
+
explicitly that you cannot find any after thorough examination.
|
|
109
|
+
|
|
110
|
+
ARTIFACT: <paste artifact>
|
|
111
|
+
CONTRACT: <paste contract>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Pass ARTIFACT + CONTRACT only. Do NOT pass the CLAIM.** Handing the reviewer your conclusion biases it toward agreement. The reviewer must independently determine whether the artifact satisfies the contract.
|
|
115
|
+
|
|
116
|
+
In Claude Code, the role-based reviewers in `agents/` start with isolated context by design and are usable here — see `agents/` for the roster and per-domain match.
|
|
117
|
+
|
|
118
|
+
**The adversarial prompt above takes precedence over the persona's default response shape.** Personas like `code-reviewer` are written to produce balanced verdicts with both strengths and weaknesses; doubt-driven needs issues-only output. Paste the adversarial prompt verbatim into the invocation so it overrides the persona's default. If a persona's response shape can't be overridden cleanly, fall back to a generic subagent with the adversarial prompt.
|
|
119
|
+
|
|
120
|
+
#### Cross-model escalation
|
|
121
|
+
|
|
122
|
+
A single-model reviewer shares blind spots with the original author — a colder, different-architecture model catches them. Doubt-driven is already opt-in for non-trivial decisions, so within that scope offering cross-model is part of the skill's value, not optional friction.
|
|
123
|
+
|
|
124
|
+
**Interactive sessions: always offer. Never silently skip.**
|
|
125
|
+
|
|
126
|
+
**Step 1: Ask the user**
|
|
127
|
+
|
|
128
|
+
After the single-model review in Step 3 above, but before RECONCILE, pause and ask:
|
|
129
|
+
|
|
130
|
+
> *"Single-model review complete. Want a cross-model second opinion? Options: Gemini CLI, Codex CLI, manual external review (you paste it elsewhere), or skip."*
|
|
131
|
+
|
|
132
|
+
This question is mandatory in every interactive doubt cycle — even on artifacts that feel low-stakes. The user — not the agent — decides whether the cost is worth it. The agent's job is to surface the choice.
|
|
133
|
+
|
|
134
|
+
**Step 2: If the user picks a CLI — verify, then invoke**
|
|
135
|
+
|
|
136
|
+
1. Check the tool is in PATH (`which gemini`, `which codex`).
|
|
137
|
+
2. Test it works (`gemini --version` or equivalent) before passing the full prompt — a stale or broken binary may pass `which` but fail on real input.
|
|
138
|
+
3. Confirm the exact invocation with the user, including required flags, auth, and env vars (e.g., API keys). Implementations vary; never assume.
|
|
139
|
+
4. Pass ARTIFACT + CONTRACT + the adversarial prompt **only**. No session context, no CLAIM.
|
|
140
|
+
5. Mind shell escaping. If the artifact contains quotes, `$(...)`, or backticks, prefer stdin (`echo … | gemini`) or a heredoc over inline `-p "…"`. When in doubt, ask the user to confirm the invocation before running it.
|
|
141
|
+
6. Take the output into Step 4 (RECONCILE).
|
|
142
|
+
|
|
143
|
+
**Never interpolate the artifact into a shell-quoted argument.** Code, markdown, and review prompts routinely contain backticks, `$(...)`, and quote characters that will either truncate the prompt or execute embedded shell. Write the full prompt to a file and pipe it through stdin.
|
|
144
|
+
|
|
145
|
+
Example shapes (verify flags against your installed tool — syntax differs across implementations and versions):
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# Write the adversarial prompt + ARTIFACT + CONTRACT to a temp file first.
|
|
149
|
+
# Then pipe via stdin so shell metacharacters in the artifact stay inert.
|
|
150
|
+
|
|
151
|
+
# Codex (read-only sandbox keeps the CLI from writing to your workspace):
|
|
152
|
+
codex exec --sandbox read-only -C <repo-path> - < /tmp/doubt-prompt.md
|
|
153
|
+
|
|
154
|
+
# Gemini ('--approval-mode plan' is read-only; '-p ""' triggers non-interactive
|
|
155
|
+
# mode and the prompt is read from stdin):
|
|
156
|
+
gemini --approval-mode plan -p "" < /tmp/doubt-prompt.md
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
A read-only sandbox is the load-bearing detail: a doubt artifact may itself contain instructions (intentional or accidental prompt injection) that the cross-model CLI would otherwise execute against your workspace.
|
|
160
|
+
|
|
161
|
+
**Step 3: If the CLI is unavailable or fails**
|
|
162
|
+
|
|
163
|
+
Surface the failure explicitly. Offer: run it manually, try a different tool, or skip. Do not silently fall back to single-model — the user should know cross-model didn't happen.
|
|
164
|
+
|
|
165
|
+
**Step 4: If the user skips**
|
|
166
|
+
|
|
167
|
+
Acknowledge the skip in the output (*"Proceeding with single-model findings only"*) and continue to RECONCILE. Skipping is fine; silent skipping is not.
|
|
168
|
+
|
|
169
|
+
**Non-interactive contexts** (CI, `/loop`, autonomous-loop, scheduled runs):
|
|
170
|
+
|
|
171
|
+
- Cross-model is **skipped**, and the skip must be **announced** in the output: *"Cross-model skipped: non-interactive context."*
|
|
172
|
+
- **Never invoke an external CLI without explicit user authorization** — this is a load-bearing safety property.
|
|
173
|
+
|
|
174
|
+
Cross-model adds cost, latency, and tool fragility. The agent surfaces the choice every cycle; the user decides whether this artifact warrants it.
|
|
175
|
+
|
|
176
|
+
### Step 4: RECONCILE — Fold findings back
|
|
177
|
+
|
|
178
|
+
The reviewer's output is data, not verdict. **You are still the orchestrator.** Re-read the artifact text against each finding before classifying — rubber-stamping the reviewer is the same failure mode as ignoring it.
|
|
179
|
+
|
|
180
|
+
For each finding, classify in this **precedence order** (first matching class wins):
|
|
181
|
+
|
|
182
|
+
1. **Contract misread** — reviewer flagged something specifically because the CONTRACT you provided was unclear or incomplete. Fix the contract first, re-classify on the next cycle.
|
|
183
|
+
2. **Valid + actionable** — real issue requiring a change to the artifact. Change it, re-loop.
|
|
184
|
+
3. **Valid trade-off** — issue is real but cost of fixing exceeds cost of accepting. Document the trade-off explicitly so the user sees it.
|
|
185
|
+
4. **Noise** — reviewer flagged something that's actually correct under context the reviewer didn't have. Note it, move on, and ask: would adding that context to the contract have prevented the false flag?
|
|
186
|
+
|
|
187
|
+
A fresh reviewer can be wrong because it lacks context. Don't defer just because it's "fresh."
|
|
188
|
+
|
|
189
|
+
### Step 5: STOP — Bounded loop, not recursion
|
|
190
|
+
|
|
191
|
+
Stop when:
|
|
192
|
+
|
|
193
|
+
- Next iteration returns only trivial or already-considered findings, **or**
|
|
194
|
+
- 3 cycles completed (escalate to user, don't grind a fourth alone), **or**
|
|
195
|
+
- User explicitly says "ship it"
|
|
196
|
+
|
|
197
|
+
If after 3 cycles the reviewer still surfaces substantive issues, the artifact may not be ready. Surface this to the user — three unresolved cycles is information about the artifact, not a reason to keep looping.
|
|
198
|
+
|
|
199
|
+
If 3 cycles is "obviously insufficient" because the artifact is large: the artifact is too big — return to Step 2 and decompose. Do not lift the bound.
|
|
200
|
+
|
|
201
|
+
## Common Rationalizations
|
|
202
|
+
|
|
203
|
+
| Rationalization | Reality |
|
|
204
|
+
|---|---|
|
|
205
|
+
| "I'm confident, skip the doubt step" | Confidence correlates poorly with correctness on novel problems. Moments of certainty are exactly when blind spots hide. |
|
|
206
|
+
| "Spawning a reviewer is expensive" | Debugging a wrong commit in production is more expensive. The check is bounded; the bug isn't. |
|
|
207
|
+
| "The reviewer will just nitpick" | Only if unscoped. Constrain the prompt to "issues that would make this fail under the contract." |
|
|
208
|
+
| "I'll do doubt at the end with `/review`" | `/review` is a final gate. Doubt-driven catches wrong directions early when course-correction is cheap. By PR time it's too late. |
|
|
209
|
+
| "If I doubt every step I'll never ship" | The skill applies to non-trivial decisions, not every keystroke. Re-read "When NOT to Use." |
|
|
210
|
+
| "Two opinions are always better than one" | Not when the second has less context and produces noise. Reconcile, don't defer. |
|
|
211
|
+
| "The reviewer disagreed so I was wrong" | The reviewer lacks your context — disagreement is information, not verdict. Re-read the artifact, classify, then decide. |
|
|
212
|
+
| "Cross-model is always better" | Cross-model catches blind spots a single model shares with itself, but it adds cost and tool fragility. Offer it every interactive doubt cycle — the user decides whether the artifact warrants it. The agent's job is to surface the choice, not to gate it. |
|
|
213
|
+
| "User said yes once, so I can keep invoking the CLI" | Each invocation is its own authorization. The artifact, the prompt, and the flags change between calls — re-confirm the exact command with the user before every run. |
|
|
214
|
+
|
|
215
|
+
## Red Flags
|
|
216
|
+
|
|
217
|
+
- Spawning a fresh-context reviewer for a one-line rename or formatting change
|
|
218
|
+
- Treating reviewer output as authoritative without re-reading the artifact text
|
|
219
|
+
- Looping >3 cycles without escalating to the user
|
|
220
|
+
- Prompting the reviewer with "is this good?" instead of "find issues"
|
|
221
|
+
- Skipping doubt under time pressure on a high-stakes decision
|
|
222
|
+
- Re-spawning fresh-context on an unchanged artifact (you'll get the same findings; you're stalling)
|
|
223
|
+
- **Doubt theater (checkable signal)**: across 2 or more cycles where the reviewer surfaced substantive findings, zero findings were classified as actionable. You are validating, not doubting. Stop and escalate.
|
|
224
|
+
- Doubting only after committing — that's `/review`, not doubt-driven development
|
|
225
|
+
- Hardcoding an external CLI invocation without confirming with the user that the tool exists, is configured, and accepts that exact syntax
|
|
226
|
+
- **Silently skipping cross-model in an interactive doubt cycle.** Even when not recommending it, the offer must be visible. Skipping is fine; silent skipping is not.
|
|
227
|
+
- Falling back silently when an external CLI errors or is missing — surface the failure and let the user redirect
|
|
228
|
+
- Stripping the contract from the reviewer's input
|
|
229
|
+
- Passing the CLAIM to the reviewer (biases toward agreement)
|
|
230
|
+
|
|
231
|
+
## Interaction with Other Skills
|
|
232
|
+
|
|
233
|
+
- **`code-review-and-quality` / `/review`**: complementary. `/review` is post-hoc PR verdict; doubt-driven is in-flight per-decision. Use both.
|
|
234
|
+
- **Framework-fact verification**: verifying *facts about frameworks* against official docs is a different claim class. Doubt-driven verifies *your reasoning about the artifact* — checking the API exists is a fact check; checking you used it correctly under the contract is doubt-driven's job.
|
|
235
|
+
- **`test-driven-development`**: TDD's RED step is doubt made concrete — a failing test is a disproof attempt. When TDD applies, that failing test *is* the doubt step for behavioral claims.
|
|
236
|
+
- **`debugging-and-error-recovery`**: when the reviewer surfaces a real failure mode, drop into the debugging skill to localize and fix.
|
|
237
|
+
- **Repo orchestration rules**: this skill orchestrates from the main session. A persona calling another persona is anti-pattern B — see Loading Constraints above.
|
|
238
|
+
|
|
239
|
+
## Verification
|
|
240
|
+
|
|
241
|
+
After applying doubt-driven development:
|
|
242
|
+
|
|
243
|
+
- [ ] Every non-trivial decision (per the definition above) was named explicitly as a CLAIM before standing
|
|
244
|
+
- [ ] At least one fresh-context review per non-trivial artifact (a failing test produced by TDD's RED step satisfies this for behavioral claims, per Interaction with Other Skills)
|
|
245
|
+
- [ ] The reviewer received ARTIFACT + CONTRACT — NOT the CLAIM, NOT your reasoning
|
|
246
|
+
- [ ] The reviewer's prompt was adversarial ("find issues"), not validating ("is it good")
|
|
247
|
+
- [ ] Findings were classified against the artifact text (not rubber-stamped) using the precedence: contract misread / actionable / trade-off / noise
|
|
248
|
+
- [ ] A stop condition was met (trivial findings, 3 cycles, or user override)
|
|
249
|
+
- [ ] In interactive mode, cross-model was **explicitly offered** to the user (regardless of artifact stakes) and the response was acknowledged in the output
|
|
250
|
+
- [ ] In non-interactive mode, cross-model was skipped and the skip was announced
|
|
251
|
+
- [ ] Any external CLI invocation was preceded by a PATH check, a working-binary test, syntax confirmation with the user, and explicit authorization to run
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "git-commit-learning",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "workflow-skill",
|
|
5
|
+
"description": "RPI model (Research → Plan → Implement → Verify) — analyzes git log for patterns and writes AI-learnable commits. PT/EN triggers.",
|
|
6
|
+
"modes": ["analyze", "write"],
|
|
7
|
+
"trigger": "/commit",
|
|
8
|
+
"scope": "public",
|
|
9
|
+
"audience": "development-teams",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"required": [],
|
|
12
|
+
"optional": ["spec-driven"]
|
|
13
|
+
}
|
|
14
|
+
}
|