@event4u/agent-config 1.31.0 → 1.33.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.
Files changed (37) hide show
  1. package/.agent-src/commands/research/deep.md +149 -0
  2. package/.agent-src/commands/research/report.md +134 -0
  3. package/.agent-src/commands/research.md +43 -13
  4. package/.agent-src/skills/feature-planning/SKILL.md +43 -7
  5. package/.agent-src/skills/judge-test-coverage/SKILL.md +4 -0
  6. package/.agent-src/skills/pest-testing/SKILL.md +13 -6
  7. package/.agent-src/skills/quality-tools/SKILL.md +4 -0
  8. package/.agent-src/skills/refine-prompt/SKILL.md +10 -0
  9. package/.agent-src/skills/refine-ticket/SKILL.md +12 -0
  10. package/.agent-src/skills/subagent-orchestration/SKILL.md +77 -12
  11. package/.agent-src/skills/subagent-orchestration/prompts/README.md +29 -0
  12. package/.agent-src/skills/subagent-orchestration/prompts/do-and-judge-two-stage.md +121 -0
  13. package/.agent-src/skills/subagent-orchestration/prompts/do-and-judge.md +60 -0
  14. package/.agent-src/skills/subagent-orchestration/prompts/do-competitively.md +65 -0
  15. package/.agent-src/skills/subagent-orchestration/prompts/do-in-parallel.md +62 -0
  16. package/.agent-src/skills/subagent-orchestration/prompts/do-in-steps.md +62 -0
  17. package/.agent-src/skills/subagent-orchestration/prompts/do-in-worktrees.md +70 -0
  18. package/.agent-src/skills/subagent-orchestration/prompts/judge-with-debate.md +63 -0
  19. package/.agent-src/skills/subagent-orchestration/schemas/subagent-status.json +63 -0
  20. package/.agent-src/skills/test-driven-development/SKILL.md +25 -13
  21. package/.agent-src/skills/testing-anti-patterns/SKILL.md +7 -0
  22. package/.agent-src/skills/testing-anti-patterns/process-anti-patterns.md +67 -0
  23. package/.claude-plugin/marketplace.json +3 -1
  24. package/CHANGELOG.md +51 -0
  25. package/README.md +3 -3
  26. package/docs/architecture.md +2 -2
  27. package/docs/catalog.md +11 -4
  28. package/docs/contracts/command-clusters.md +1 -1
  29. package/docs/contracts/file-ownership-matrix.json +395 -0
  30. package/docs/getting-started.md +1 -1
  31. package/docs/guidelines/agent-infra/5w2h-analysis.md +260 -0
  32. package/docs/guidelines/agent-infra/critical-thinking.md +156 -0
  33. package/docs/guidelines/agent-infra/first-principles.md +192 -0
  34. package/docs/guidelines/agent-infra/six-hats.md +353 -0
  35. package/docs/guidelines/agent-infra/systems-thinking.md +220 -0
  36. package/package.json +1 -1
  37. package/scripts/check_bite_sized_granularity.py +99 -0
@@ -0,0 +1,149 @@
1
+ ---
2
+ name: research:deep
3
+ cluster: research
4
+ sub: deep
5
+ description: "Read `outline.yaml`, research each item in batches, write per-item JSON validated against the project-local research-schema. No Python runtime, no `~/.claude/` paths."
6
+ disable-model-invocation: true
7
+ skills: [deep-reading-analyst]
8
+ suggestion:
9
+ eligible: true
10
+ trigger_description: "deep research, populate the research scaffold, fill outline.yaml items"
11
+ trigger_context: "user has run `/research <topic>` and now wants per-item depth"
12
+ ---
13
+
14
+ # /research:deep
15
+
16
+ Reads the `outline.yaml` produced by [`/research`](../research.md), launches
17
+ batched per-item research, and writes one JSON per item under
18
+ `{output_dir}/`. Each JSON is self-validated against the
19
+ [`research-schema`](../../contexts/contracts/research-schema.md)
20
+ contract before write — **no `validate_json.py` script, no Python
21
+ runtime, no `~/.claude/` paths**.
22
+
23
+ ## Trigger
24
+
25
+ `/research:deep [--batch-confirm=each|once|auto]`
26
+
27
+ `--batch-confirm` controls user gating between batches:
28
+
29
+ - `each` (default) — confirm before every batch.
30
+ - `once` — confirm only the first batch, then run the rest.
31
+ - `auto` — no confirmation, run all batches (only honoured under
32
+ explicit `/roadmap process-full` autonomy).
33
+
34
+ ## Workflow
35
+
36
+ ### Step 1 — Auto-locate outline
37
+
38
+ Search `$PROJECT_ROOT/agents/research/*/outline.yaml` (single match) or
39
+ ask via numbered options if multiple `outline.yaml` files exist. Read:
40
+
41
+ - `topic`, `topic_slug`, `items[]`, `execution.batch_size`,
42
+ `execution.items_per_agent`, `execution.output_dir` (default
43
+ `./results` relative to the topic dir).
44
+
45
+ ### Step 2 — Resume check
46
+
47
+ Scan `{output_dir}/` for `*.json` files; mark items whose
48
+ `{slug(item.name)}.json` exists as **complete**. Slugify by lowercasing,
49
+ replacing whitespace with `_`, and stripping characters outside
50
+ `[a-z0-9_-]`.
51
+
52
+ ### Step 3 — Batch execution
53
+
54
+ Group remaining items by `batch_size` (each batch holds
55
+ `batch_size × items_per_agent` items at most). For each batch:
56
+
57
+ 1. Show the batch summary: `[N/M] items: a, b, c …`.
58
+ 2. Apply the `--batch-confirm` policy (default `each` — wait for the
59
+ user; `once` after the first; `auto` skips).
60
+ 3. For every item in the batch, run the per-item research using the
61
+ agent's **native web-search** (no `web-search-agent` persona).
62
+
63
+ #### Per-item prompt template
64
+
65
+ Variables in `{xxx}` only — **do not modify structure or wording**.
66
+
67
+ ```text
68
+ ## Task
69
+ Research {item_related_info}, output structured JSON to {output_path}.
70
+
71
+ ## Field definitions
72
+ Read {fields_path} to get all field definitions.
73
+
74
+ ## Output requirements
75
+ 1. Output JSON whose top-level keys map to the categories in
76
+ `fields.yaml` (or to the `{slug(category)}` form — both are
77
+ accepted by `/research:report`).
78
+ 2. Mark uncertain field values with the literal string `[uncertain]`.
79
+ 3. Append an `uncertain` array at the end of the JSON listing all
80
+ field names whose value contains `[uncertain]` or could not be
81
+ sourced.
82
+ 4. All field values in English.
83
+
84
+ ## Output path
85
+ {output_path}
86
+
87
+ ## Validation (no Python, no host paths)
88
+ Self-validate the JSON against
89
+ `<package>/.agent-src.uncompressed/contexts/contracts/research-schema.md`
90
+ in memory before writing. The well-formedness escape hatch is
91
+ `jq -e '.[]' {output_path}` — agent runs it after write and re-tries
92
+ once on failure. Task is complete only after both checks pass.
93
+ ```
94
+
95
+ #### Variable bindings
96
+
97
+ | Variable | Source |
98
+ |---|---|
99
+ | `{topic}` | `outline.yaml#/topic` |
100
+ | `{item_related_info}` | the item's full YAML block (`name`, `category`, `description`, etc.) |
101
+ | `{output_dir}` | `outline.yaml#/execution/output_dir` (default `./results`) |
102
+ | `{fields_path}` | `$PROJECT_ROOT/agents/research/{topic_slug}/fields.yaml` |
103
+ | `{output_path}` | `{output_dir}/{slug(item.name)}.json` |
104
+
105
+ ### Step 4 — Wait and monitor
106
+
107
+ Wait for the current batch to finish (all per-item JSON files written
108
+ + validated). Display per-item status (`✅ done`, `⚠️ uncertain`,
109
+ `❌ failed`) before moving on.
110
+
111
+ ### Step 5 — Summary report
112
+
113
+ After all batches complete, print:
114
+
115
+ - Total items · completed · uncertain · failed.
116
+ - Output directory.
117
+ - Pointer to `/research:report` for the next phase.
118
+
119
+ ## Output paths
120
+
121
+ ```text
122
+ $PROJECT_ROOT/agents/research/{topic_slug}/
123
+ ├── outline.yaml
124
+ ├── fields.yaml
125
+ └── {output_dir}/
126
+ ├── {slug(item_a)}.json
127
+ ├── {slug(item_b)}.json
128
+ └── …
129
+ ```
130
+
131
+ ## Portability notes
132
+
133
+ - **No Python runtime** — validator dropped at adoption, replaced by
134
+ the in-memory JSON-Schema check + `jq -e` escape hatch (`jq` is
135
+ optional; agents skip it gracefully if not installed and report
136
+ `⚠️ jq missing — well-formedness not verified`).
137
+ - **No `~/.claude/` paths** — every reference is rooted at
138
+ `$PROJECT_ROOT/agents/research/`.
139
+ - **No `web-search-agent` persona** — uses the host agent's native
140
+ web-search tool.
141
+
142
+ ## ADOPT citation
143
+
144
+ Adopted from [`Weizhena/Deep-Research-skills`](https://github.com/Weizhena/Deep-Research-skills)
145
+ `@dc18cf4:skills/research-en/research-deep/SKILL.md` · MIT License.
146
+ Refactored:
147
+ dropped Pydantic validator + `~/.claude/` paths + `web-search-agent`
148
+ persona, added `--batch-confirm` flag, kept the per-item prompt
149
+ structure verbatim except for the validation block.
@@ -0,0 +1,134 @@
1
+ ---
2
+ name: research:report
3
+ cluster: research
4
+ sub: report
5
+ description: "Summarise per-item JSON results from `/research:deep` into `report.md`. Agent renders directly + emits an optional `jq` template for deterministic regeneration. No Python runtime."
6
+ disable-model-invocation: true
7
+ skills: [deep-reading-analyst]
8
+ suggestion:
9
+ eligible: true
10
+ trigger_description: "summarise research results, build research report, render outline.yaml results"
11
+ trigger_context: "user has finished `/research:deep` and wants a single markdown summary"
12
+ ---
13
+
14
+ # /research:report
15
+
16
+ Reads the per-item JSON files emitted by
17
+ [`/research:deep`](deep.md), asks the user which fields to surface in
18
+ the table of contents, then writes `{topic_slug}/report.md` directly.
19
+ Optionally emits `{topic_slug}/report-template.jq` so the same report
20
+ can be regenerated deterministically without re-invoking the agent.
21
+
22
+ ## Trigger
23
+
24
+ `/research:report`
25
+
26
+ ## Workflow
27
+
28
+ ### Step 1 — Locate results
29
+
30
+ Find `$PROJECT_ROOT/agents/research/*/outline.yaml` (single match) or
31
+ ask via numbered options. Read `topic`, `topic_slug`, and
32
+ `execution.output_dir`.
33
+
34
+ ### Step 2 — Scan summary-field candidates
35
+
36
+ Read every `*.json` in `{output_dir}/`. Collect field names whose
37
+ values are short / numeric (e.g. `github_stars`,
38
+ `google_scholar_cites`, `swe_bench_score`, `user_scale`, `valuation`,
39
+ `release_date`). Filter:
40
+
41
+ - numeric scalars (int / float),
42
+ - short strings (≤ 40 chars), or
43
+ - ISO-8601 dates.
44
+
45
+ ### Step 3 — Ask user (numbered options)
46
+
47
+ Per [`user-interaction`](../../rules/user-interaction.md) Iron Law,
48
+ offer numbered options for **TOC summary fields** drawn from the
49
+ candidate list. Allow multi-select (e.g., *"1, 3, 5"*) plus *"none"*.
50
+
51
+ ### Step 4 — Render `report.md` directly
52
+
53
+ The agent itself reads each JSON + `fields.yaml` + the user's TOC
54
+ choices, then writes `{topic_slug}/report.md`. **No `generate_report.py`
55
+ script, no Python runtime.**
56
+
57
+ #### Required structure
58
+
59
+ 1. **Title** — `# {topic} — Research Report`.
60
+ 2. **TOC** — every item, anchor-linked, with the chosen summary fields
61
+ inline. Example:
62
+ `1. [GitHub Copilot](#github-copilot) — Stars: 10k · Score: 85%`.
63
+ 3. **Detailed sections** — one `## {item.name}` per item, then
64
+ `### {category}` per category from `fields.yaml`, then field
65
+ key/value rows.
66
+
67
+ #### Rendering rules
68
+
69
+ | Rule | Behaviour |
70
+ |---|---|
71
+ | **JSON shape** | Support flat (`{"name": "…"}`) and nested (`{"basic_info": {"name": "…"}}`) layouts. Lookup order: top-level → category mapping → recursive walk. |
72
+ | **Category mapping** | Maintain a bidirectional alias map between `fields.yaml` category labels and JSON keys (e.g. `"Basic info" ↔ "basic_info"`). Use language-neutral keys, no hard-coded English/Chinese. |
73
+ | **List of dicts** | One row per dict, `key:value` pairs joined with ` \| `. |
74
+ | **Plain list** | Short → comma-joined; long (> 5 items) → bullet list. |
75
+ | **Nested dict** | Recurse; render with `;` between sibling keys or hard-break on long values. |
76
+ | **Long text** | Strings > 100 chars → wrap in a blockquote or insert `<br>`. |
77
+ | **Extra fields** | JSON keys not declared in `fields.yaml` → group under `### Other info`. Filter `_source_file`, `uncertain`, and category-container keys. |
78
+ | **`uncertain` array** | Render each entry on its own line under `### Uncertain fields`; never compress to a one-liner. |
79
+ | **Skip conditions** | Field value contains `[uncertain]` · field name in `uncertain` · value is `null` / empty string. |
80
+
81
+ ### Step 5 — Optional `jq` template (deterministic regenerate)
82
+
83
+ Also emit `{topic_slug}/report-template.jq` capturing the user's TOC
84
+ choices + rendering rules as a `jq` program. Document the regenerate
85
+ command in the file's leading comment:
86
+
87
+ ```text
88
+ # Regenerate report.md without re-invoking the agent:
89
+ # jq -rsf report-template.jq results/*.json > report.md
90
+ # Requires: jq ≥ 1.6. Skip this file if jq is unavailable —
91
+ # `report.md` from step 4 is the canonical artefact.
92
+ ```
93
+
94
+ The template is **best-effort**. Agents that cannot fully express
95
+ the rendering rules in `jq` may emit a stub with a `# TODO` comment
96
+ and a pointer back to step 4. The primary deliverable is `report.md`;
97
+ the `jq` template is a power-user convenience.
98
+
99
+ ### Step 6 — Confirm
100
+
101
+ Print:
102
+
103
+ - Path to `report.md`.
104
+ - Whether `report-template.jq` was emitted.
105
+ - Item count · category count · skipped-uncertain count.
106
+
107
+ ## Output paths
108
+
109
+ ```text
110
+ $PROJECT_ROOT/agents/research/{topic_slug}/
111
+ ├── report.md # primary artefact (agent-rendered)
112
+ └── report-template.jq # optional, deterministic regen
113
+ ```
114
+
115
+ ## Portability notes
116
+
117
+ - **No Python runtime** — upstream's `generate_report.py` was a
118
+ Python conversion script; this port shifts the transformation to
119
+ the agent (primary) + a `jq` template (optional). `augment-portability`
120
+ Iron Law upheld.
121
+ - **No `~/.claude/` paths** — every reference is rooted at
122
+ `$PROJECT_ROOT/agents/research/`.
123
+ - **`jq` is optional** — agents skip the template gracefully and
124
+ surface `⚠️ jq template not emitted` in the summary if generation
125
+ fails or the dependency is missing.
126
+
127
+ ## ADOPT citation
128
+
129
+ Adopted from [`Weizhena/Deep-Research-skills`](https://github.com/Weizhena/Deep-Research-skills)
130
+ `@dc18cf4:skills/research-en/research-report/SKILL.md` · MIT License.
131
+ Refactored: dropped the `generate_report.py` Python script (replaced
132
+ with agent-side rendering + optional `jq` template), kept the
133
+ multilingual category mapping + complex-value formatting rules,
134
+ re-anchored every path under `$PROJECT_ROOT/agents/research/`.
@@ -12,15 +12,43 @@ suggestion:
12
12
 
13
13
  # /research
14
14
 
15
- Entry point for **preliminary research**: pick the objects to study, name
16
- the fields to fill, and emit a YAML scaffold that a downstream deep-research
17
- run will populate. Use this when the user names a topic and wants a
18
- structured plan, not an immediate answer.
15
+ Top-level entry point for the `/research` family. Bare `/research <topic>`
16
+ runs the preliminary scaffolder described under `## Default flow`. Sub-commands
17
+ drive the downstream phases (`:deep` populates the scaffold, `:report`
18
+ summarises the results).
19
19
 
20
20
  Routes thinking-framework support to
21
21
  [`deep-reading-analyst`](../skills/deep-reading-analyst/SKILL.md) (SCQA
22
22
  for narrative structure, mental-models lens for object selection).
23
23
 
24
+ ## Sub-commands
25
+
26
+ | Sub-command | Routes to | Purpose |
27
+ |---|---|---|
28
+ | `/research <topic>` (bare) | this file (`## Default flow`) | Pick objects, define fields, emit `outline.yaml` + `fields.yaml` |
29
+ | `/research:deep` | `commands/research/deep.md` | Read scaffold, research each item in batches, write per-item JSON |
30
+ | `/research:report` | `commands/research/report.md` | Summarise per-item JSON into a markdown report (+ optional `jq` template) |
31
+
32
+ ## Dispatch
33
+
34
+ 1. Parse the user's argument: `/research[:<sub>] [args]`.
35
+ 2. Bare `/research <topic>` → run the `## Workflow` below verbatim.
36
+ 3. `/research:deep` → load `commands/research/deep.md` and follow its
37
+ `## Workflow` section verbatim.
38
+ 4. `/research:report` → load `commands/research/report.md` and follow its
39
+ `## Workflow` section verbatim.
40
+ 5. Unknown sub-command → print the table above and ask which one.
41
+
42
+ ## Rules
43
+
44
+ - **Do NOT commit, push, or open a PR** unless the sub-command explicitly
45
+ authorizes it.
46
+ - **Do NOT chain sub-commands.** One `/research[:<sub>]` per turn.
47
+ - If the user invokes `/research` with no argument, **show the menu** —
48
+ do not guess whether they meant the bare workflow or a sub-command.
49
+ - **Edit `.agent-src.uncompressed/` only.** `.agent-src/` and `.augment/`
50
+ regenerate from source.
51
+
24
52
  ## Trigger
25
53
 
26
54
  `/research <topic>`
@@ -126,17 +154,19 @@ $PROJECT_ROOT/agents/research/{topic_slug}/
126
154
  └── fields.yaml # field definitions
127
155
  ```
128
156
 
129
- ## Out of scope (Phase 2)
157
+ ## Out of scope
130
158
 
131
- `/research-deep`, `/research-add-items`, `/research-add-fields`, and the
132
- Python `validate_json.py` validator are **not** ported in Phase 1 — they
133
- are queued as follow-up cluster sub-commands.
159
+ `/research:add-items` and `/research:add-fields` are **not** ported —
160
+ the existing scaffolder + sub-commands cover the round-trip; the
161
+ upstream incremental-edit commands are too thin to justify their own
162
+ sub-command. Re-run `/research <topic>` and merge by hand if the
163
+ field framework needs a follow-up adjustment.
134
164
 
135
165
  ## ADOPT citation
136
166
 
137
167
  Adopted from [`Weizhena/Deep-Research-skills`](https://github.com/Weizhena/Deep-Research-skills)
138
- @ commit `dc18cf4` · upstream file research/SKILL.md inside skills/research-en/ · MIT License.
139
- Refactored: dropped `web-search-agent` persona (portability), dropped
140
- Pydantic validator (replaced with JSON-Schema reference), repathed
141
- `./` → `$PROJECT_ROOT/agents/research/`, deferred `/research-deep` +
142
- `/research-add-*` to Phase 2.
168
+ `@dc18cf4:skills/research-en/research/SKILL.md` · MIT License.
169
+ Refactored: dropped `web-search-agent` persona
170
+ (portability), dropped Pydantic validator (replaced with JSON-Schema
171
+ reference), repathed `./` → `$PROJECT_ROOT/agents/research/`. Phase 2
172
+ ported `/research:deep` and `/research:report` as cluster sub-commands.
@@ -67,7 +67,7 @@ Explore → Plan → Refine → Roadmap → Implement
67
67
  ### Full workflow (complex features, 7 phases)
68
68
 
69
69
  Use the full workflow for features that span multiple files, require architecture decisions,
70
- or have unclear requirements. Trigger with `/feature-dev`.
70
+ or have unclear requirements. Trigger with `/feature:dev`.
71
71
 
72
72
  ```
73
73
  Discovery → Exploration → Questions → Architecture → Implementation → Review → Summary
@@ -100,7 +100,7 @@ Discovery → Exploration → Questions → Architecture → Implementation →
100
100
  - **Wait for answers before proceeding.**
101
101
 
102
102
  #### Phase 4: Architecture Design
103
- - Design 2-3 impl approaches with different tradeoffs:
103
+ - Design 2-3 implementation approaches with different tradeoffs:
104
104
  - **Minimal changes** — smallest change, maximum reuse.
105
105
  - **Clean architecture** — maintainability, elegant abstractions.
106
106
  - **Pragmatic balance** — speed + quality.
@@ -114,7 +114,7 @@ Discovery → Exploration → Questions → Architecture → Implementation →
114
114
  - Track progress via task list or roadmap.
115
115
 
116
116
  #### Phase 6: Quality Review
117
- - Review the impl for:
117
+ - Review the implementation for:
118
118
  - Simplicity, DRY, elegance.
119
119
  - Bugs and correctness.
120
120
  - Convention adherence.
@@ -136,9 +136,45 @@ Maintain a running **decision log** throughout the planning process. For each de
136
136
  Include the decision log in the feature plan file under a `## Decisions` section.
137
137
  This ensures future developers (and agents) understand the reasoning, not just the outcome.
138
138
 
139
+ ## Bite-sized task granularity (structural roadmaps only)
140
+
141
+ When a feature plan's generated roadmap declares `complexity: structural` in its frontmatter, every task bullet must be self-contained and 2–5 minutes of work. Lightweight roadmaps (the default) skip this section — coarse-grained tasks ("Add login endpoint", "Update tests") are correct when the work is well-scoped and low-risk.
142
+
143
+ Structural roadmap tasks must include:
144
+
145
+ 1. **Exact file path** — `app/Modules/Auth/Services/LoginService.php`, never *"the login service"*.
146
+ 2. **Complete code** — every method body, import, and signature ready to paste; no `// existing code` ellipses, no `…`.
147
+ 3. **Exact command** — `php artisan migrate --path=database/migrations/2026_05_09_create_logins.php`, never *"run the migration"*.
148
+ 4. **Expected output** — what success looks like (`Migrated: 2026_05_09_create_logins`) and the exit code.
149
+ 5. **No placeholders** — angle-bracket placeholders, `TODO`, `FIXME`, `tbd`, and `???` are blockers; resolve before the task ships.
150
+
151
+ The complexity flag lives in the roadmap's YAML frontmatter:
152
+
153
+ ```yaml
154
+ ---
155
+ complexity: structural # triggers bite-sized granularity
156
+ # or
157
+ complexity: lightweight # default — skips bite-sized granularity
158
+ ---
159
+ ```
160
+
161
+ Source: adapted from `obra/superpowers` `writing-plans/SKILL.md` § Task Structure + § No Placeholders (v5.1.0); complexity-gating is our addition (Council Round 1, Q4 — mitigates UX pushback for senior engineers on well-scoped work).
162
+
163
+ ## Self-review (3-scan checklist)
164
+
165
+ Before presenting any plan, run these three scans in order. Each is a fast pass — not a deep review. Failures block presentation; fix and re-scan.
166
+
167
+ 1. **Spec coverage** — every requirement, AC bullet, or constraint from the input has a corresponding section / AC / scope item in the plan. Walk the input top-to-bottom; tick each requirement against the plan; missing items become open questions or new AC.
168
+ 2. **Placeholder / TODO scan** — grep the draft for `<placeholder>`, `TODO`, `FIXME`, `tbd`, `???`, `XXX`. Either resolve them now or surface them in the *Open questions* section. No placeholder ships unflagged.
169
+ 3. **Type / shape consistency** — proposed data structures, API shapes, file paths, and module names match existing codebase patterns. Cite at least one existing file per new structure as the convention anchor.
170
+
171
+ This scan is **separate from** adversarial-review (below). Self-review catches mechanical gaps (missing AC, leftover placeholders, mis-shaped types); adversarial-review challenges the plan's reasoning.
172
+
173
+ Source: adapted from `obra/superpowers` `writing-plans/SKILL.md` § Self-Review (v5.1.0).
174
+
139
175
  ## Adversarial self-review
140
176
 
141
- After completing a plan, run the **`adversarial-review`** skill before presenting it.
177
+ After the 3-scan self-review passes, run the **`adversarial-review`** skill before presenting.
142
178
  Focus on the "Feature plans / Architecture" attack questions. See that skill for the full process.
143
179
 
144
180
  ## Feature plan format
@@ -183,7 +219,7 @@ module's `agents/` directory:
183
219
  Before creating a feature plan, always:
184
220
  1. **Search the codebase** for related code, existing patterns, and affected areas.
185
221
  2. **Read module docs** if the feature touches a specific module.
186
- 3. **Check existing features** in `agents/features/` for overlap or deps.
222
+ 3. **Check existing features** in `agents/features/` for overlap or dependencies.
187
223
 
188
224
  ### Be collaborative
189
225
 
@@ -194,7 +230,7 @@ Before creating a feature plan, always:
194
230
 
195
231
  ### Keep it navigational
196
232
 
197
- Feature plans are decision documents, not impl guides.
233
+ Feature plans are decision documents, not implementation guides.
198
234
  Implementation details belong in roadmaps.
199
235
 
200
236
  ## Output format
@@ -221,6 +257,6 @@ Implementation details belong in roadmaps.
221
257
 
222
258
  - Do NOT create feature plans without user input — always collaborate.
223
259
  - Do NOT skip codebase research — always check what exists.
224
- - Do NOT put impl steps in the feature plan — that's the roadmap's job.
260
+ - Do NOT put implementation steps in the feature plan — that's the roadmap's job.
225
261
  - Do NOT commit or push without permission.
226
262
  - Do NOT duplicate information from `AGENTS.md` or module docs.
@@ -147,6 +147,10 @@ as a follow-up for the implementer — the judge does not execute tools.
147
147
  model-pairing rules (`subagents.judge_model` one tier above implementer).
148
148
  - [`test-driven-development`](../test-driven-development/SKILL.md) —
149
149
  the write-the-test-first workflow that prevents most findings this judge makes.
150
+ - [`testing-anti-patterns`](../testing-anti-patterns/SKILL.md) and its
151
+ sibling [`process-anti-patterns.md`](../testing-anti-patterns/process-anti-patterns.md) —
152
+ prevention layer this judge backs up; rationalization-table row numbers
153
+ are valid review citations.
150
154
  - Sibling judges: [`judge-bug-hunter`](../judge-bug-hunter/SKILL.md),
151
155
  [`judge-security-auditor`](../judge-security-auditor/SKILL.md),
152
156
  [`judge-code-quality`](../judge-code-quality/SKILL.md) — dispatched
@@ -22,6 +22,13 @@ Use this skill for all Laravel testing tasks, especially when working with:
22
22
 
23
23
  This skill extends `php-coder`, `laravel`, and `eloquent`.
24
24
 
25
+ For prevention layers that fire **before** writing a test — TDD
26
+ discipline, mock-isolation gates, and the 12 process rationalizations
27
+ ("I'll add the test after", "patch first, test later") — see
28
+ [`test-driven-development`](../test-driven-development/SKILL.md),
29
+ [`testing-anti-patterns`](../testing-anti-patterns/SKILL.md), and
30
+ [`process-anti-patterns.md`](../testing-anti-patterns/process-anti-patterns.md).
31
+
25
32
  ## Procedure: Write Pest tests
26
33
 
27
34
  1. **Read the base skills first** — apply `php-coder`, `laravel`, and `eloquent` where relevant.
@@ -53,9 +60,9 @@ For bug fixes and new features, prefer test-driven development:
53
60
 
54
61
  ### Why test-first matters
55
62
 
56
- Tests written **after** impl pass immediately. Passing immediately proves nothing:
63
+ Tests written **after** implementation pass immediately. Passing immediately proves nothing:
57
64
  - The test might test the wrong thing.
58
- - The test might test impl, not behavior.
65
+ - The test might test implementation, not behavior.
59
66
  - You never saw it catch the bug — so you don't know if it would.
60
67
 
61
68
  ### Bug fix TDD
@@ -120,7 +127,7 @@ The test proves the fix works AND prevents regression.
120
127
  - For JSON APIs, assert:
121
128
  - exact relevant fields
122
129
  - error structure when applicable
123
- - DB state after the request
130
+ - database state after the request
124
131
  - Do not only assert `200` — verify meaningful behavior.
125
132
 
126
133
  ## Validation tests
@@ -258,7 +265,7 @@ When reviewing or auditing existing tests, check for these anti-patterns:
258
265
 
259
266
  - Do not test private methods directly.
260
267
  - Do not over-mock Laravel internals.
261
- - Do not assert impl details when behavior assertions are enough.
268
+ - Do not assert implementation details when behavior assertions are enough.
262
269
  - Do not write brittle tests tied to formatting or irrelevant response noise.
263
270
  - Do not create giant tests that cover many behaviors at once.
264
271
  - Do not skip authorization or validation coverage for important endpoints.
@@ -285,7 +292,7 @@ When generating Pest tests:
285
292
  - Don't use `readonly` or `final` on Pest test helper classes — it breaks mocking.
286
293
  - Don't add `use` statements for global classes (`Exception`, `DateTimeImmutable`) in Pest files — they're auto-imported.
287
294
  - The model forgets `$this->travel(5)->seconds()` for time-dependent tests — never rely on `now()` differing between lines.
288
- - Parallel tests share the DB — don't assume column values are null unless you explicitly set them.
295
+ - Parallel tests share the database — don't assume column values are null unless you explicitly set them.
289
296
 
290
297
  ## Do NOT
291
298
 
@@ -297,7 +304,7 @@ When generating Pest tests:
297
304
  When generating new tests, focus on:
298
305
  - **Business logic**: calculations, status transitions, validation rules, data transformations
299
306
  - **Edge cases**: null, empty string, zero, negative numbers, boundary values, max length
300
- - **Error paths**: invalid input, missing deps, exception handling
307
+ - **Error paths**: invalid input, missing dependencies, exception handling
301
308
  - **Different code branches**: if/else, early returns, fallback behavior
302
309
 
303
310
  What NOT to test:
@@ -34,6 +34,10 @@ If both PHP and JS/TS files changed → run **both** pipelines.
34
34
  - `verify-before-complete` rule — timing: run quality tools ONCE at the end, not after each edit
35
35
  - `php-coding` rule → PHPStan section — inline ignores, PHPDoc rules
36
36
  - `verify-before-complete` rule — must run quality checks before claiming work is done
37
+ - [`testing-anti-patterns`](../testing-anti-patterns/SKILL.md) and
38
+ [`process-anti-patterns.md`](../testing-anti-patterns/process-anti-patterns.md) —
39
+ test-side rationalizations these tools cannot catch (e.g. "CI is red,
40
+ patch first, test later").
37
41
 
38
42
  ---
39
43
 
@@ -126,6 +126,16 @@ The rubric (5 dimensions × 0–2, sum / 10) and band thresholds
126
126
  (`high ≥ 0.8`, `medium 0.5–0.79`, `low < 0.5`) are owned by
127
127
  `confidence.py`. Do not re-derive them in prose.
128
128
 
129
+ ### 6. Self-review (3-scan checklist)
130
+
131
+ Before emitting the envelope, run these three scans. Each is a fast pass; failure blocks emission.
132
+
133
+ 1. **Spec coverage** — every concrete signal from step 2 (constraints) and step 3 (assumptions) is reflected somewhere in the AC list. Walk the constraint list top-to-bottom; each must anchor at least one AC bullet or appear in the *Assumptions* block.
134
+ 2. **Placeholder / TODO scan** — the rendered envelope contains no `<placeholder>`, `TODO`, `FIXME`, `tbd`, `???`, `XXX` strings. The literal angle-bracket placeholders in the template (`<one sentence …>`, `<bullet>`) must be replaced with concrete text before emission.
135
+ 3. **Type / shape consistency** — every named file, module, route, or command in the AC matches the project's existing conventions. If the prompt names `auth.service.ts` but the codebase uses `AuthService.php`, surface the mismatch in *Assumptions* rather than adopting the prompt's spelling.
136
+
137
+ Source: adapted from `obra/superpowers` `writing-plans/SKILL.md` § Self-Review (v5.1.0).
138
+
129
139
  ## Band-action mapping
130
140
 
131
141
  The `refine` dispatcher step in `directives/backend/refine.py` reads
@@ -250,6 +250,18 @@ open questions surfaced>
250
250
  The "Refined ticket" section is wrapped in a **copyable Markdown box**
251
251
  so the user can grab it verbatim.
252
252
 
253
+ ## Self-review (3-scan checklist)
254
+
255
+ Run these three scans on the rendered output before the close-prompt. Each is a fast pass; failure blocks emission and forces a fix.
256
+
257
+ 1. **Spec coverage** — every AC bullet and constraint from the original ticket (and every parent-AC line surfaced via `fold_parent_context`) is reflected in the rewritten ticket, the Top-5 risks, or the *Open questions* section. Nothing from the input vanishes silently.
258
+ 2. **Placeholder / TODO scan** — no `<placeholder>`, `TODO`, `FIXME`, `tbd`, `???`, `XXX` strings remain. The angle-bracket placeholders in the template (`<rewritten title>`, `<risk>`, `<one paragraph>`) must be replaced with concrete prose before the close-prompt fires.
259
+ 3. **Type / shape consistency** — every module, file, route, or domain term cited in the rewritten ticket and Top-5 risks matches `repo_context.context_docs` and `recent_branches` vocabulary. Invented terms are flagged in *Open questions* or replaced with the project's actual term.
260
+
261
+ Self-review is mechanical (gaps, leftovers, naming drift); persona voices and orchestration outputs handle reasoning critique. Both run; neither replaces the other.
262
+
263
+ Source: adapted from `obra/superpowers` `writing-plans/SKILL.md` § Self-Review (v5.1.0).
264
+
253
265
  ## Close-prompt (mandatory final step)
254
266
 
255
267
  **Probe write access first (Phase F6).** Before rendering, do a