@dzhechkov/skills-feature-adr 1.3.54 → 1.3.55
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/bin/cli.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dzhechkov/skills-feature-adr",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.55",
|
|
4
4
|
"description": "Adaptive Feature Development skill pack for Claude Code — 11-step pipeline with Complexity Router (S/M/L/XL), ADR-driven architecture, 15 agentic-qe skills, multi-agent fleet QE. Supports --full-qe, --full-qe-extended, --with-learning, and --knowledge-extractor modes.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"skills-feature-adr": "./bin/cli.js"
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
"CHANGELOG.md",
|
|
14
14
|
"docs/"
|
|
15
15
|
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"test": "node --test \"test/**/*.test.js\"",
|
|
18
|
+
"prepack": "node -e \"const fs=require('fs');const bad=['.claude','.skills-feature-adr.json'].filter(p=>fs.existsSync(p));if(bad.length){console.error('prepack guard: stray init artifacts in package dir: '+bad.join(', ')+' — remove before packing');process.exit(1)}\""
|
|
19
|
+
},
|
|
16
20
|
"keywords": [
|
|
17
21
|
"claude",
|
|
18
22
|
"claude-code",
|
|
@@ -57,8 +61,5 @@
|
|
|
57
61
|
},
|
|
58
62
|
"publishConfig": {
|
|
59
63
|
"access": "public"
|
|
60
|
-
},
|
|
61
|
-
"scripts": {
|
|
62
|
-
"test": "node --test \"test/**/*.test.js\""
|
|
63
64
|
}
|
|
64
|
-
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,931 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-skills-creator
|
|
3
|
+
description: |
|
|
4
|
+
Use to produce a project-specific pair of code-quality skills:
|
|
5
|
+
an Implementer (pre-implementation quality bar) and a Critic
|
|
6
|
+
(post-implementation reviewer). The pair is grounded in the
|
|
7
|
+
project's own recurring mistakes — extracted from a code audit
|
|
8
|
+
and (when available) a session-history analysis — then generalized
|
|
9
|
+
to principles so it catches the same class of defect in new shapes.
|
|
10
|
+
|
|
11
|
+
Use when: starting in a new codebase where bad code is being
|
|
12
|
+
redone multiple times and you want to install a reusable quality
|
|
13
|
+
bar. Skip when: the project is too small for systemic patterns to
|
|
14
|
+
emerge, or the user only wants a one-off review.
|
|
15
|
+
|
|
16
|
+
Output: two SKILL.md files — the project-tuned pair written to
|
|
17
|
+
`architecture/project-impl/SKILL.md` and `architecture/project-critic/SKILL.md`
|
|
18
|
+
(the R5 role-scaffold paths, wired via `architecture/project-skills.json`),
|
|
19
|
+
plus the audit artifacts they were derived from.
|
|
20
|
+
|
|
21
|
+
Triggers: "сделай скилы implementer/critic", "build a quality bar
|
|
22
|
+
pair", "create code-impl/code-critic skills for this project",
|
|
23
|
+
"продьюсируй пару скилов", "генерализуй наши частые ошибки в
|
|
24
|
+
скилы".
|
|
25
|
+
allowed-tools: Read, Grep, Glob, Edit, Write, Bash, Agent, SendMessage, TaskCreate, TaskUpdate
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
# Code Skills Creator
|
|
29
|
+
|
|
30
|
+
This skill produces the **Implementer + Critic** skill pair for a
|
|
31
|
+
specific project. The pair is the project's reusable code-quality
|
|
32
|
+
bar — Implementer is read **before** writing code, Critic reviews the
|
|
33
|
+
diff **after** it is written and **before** done is claimed.
|
|
34
|
+
|
|
35
|
+
The two skills are asymmetric on purpose:
|
|
36
|
+
- **Implementer** is slightly more abstract: each rule names a class
|
|
37
|
+
of mistake; concrete examples illustrate.
|
|
38
|
+
- **Critic** is slightly more concrete: each check has detection cues,
|
|
39
|
+
explicit false-positive exceptions, and severity.
|
|
40
|
+
|
|
41
|
+
The output of this skill is principle-based. Without the
|
|
42
|
+
generalization step (Phase 6 below), drafts become bug-list linters
|
|
43
|
+
that miss the same defect class in a new shape.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## In the dz harness (grounding + base + output)
|
|
48
|
+
|
|
49
|
+
This skill is an **orchestrator**: it does not invent an audit engine or
|
|
50
|
+
draft the pair from a blank page. It **starts from the generic pair this
|
|
51
|
+
pack already ships** and specializes it with the project's own evidence.
|
|
52
|
+
|
|
53
|
+
- **Grounding (Phases 1–2):** prefer the harness's own signals over a
|
|
54
|
+
from-scratch audit —
|
|
55
|
+
- **`dz mr-rakes --json`** (recurring code rakes mined from the project's
|
|
56
|
+
review corpus: past QE reports + MR/REVIEW files, anti-noise ≥2/≥3
|
|
57
|
+
distinct sources) is the **primary** evidence base — it already IS a
|
|
58
|
+
validated "recurring defects" list. The parallel-critic audit (Phase 1)
|
|
59
|
+
is the fallback when there is no review corpus yet.
|
|
60
|
+
- **`dz retro --json`** (per-session process rakes: claimed-done-without-
|
|
61
|
+
verify, committed-without-verify, n-fix-cycles, ignored-correction)
|
|
62
|
+
supplies the "failure modes" half — use it in place of a from-scratch
|
|
63
|
+
session-analysis in Phase 2.
|
|
64
|
+
- **Base to specialize (Phase 4):** do NOT draft the pair from scratch.
|
|
65
|
+
Start from the **bundled generic `code-impl` + `code-critic`** (this
|
|
66
|
+
pack's **backend-service** defaults — async web / RDB / JWT-JWKS / k8s;
|
|
67
|
+
the principles are portable, the examples assume that stack) and
|
|
68
|
+
SPECIALIZE them: add the project's
|
|
69
|
+
rakes as instances, its god-object freeze table, its reuse-map (from
|
|
70
|
+
`AGENTS.md`), and its invariants/boundaries (from `architecture/vision.md`
|
|
71
|
+
+ `architecture/degradations.md`). The generic pair is the v0; the
|
|
72
|
+
project's evidence turns it into v1, then Phase 6 generalizes to v2.
|
|
73
|
+
- **Output (Phase 8) — propose, never clobber:** write the project-tuned
|
|
74
|
+
pair to **`architecture/project-critic/SKILL.md`** and
|
|
75
|
+
**`architecture/project-impl/SKILL.md`** (the R5 role-scaffold paths), and
|
|
76
|
+
point the `critic` / `impl-bar` roles in `architecture/project-skills.json`
|
|
77
|
+
at them. `dz feature-adr-setup` augments the manifest (adds roles without
|
|
78
|
+
clobbering others); `dz project-skills` is read-only — it resolves/reports
|
|
79
|
+
the manifest so you can verify the wiring landed. This is
|
|
80
|
+
**augment-never-clobber**: never overwrite the bundled generic base, and
|
|
81
|
+
never overwrite an existing hand-edited project pair — and if `critic`/
|
|
82
|
+
`impl-bar` are already set to other files, treat re-pointing them as a
|
|
83
|
+
clobber too: present a diff and let the owner confirm.
|
|
84
|
+
- **Absent evidence ⇒ ship the generic pair unchanged.** Evidence is absent
|
|
85
|
+
only when **BOTH** grounding sources come up empty: `dz mr-rakes` yields no
|
|
86
|
+
confirmed rakes AND the Phase-1 parallel-critic audit (the fallback for a
|
|
87
|
+
project with no review corpus) surfaces no recurring instances. In that case
|
|
88
|
+
(a fresh or tiny project) do not invent mistakes — hand back the bundled
|
|
89
|
+
generic `code-impl`/`code-critic` unchanged and say so. A bug-list built from
|
|
90
|
+
zero evidence is worse than a clean generic bar.
|
|
91
|
+
|
|
92
|
+
The load-bearing invariant is unchanged and named for QE: **every rake is
|
|
93
|
+
generalized to a CLASS of defect (principle + semantic detection), never a
|
|
94
|
+
list of the specific past bugs** (Phase 6). A pair that is still a bug-list
|
|
95
|
+
linter after Phase 6 has failed its one job.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Notes on portability
|
|
100
|
+
|
|
101
|
+
This skill was distilled from work on a Python/FastAPI/SQLAlchemy/
|
|
102
|
+
LangChain backend with non-English-speaking users; the examples
|
|
103
|
+
inherit that flavor. To run it on a different project:
|
|
104
|
+
|
|
105
|
+
- **Russian quotes** ("слишком конкретно", "не доверяй слепо",
|
|
106
|
+
etc.) are illustrative phrasings of recurring user-feedback
|
|
107
|
+
*patterns*, not literal triggers. The patterns themselves
|
|
108
|
+
(over-specific drafts, uncritical validator trust) are
|
|
109
|
+
language-neutral; substitute your own users' phrasings.
|
|
110
|
+
- **Stack-specific anti-pattern examples** (sync-in-async,
|
|
111
|
+
middleware chains, Pydantic round-trips) are ONE project's
|
|
112
|
+
defect catalogue. Your project has its own — use the audit
|
|
113
|
+
(Phase 1) to surface them, do not transplant this list.
|
|
114
|
+
- **Required tools**: Agent, SendMessage, TaskCreate, TaskUpdate
|
|
115
|
+
in `allowed-tools` are Claude-Code-specific. On a different
|
|
116
|
+
harness (Codex CLI, Aider, Cursor), parallel sub-agents and
|
|
117
|
+
inter-agent messaging may need a different mechanism. The
|
|
118
|
+
*workflow* (parallel critics, validator role specialization,
|
|
119
|
+
convergence tiering) is harness-neutral; only the implementation
|
|
120
|
+
changes.
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## When to use this skill
|
|
125
|
+
|
|
126
|
+
Use when **all** are true:
|
|
127
|
+
- The project has a non-trivial codebase (≥50 source files).
|
|
128
|
+
- Bad-code-needs-redoing is a felt pain — not a hypothetical concern.
|
|
129
|
+
- You have access to either the codebase, or the agent's session
|
|
130
|
+
history, or both. (Both is best; either alone is workable.)
|
|
131
|
+
|
|
132
|
+
Skip when:
|
|
133
|
+
- Single-file experiment / prototype.
|
|
134
|
+
- The user explicitly asked for a one-off review or refactor — that's
|
|
135
|
+
not what this builds.
|
|
136
|
+
- An adequate skill pair already exists; do not re-create from scratch.
|
|
137
|
+
(Audit the existing one and edit if it's misaligned, but starting
|
|
138
|
+
over is rarely the right move.)
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Output
|
|
143
|
+
|
|
144
|
+
The project-tuned pair, written to the R5 role-scaffold paths (propose-confirm; the `critic` / `impl-bar` roles in `architecture/project-skills.json` point here):
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
architecture/project-impl/SKILL.md (the Implementer — impl-bar role)
|
|
148
|
+
architecture/project-critic/SKILL.md (the Critic — critic role)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Plus the evidence base they are grounded in:
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
<project>/plan/code-critique/findings.md (codebase audit)
|
|
155
|
+
<project>/plan/code-critique/sessions/analysis.md (sessions, optional)
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
The evidence files are kept — both skills reference them so any
|
|
159
|
+
future maintainer can see *why* a rule exists.
|
|
160
|
+
|
|
161
|
+
The generated pair lives under `architecture/project-impl/` and
|
|
162
|
+
`architecture/project-critic/` (committed with the repo); the
|
|
163
|
+
`impl-bar`/`critic` roles in `architecture/project-skills.json` reference it,
|
|
164
|
+
so feature-adr folds it into the QE stage automatically. No symlink/deploy
|
|
165
|
+
step is part of this skill.
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Workflow at a glance
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
Phase 1: Codebase audit → findings.md
|
|
173
|
+
Phase 2: Session analysis → analysis.md (via `dz retro --json`)
|
|
174
|
+
Phase 3: Design fix → axis decision (pair, not mode)
|
|
175
|
+
Phase 4: v1 drafts → instance-grounded drafts
|
|
176
|
+
Phase 5: Validate v1 → 4 parallel validators (V1-V4)
|
|
177
|
+
Phase 6: Generalize to v2 → principle-based rewrite
|
|
178
|
+
Phase 7: Validate v2 → 3 parallel validators (VV1-VV3)
|
|
179
|
+
Phase 8: Apply convergent fixes → final SKILL.md files
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
The two heaviest phases (1 and 5/7) use **parallel sub-agents with
|
|
183
|
+
role specialization and cross-validation**. Convergence rule
|
|
184
|
+
(Phase 8): apply a finding only when ≥2 validators converge, OR
|
|
185
|
+
when a solo finding passes the user-goal-alignment filter.
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Phase 1: Codebase audit
|
|
190
|
+
|
|
191
|
+
Goal: produce `plan/code-critique/findings.md` — a catalogue of
|
|
192
|
+
recurring defects with severity, frequency, file-line examples, and
|
|
193
|
+
mitigation direction. This is the **fallback** grounding: run it in full
|
|
194
|
+
when `dz mr-rakes` returned no review corpus, or as a refinement pass over
|
|
195
|
+
the mr-rakes rakes when it did. When mr-rakes already supplied a validated
|
|
196
|
+
rake list, treat that as the evidence base and use this audit to add
|
|
197
|
+
file-line examples and severity the rakes lack.
|
|
198
|
+
|
|
199
|
+
### 1.0 Filesystem discovery (before partitioning)
|
|
200
|
+
|
|
201
|
+
Enumerate the services/packages from the **filesystem**, not from
|
|
202
|
+
memory. A re-run that starts from a remembered "4 backends" will miss
|
|
203
|
+
a service that was added since — e.g. a fifth backend like a
|
|
204
|
+
transitional bridge service — and that whole slice then
|
|
205
|
+
never gets audited.
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
ls -la <parent>/
|
|
209
|
+
for d in <parent>/*/; do
|
|
210
|
+
[ -d "$d/.git" ] && echo "$d"
|
|
211
|
+
done
|
|
212
|
+
find <parent> -maxdepth 2 -name "pyproject.toml" -o -name "go.mod" \
|
|
213
|
+
-o -name "package.json" 2>/dev/null
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
State the discovered list back and **confirm it with the user** —
|
|
217
|
+
they know about repos outside the parent directory you searched. Only
|
|
218
|
+
then partition. (This mirrors `agents-md-creator` Phase 1: discovery
|
|
219
|
+
is from the tree, confirmed with the user.)
|
|
220
|
+
|
|
221
|
+
### 1.1 Partition by area
|
|
222
|
+
|
|
223
|
+
From the confirmed discovery list, identify 6-10 logical areas (one
|
|
224
|
+
per repo, or per major package within a monorepo). Each area becomes
|
|
225
|
+
one critic-agent's slice.
|
|
226
|
+
|
|
227
|
+
For a monorepo: one slice per service (e.g., `backend-A`,
|
|
228
|
+
`backend-B`, `admin`, `frontend`). For a single repo: split by
|
|
229
|
+
top-level package (`api/`, `services/`, `db/`, `auth/`, …).
|
|
230
|
+
|
|
231
|
+
### 1.2 Spawn parallel critic agents
|
|
232
|
+
|
|
233
|
+
One agent per slice, in parallel. Each agent's prompt names:
|
|
234
|
+
- The slice path.
|
|
235
|
+
- The output path (`plan/code-critique/raw/<slice>.md`).
|
|
236
|
+
- The class of defects to look for: god-objects, copy-paste,
|
|
237
|
+
defensive-swallowing, untyped data at boundaries, sync-in-async,
|
|
238
|
+
hand-rolled retry, security gaps (SQL injection, auth shortcuts,
|
|
239
|
+
cred leakage), TOCTOU, dead code, schema-integrity gaps.
|
|
240
|
+
- Required output: each finding with `file:line`, severity, why
|
|
241
|
+
it's bad, mitigation direction. Include a "false positives
|
|
242
|
+
filtered" section.
|
|
243
|
+
- Length budget: ~300-600 lines.
|
|
244
|
+
- The user's verbatim concerns (so the critic agent internalizes
|
|
245
|
+
what the user feels is the real cost — usually some flavor of
|
|
246
|
+
"code we redo multiple times", not "extra .md files lying
|
|
247
|
+
around"). Quote 2-3 phrases verbatim.
|
|
248
|
+
|
|
249
|
+
Run them all in **one Agent invocation block** (parallel, not
|
|
250
|
+
serial — that's how you get throughput). Tell each agent: read,
|
|
251
|
+
do not edit. Read-only.
|
|
252
|
+
|
|
253
|
+
After all agents return: verify each wrote to the named output
|
|
254
|
+
path. If a slice returned garbage (cut-off mid-sentence, wrong
|
|
255
|
+
slice covered, no findings) — re-spawn just that slice with a
|
|
256
|
+
sharpened prompt. Do not proceed to Phase 1.3 with a hole in the
|
|
257
|
+
audit.
|
|
258
|
+
|
|
259
|
+
### 1.3 Validation pass (parallel)
|
|
260
|
+
|
|
261
|
+
Spawn ~3 validator agents, each covering 2-3 slices. Each
|
|
262
|
+
validator:
|
|
263
|
+
- Re-opens the actual source files mentioned in the raw findings.
|
|
264
|
+
- Verifies numerical claims (`86 methods`, not `95`; `19
|
|
265
|
+
occurrences`, not `30+`).
|
|
266
|
+
- Marks findings as `CONFIRMED` / `PARTIAL` / `NEEDS_NUANCE` /
|
|
267
|
+
`REFUTED`.
|
|
268
|
+
|
|
269
|
+
Without this pass, frequency claims drift up; the findings then
|
|
270
|
+
include exaggerated patterns that poison Implementer/Critic design.
|
|
271
|
+
|
|
272
|
+
### 1.4 Synthesize
|
|
273
|
+
|
|
274
|
+
One synthesizer agent (or you, directly) merges raw + validated
|
|
275
|
+
findings into a single `findings.md`:
|
|
276
|
+
- Patterns numbered (Pattern 1, Pattern 2, …).
|
|
277
|
+
- Each: severity, repos affected, frequency estimate (corrected by
|
|
278
|
+
validators), why it's bad, examples (`file:line`), mitigation
|
|
279
|
+
direction, validation note.
|
|
280
|
+
- Top: Executive Summary listing the 5-7 highest-pain points.
|
|
281
|
+
- Bottom: "False Positives Filtered" — what the audit considered
|
|
282
|
+
but rejected.
|
|
283
|
+
- Header: a **measured-on date**. `findings.md` is a dated snapshot,
|
|
284
|
+
not a standing fact — its numbers and instances reflect the tree as
|
|
285
|
+
of that date. When the project later ships major surfaces, the file
|
|
286
|
+
is partial until re-grounded; run the delta-audit refresh (see
|
|
287
|
+
"Incremental refresh / delta-audit") rather than trusting stale
|
|
288
|
+
numbers. Any consumer (the skills, a future maintainer) should read
|
|
289
|
+
the date before relying on a count.
|
|
290
|
+
|
|
291
|
+
This `findings.md` is ground truth from this point on.
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## Phase 2: Session analysis (recommended)
|
|
296
|
+
|
|
297
|
+
Goal: produce `plan/code-critique/sessions/analysis.md` — what
|
|
298
|
+
**actually** went wrong in agent-led development sessions over the
|
|
299
|
+
last N weeks.
|
|
300
|
+
|
|
301
|
+
This phase complements Phase 1: code audit reveals architectural
|
|
302
|
+
defects in the static codebase; session analysis reveals the
|
|
303
|
+
*failure modes* that produced them — done-without-validation, scope
|
|
304
|
+
creep, defensive overshoot, tier-shopping, etc.
|
|
305
|
+
|
|
306
|
+
If session history is unavailable (no Codex/Claude Code logs, or
|
|
307
|
+
fresh project) — skip Phase 2. Skill pair will still work, but the
|
|
308
|
+
"failure modes" half of the principles will be thinner.
|
|
309
|
+
|
|
310
|
+
### 2.1 Run `dz retro` (process rakes)
|
|
311
|
+
|
|
312
|
+
Run **`dz retro --json`** (per-session process rakes) over the recent sessions. It surfaces the recurring PROCESS failure modes (claimed-done-without-verify, committed-without-verify, n-fix-cycles, ignored-correction) as a validated, anti-noise list. Capture its JSON into `plan/code-critique/sessions/analysis.md`. If you want a richer narrative pass, also ask an agent to:
|
|
313
|
+
- Pull last 30 days of sessions (or the relevant time window).
|
|
314
|
+
- Group sessions by topic (skills/feature, search/index, refactor,
|
|
315
|
+
review, etc.) — NOT randomly.
|
|
316
|
+
- Run a **cross-validation pass** (verify quotes against raw
|
|
317
|
+
digests; mark `VERIFIED` / `PARAPHRASED` / `NOT FOUND` /
|
|
318
|
+
`PARTIAL`).
|
|
319
|
+
- Run an **exaggeration check** — dedicated agents whose job is to
|
|
320
|
+
*deflate* overstated frequency claims. "12 явных кейсов" often
|
|
321
|
+
reduces to "3-4 episodes" once duplicates and paraphrased
|
|
322
|
+
reactions are counted once.
|
|
323
|
+
|
|
324
|
+
### 2.2 (Optional) Time-persistence check
|
|
325
|
+
|
|
326
|
+
If the session window is short (1 month), run a **second** analysis
|
|
327
|
+
on an earlier window (months 2-3) to verify patterns hold over
|
|
328
|
+
time. Patterns that are real persist; patterns over-fit to one
|
|
329
|
+
month evaporate.
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
## Phase 3: Design fix — axis decision
|
|
334
|
+
|
|
335
|
+
Before drafting, fix the split axis. The default mistake is to
|
|
336
|
+
split by **task type** (investigate / prod-touching / UI). The
|
|
337
|
+
correct axis is **checkpoint**:
|
|
338
|
+
|
|
339
|
+
- **Implementer** — read **before** writing non-trivial code.
|
|
340
|
+
- **Critic** — invoked **after** the diff exists, before "done".
|
|
341
|
+
|
|
342
|
+
Why: a Critic that's the same agent's working memory at the same
|
|
343
|
+
moment as the Implementer doesn't add a checkpoint; it adds noise.
|
|
344
|
+
Separate agents reading different sources at different moments
|
|
345
|
+
catches things that working memory has rationalized.
|
|
346
|
+
|
|
347
|
+
If the user proposes a different axis (mode/task-type), surface
|
|
348
|
+
this distinction and confirm. Do not silently re-split.
|
|
349
|
+
|
|
350
|
+
### 3.1 What goes in which skill
|
|
351
|
+
|
|
352
|
+
- Hard rules (god-object, no-internal-S2S-auth, no-blocking-on-async,
|
|
353
|
+
…) live in the **Implementer**, restated in the **Critic** as
|
|
354
|
+
detection cues.
|
|
355
|
+
- Anti-patterns (broad-except swallow, hand-rolled retry, untyped
|
|
356
|
+
boundaries, …) — Implementer states the principle (P-numbered);
|
|
357
|
+
Critic gives detection cues + FP exceptions (AP-numbered).
|
|
358
|
+
- Decision gates (3-question gates: env var, defensive check, S2S
|
|
359
|
+
auth, abstraction) live in the **Implementer**.
|
|
360
|
+
- Severity, output structure, calibration steps live in the
|
|
361
|
+
**Critic**.
|
|
362
|
+
- God-object **off-limits table** is duplicated by reference: in
|
|
363
|
+
Implementer it's "Section A of Critic"; in Critic it's the
|
|
364
|
+
authoritative table. Single source.
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
## Phase 4: v1 drafts
|
|
369
|
+
|
|
370
|
+
**Start from the bundled generic pair, do not draft from a blank page.**
|
|
371
|
+
Copy this pack's generic `code-impl` + `code-critic` as the v0 skeleton
|
|
372
|
+
(they already carry the god-object rule, the anti-pattern principle set,
|
|
373
|
+
severity discipline, and the workflow) — then SPECIALIZE with the project's
|
|
374
|
+
evidence. The evidence base is, in priority order:
|
|
375
|
+
1. the `dz mr-rakes` rakes (primary), else
|
|
376
|
+
2. the Phase-1 `plan/code-critique/findings.md` audit (fallback, when there
|
|
377
|
+
was no review corpus).
|
|
378
|
+
|
|
379
|
+
**Early exit:** if BOTH are empty (no confirmed rakes AND no audit findings),
|
|
380
|
+
do NOT specialize and do NOT invent instances — ship the bundled generic pair
|
|
381
|
+
unchanged (per the absent-evidence rule above) and stop here.
|
|
382
|
+
|
|
383
|
+
Otherwise SPECIALIZE: attach each rake/finding as an instance under the
|
|
384
|
+
matching principle, add the project's god-object freeze table (measured), its
|
|
385
|
+
reuse-map (from `AGENTS.md`), and its invariants/boundaries (from
|
|
386
|
+
`architecture/vision.md` **and** `architecture/degradations.md` — the accepted
|
|
387
|
+
degradations tell the Critic which "defects" are sanctioned trade-offs, not
|
|
388
|
+
findings). A rake that matches no existing principle earns a new one; the rest
|
|
389
|
+
just add instances. Save the result as `Implementer v1` and `Critic v1` under
|
|
390
|
+
`plan/code-critique/skills-draft/`. v1 is **instance-grounded**: each
|
|
391
|
+
specialized rule cites concrete files/lines from the evidence, with concrete
|
|
392
|
+
numbers (LOC, method counts, occurrences).
|
|
393
|
+
|
|
394
|
+
Note on scope: the specialized examples below assume a **backend-service**
|
|
395
|
+
stack (async web, RDB, JWKS/JWT auth, k8s/Helm, schema migrations). That is
|
|
396
|
+
the class this factory was tuned on — the *principles* are portable, but a
|
|
397
|
+
project on a different stack must translate the examples, and Phase 6's
|
|
398
|
+
generalization is what makes that translation possible.
|
|
399
|
+
|
|
400
|
+
This is intentional. v1 is too specific on purpose — it makes the
|
|
401
|
+
generalization step (Phase 6) audit-able.
|
|
402
|
+
|
|
403
|
+
### 4.1 Implementer v1 must contain
|
|
404
|
+
|
|
405
|
+
- **Top hard rules** (3-5) — restated at the top so the agent reads
|
|
406
|
+
them even if it skims.
|
|
407
|
+
- **Stack realities** — what's *actually* true in this project
|
|
408
|
+
(sync vs async, version of frameworks, request-scoping, schema
|
|
409
|
+
migration discipline). Generic best-practices that don't apply
|
|
410
|
+
to this stack are documented as **does-not-apply**.
|
|
411
|
+
- **Project invariants** — facts true in the product (a user has
|
|
412
|
+
groups; a context has repos; sessions are request-scoped; etc.)
|
|
413
|
+
that obviate defensive branches.
|
|
414
|
+
- **God-object hard rule** with the off-limits file table.
|
|
415
|
+
- **Reuse map** — for each canonical implementation in the
|
|
416
|
+
codebase (HTTP retry, JWKS cache, git sync, agent auth, run
|
|
417
|
+
persistence, error rendering, TTL cache), point at the canonical
|
|
418
|
+
path and forbid parallel implementations.
|
|
419
|
+
- **Security invariants** — typically 4-6 numbered (e.g., SQL
|
|
420
|
+
parameterization, no auth-shortcut on env flag, security caches
|
|
421
|
+
with TTL+lock+negative, no full-credentials in logs, per-key
|
|
422
|
+
serialization). Project-specific: surface invariants that match
|
|
423
|
+
the project's *actual* threat model, not generic OWASP.
|
|
424
|
+
- **Anti-pattern principles** — typically 15-25 numbered (P1, P2,
|
|
425
|
+
…) including:
|
|
426
|
+
- Defensive exception swallowing.
|
|
427
|
+
- Hand-rolled retry instead of canonical.
|
|
428
|
+
- Blocking I/O on async paths.
|
|
429
|
+
- Untyped data structures across boundaries.
|
|
430
|
+
- Per-endpoint plumbing duplication.
|
|
431
|
+
- Sync↔async or near-twin duplication.
|
|
432
|
+
- Process-global mutation in request path.
|
|
433
|
+
- Fire-and-forget without strong reference.
|
|
434
|
+
- TOCTOU lock release before background work.
|
|
435
|
+
- DB columns without contract (CHECK / FK ondelete / UNIQUE).
|
|
436
|
+
- Defensive overshoot (gate/knob/token without threat model).
|
|
437
|
+
- State/abstraction duplicating existing info ("bandaid").
|
|
438
|
+
- Edge-case blindness sweep (empty/large/concurrent/delete/
|
|
439
|
+
restart/version-skew).
|
|
440
|
+
- Defensive branches against documented invariants.
|
|
441
|
+
- Manual error rendering (`repr(e)`/`str(exc)` to clients).
|
|
442
|
+
- Stale-spec / phasing as bandaid.
|
|
443
|
+
- Cargo cult.
|
|
444
|
+
- **Anti-drift** — major invariants pinned, everything else
|
|
445
|
+
decided by agent without asking. Critical principle; without
|
|
446
|
+
it, agents either ask too much or silently substitute the
|
|
447
|
+
user's terms.
|
|
448
|
+
- Performance — loops over external calls.
|
|
449
|
+
- **Decision discipline** — the 3-question gates (new env var,
|
|
450
|
+
new defensive check, new S2S auth, new abstraction, reuse vs
|
|
451
|
+
write-new).
|
|
452
|
+
- **Production safety** — read-only inventory before action, Helm/
|
|
453
|
+
overlay sync when chart changes, Alembic-only migrations with
|
|
454
|
+
zero-downtime ordering, dev-defaults must not reach prod.
|
|
455
|
+
- **Done-ness criteria** — validator on FINAL code, artefact
|
|
456
|
+
reproduction, sibling sweep, multi-repo coordination, no silent
|
|
457
|
+
deferrals.
|
|
458
|
+
- **Workflow** — the sequence of steps the implementer follows.
|
|
459
|
+
|
|
460
|
+
### 4.2 Critic v1 must contain
|
|
461
|
+
|
|
462
|
+
- **Detection style** preface — "we look for the principle
|
|
463
|
+
violated, in any syntactic shape; same defect, different shape =
|
|
464
|
+
same concern reported once".
|
|
465
|
+
- **Output discipline** — severity ladder (BLOCKING / HIGH /
|
|
466
|
+
MEDIUM / LOW), no padding, suggestions-only at the bottom.
|
|
467
|
+
- **Output structure** in fixed order (god-object → security →
|
|
468
|
+
architectural → anti-patterns → type/contract → edge-case →
|
|
469
|
+
test → process → prod-safety → suggestions → skipped-checks).
|
|
470
|
+
- **Inputs to gather first** — preface naming what the Critic
|
|
471
|
+
needs before reviewing: the diff against base branch, the area
|
|
472
|
+
touched (which repo/package), recent conversation context (was
|
|
473
|
+
anything deferred? was a phasing argument made?). If the diff
|
|
474
|
+
is huge, partition by file/category and proceed — do not skip
|
|
475
|
+
files.
|
|
476
|
+
- **Section A: God-object growth** with off-limits table +
|
|
477
|
+
modification-vs-new-code distinction + FP exceptions
|
|
478
|
+
(decomposition is good, do not flag).
|
|
479
|
+
- **Section B: Security violations** (B1-B6).
|
|
480
|
+
- **Section C: Architectural concerns** (C1-C11-ish).
|
|
481
|
+
- **Section D: Anti-patterns** (AP1-AP13-ish), each with detection
|
|
482
|
+
cue + FP exception + severity.
|
|
483
|
+
- **Section E: Type/contract issues**.
|
|
484
|
+
- **Section F: Edge-case sweep**.
|
|
485
|
+
- **Section G: Test quality**.
|
|
486
|
+
- **Section H: Process / done-ness gaps** (including major-invariant
|
|
487
|
+
drift).
|
|
488
|
+
- **Section I: Production safety**.
|
|
489
|
+
- **Section J: Suggestions only**.
|
|
490
|
+
- **Section K: Skipped checks** (transparency).
|
|
491
|
+
- **Per-invocation calibration** — 6-question self-check before
|
|
492
|
+
returning.
|
|
493
|
+
- **What the Critic does NOT do** — does not run tests, does not
|
|
494
|
+
edit, does not pad.
|
|
495
|
+
|
|
496
|
+
---
|
|
497
|
+
|
|
498
|
+
## Phase 5: Validate v1 — 4 parallel validators
|
|
499
|
+
|
|
500
|
+
Spawn 4 validators **in parallel**, in one Agent block. Each
|
|
501
|
+
validator gets the SAME primary sources (Implementer v1, Critic v1,
|
|
502
|
+
findings.md, analysis.md, the user's verbatim quoted constraints)
|
|
503
|
+
but a DIFFERENT lens. Output: each writes a structured report to
|
|
504
|
+
`plan/code-critique/validation/`.
|
|
505
|
+
|
|
506
|
+
### V1 — Alignment with audit (completeness)
|
|
507
|
+
|
|
508
|
+
Lens: every meaningful pattern in `findings.md` and `analysis.md` is
|
|
509
|
+
either represented in the skill pair or explicitly skipped with
|
|
510
|
+
reason. God-object table is correct (matches measured LOC).
|
|
511
|
+
Reuse-map is correct (canonical paths exist).
|
|
512
|
+
|
|
513
|
+
Output: a coverage matrix (pattern × principle) marking
|
|
514
|
+
`COVERED` / `MENTIONED` / `MISSING`. Missing patterns flagged for
|
|
515
|
+
addition.
|
|
516
|
+
|
|
517
|
+
### V2 — Adversarial FP/FN
|
|
518
|
+
|
|
519
|
+
Lens: for each Critic check, construct **realistic false-positive
|
|
520
|
+
scenarios** (legitimate code that shape-matches the cue but is
|
|
521
|
+
correct). Then inversely scan `findings.md` for **false negatives**
|
|
522
|
+
(real defects the Critic would miss).
|
|
523
|
+
|
|
524
|
+
Output: per-check `FP_RISK` (none / low / medium / high) + list of
|
|
525
|
+
shape-matched-but-legitimate cases that need to be in the FP-
|
|
526
|
+
exception list.
|
|
527
|
+
|
|
528
|
+
### V3 — Semantic discipline + readability
|
|
529
|
+
|
|
530
|
+
Lens: every place the draft says "regex X" / "grep Y" / "look for
|
|
531
|
+
exact token Z" is wrong — describe **what** to find (the intent),
|
|
532
|
+
not **how**. Modern agents pick the mechanism. Mechanical
|
|
533
|
+
instructions box them into brittle detection.
|
|
534
|
+
|
|
535
|
+
Output: list of mechanical instructions found, each with a
|
|
536
|
+
suggested semantic rewrite.
|
|
537
|
+
|
|
538
|
+
### V4 — Implementer↔Critic coherence + retro-validation
|
|
539
|
+
|
|
540
|
+
Lens: build a mapping matrix (Implementer principle ↔ Critic
|
|
541
|
+
section). Every Implementer principle should map to a Critic
|
|
542
|
+
section, and vice versa. Then take 3-5 actual session digests
|
|
543
|
+
(from Phase 2 if available, otherwise pick a recent diff and
|
|
544
|
+
"play it back") and ask: would v1, applied at the right moment,
|
|
545
|
+
have prevented the user's push-back?
|
|
546
|
+
|
|
547
|
+
Output: matrix + retro-validation table.
|
|
548
|
+
|
|
549
|
+
### Cross-validation rule (after V1-V4 return)
|
|
550
|
+
|
|
551
|
+
Build a convergence table:
|
|
552
|
+
- A finding raised by ≥2 validators → **TRUST**, apply.
|
|
553
|
+
- A finding raised by 1 validator + matching a verbatim user
|
|
554
|
+
concern → **TRUST**, apply.
|
|
555
|
+
- A solo finding without user-concern match → **FILTER** through:
|
|
556
|
+
does it align with the user's stated goal? If yes, apply with
|
|
557
|
+
caveat; if no, skip.
|
|
558
|
+
|
|
559
|
+
Skipped findings are listed in the validation summary so they're
|
|
560
|
+
auditable later.
|
|
561
|
+
|
|
562
|
+
---
|
|
563
|
+
|
|
564
|
+
## Phase 6: Generalize to v2
|
|
565
|
+
|
|
566
|
+
This is the **critical** phase and runs **by default** — not
|
|
567
|
+
reactively. Without it, the skills are bug-list linters that miss
|
|
568
|
+
the same defect class in a new syntactic shape.
|
|
569
|
+
|
|
570
|
+
The user's late signal ("слишком конкретно" / "tier 1 это очень
|
|
571
|
+
конкретные ошибки") is the symptom — by the time you hear it, you
|
|
572
|
+
have already shipped a v1 the user has read and disliked. Run
|
|
573
|
+
Phase 6 *before* presenting the skills as ready, treating v1 as a
|
|
574
|
+
deliberate intermediate, not a candidate for delivery.
|
|
575
|
+
|
|
576
|
+
### 6.1 What changes
|
|
577
|
+
|
|
578
|
+
- Each rule is rewritten as **a class of mistake**. Concrete bugs
|
|
579
|
+
from `findings.md` become **illustrations**, not the entire
|
|
580
|
+
detection surface.
|
|
581
|
+
- Mechanical detection cues become semantic. "regex `_API_KEY`"
|
|
582
|
+
becomes "any new identifier suggesting in-cluster service-to-
|
|
583
|
+
service authentication".
|
|
584
|
+
- The asymmetry rule: Implementer rewords toward principle;
|
|
585
|
+
Critic keeps detection cues but adds `FP exception` lines that
|
|
586
|
+
state the legitimate variant.
|
|
587
|
+
- Examples are *named* but not enumerated exhaustively. "There
|
|
588
|
+
are ~280 occurrences in <repo>" → fine; "occurrences are at
|
|
589
|
+
lines 42, 88, 152, 231, …" → not fine.
|
|
590
|
+
- Padding is removed. Low-severity items are demoted or dropped.
|
|
591
|
+
|
|
592
|
+
### 6.2 What stays
|
|
593
|
+
|
|
594
|
+
- All hard rules.
|
|
595
|
+
- The off-limits god-object table (concrete data, not generalizable
|
|
596
|
+
away).
|
|
597
|
+
- The reuse map (canonical implementations are project-specific
|
|
598
|
+
facts).
|
|
599
|
+
- Severity discipline.
|
|
600
|
+
- Workflow.
|
|
601
|
+
|
|
602
|
+
### 6.3 Common pitfalls in v2
|
|
603
|
+
|
|
604
|
+
- **Stripping examples to zero.** Principles without any example
|
|
605
|
+
are abstract; agents can't recognize them in context. Keep 1-2
|
|
606
|
+
examples per principle.
|
|
607
|
+
- **Over-padding "FP exception" with cases that are actually
|
|
608
|
+
defects.** "FP exception: any case where the developer says
|
|
609
|
+
it's OK" — that's not an exception, that's a bypass.
|
|
610
|
+
- **Procedural ceremony.** "Then the implementer invokes the
|
|
611
|
+
critic skill" — orchestration belongs in workflow, not in skill
|
|
612
|
+
body. Remove.
|
|
613
|
+
- **Replacing concrete file:line refs in the off-limits table
|
|
614
|
+
with abstract phrasing.** The table is supposed to be data.
|
|
615
|
+
Keep it as data.
|
|
616
|
+
|
|
617
|
+
Save v2 as `IMPLEMENTER_v2.md` and `CRITIC_v2.md` next to v1.
|
|
618
|
+
|
|
619
|
+
---
|
|
620
|
+
|
|
621
|
+
## Phase 7: Validate v2 — 3 parallel validators
|
|
622
|
+
|
|
623
|
+
Fresh validators (do not re-use V1-V4 even if conceptually
|
|
624
|
+
similar — fresh eyes catch more).
|
|
625
|
+
|
|
626
|
+
### VV1 — Generalization quality
|
|
627
|
+
|
|
628
|
+
Lens: score each rule on instance-grade vs principle-grade. A
|
|
629
|
+
principle states the *class*; an instance states a specific bug.
|
|
630
|
+
Rules that are still instance-grade in v2 are flagged for further
|
|
631
|
+
generalization.
|
|
632
|
+
|
|
633
|
+
Output: per-rule score (`principle` / `partial` / `instance`).
|
|
634
|
+
|
|
635
|
+
### VV2 — Retro-validation
|
|
636
|
+
|
|
637
|
+
Lens: pick 5-7 recent push-back episodes from `analysis.md` (or
|
|
638
|
+
recent commits). For each: "applied at the right moment, would
|
|
639
|
+
v2 have prevented this push-back?" Yes / partial / no.
|
|
640
|
+
|
|
641
|
+
Output: episode × verdict table.
|
|
642
|
+
|
|
643
|
+
### VV3 — Prod-ship readiness
|
|
644
|
+
|
|
645
|
+
Lens: are the skills **sufficient** (cover the real failure
|
|
646
|
+
classes) AND **necessary** (every section is load-bearing —
|
|
647
|
+
removing it would let real defects through)?
|
|
648
|
+
|
|
649
|
+
Output: per-section `sufficient` / `necessary` / both / neither.
|
|
650
|
+
Sections that are neither are candidates for removal.
|
|
651
|
+
|
|
652
|
+
### Cross-validation again
|
|
653
|
+
|
|
654
|
+
Same convergence rule (Phase 5). Apply convergent fixes.
|
|
655
|
+
|
|
656
|
+
---
|
|
657
|
+
|
|
658
|
+
## Phase 8: Apply + finalize (augment, never clobber)
|
|
659
|
+
|
|
660
|
+
Write v2 from the draft folder to the R5 role-scaffold paths:
|
|
661
|
+
|
|
662
|
+
```
|
|
663
|
+
architecture/project-impl/SKILL.md ← from IMPLEMENTER_v2.md
|
|
664
|
+
architecture/project-critic/SKILL.md ← from CRITIC_v2.md
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
**This is augment-never-clobber, not a blind move:**
|
|
668
|
+
|
|
669
|
+
1. **Check for an existing pair first.** If either destination already
|
|
670
|
+
exists, it may be a hand-edited project pair — do NOT overwrite it.
|
|
671
|
+
Render a diff (draft v2 vs the file on disk) and let the owner confirm
|
|
672
|
+
before writing. Only a clean (absent) destination is written directly.
|
|
673
|
+
2. **Never touch the bundled generic base.** The pack's generic
|
|
674
|
+
`code-impl`/`code-critic` are the v0 seed; they are read, never written.
|
|
675
|
+
3. **Wire the roles.** Point `impl-bar` → `architecture/project-impl/SKILL.md`
|
|
676
|
+
and `critic` → `architecture/project-critic/SKILL.md` in
|
|
677
|
+
`architecture/project-skills.json`. Use `dz feature-adr-setup` to augment
|
|
678
|
+
the manifest (it adds roles without clobbering others); if `critic`/
|
|
679
|
+
`impl-bar` already point elsewhere, re-pointing them is a clobber — diff and
|
|
680
|
+
confirm with the owner first. Then run the read-only `dz project-skills` to
|
|
681
|
+
verify the wiring resolved. Without this step the pair is written but
|
|
682
|
+
feature-adr's QE stage never loads it.
|
|
683
|
+
|
|
684
|
+
The skills reference each other (Implementer mentions "Section A
|
|
685
|
+
of Critic carries the authoritative god-object table"; Critic
|
|
686
|
+
mentions "Implementer 7.2 carries the three-question gate"). Make
|
|
687
|
+
sure cross-refs match the actual section numbers in the final v2.
|
|
688
|
+
|
|
689
|
+
Update `findings.md` and `analysis.md` paths in the skills'
|
|
690
|
+
references section.
|
|
691
|
+
|
|
692
|
+
---
|
|
693
|
+
|
|
694
|
+
## Incremental refresh / delta-audit (an existing pair, new surfaces)
|
|
695
|
+
|
|
696
|
+
When the skill pair already exists and the project has shipped a
|
|
697
|
+
handful of **new surfaces** (e.g. a new external write-side integration,
|
|
698
|
+
a source-sync service, a search subsystem) — do NOT re-run the full eight-phase
|
|
699
|
+
pipeline. The expensive part is the v1→v2 generalization (Phases
|
|
700
|
+
4-7); for an **additive** delta it does not need to re-run, because
|
|
701
|
+
the existing principles already generalize and the new surfaces only
|
|
702
|
+
add instances or, at most, one new pattern.
|
|
703
|
+
|
|
704
|
+
Run the delta instead:
|
|
705
|
+
|
|
706
|
+
1. **Scope a delta audit to the new surfaces only.** Spawn critic
|
|
707
|
+
agent(s) over just the new code (the new services / packages /
|
|
708
|
+
write-paths), not the whole tree. Same prompt shape as Phase 1.2,
|
|
709
|
+
narrowed to the delta.
|
|
710
|
+
2. **Append new Patterns to `findings.md`.** Add any genuinely-new
|
|
711
|
+
defect pattern as the next numbered Pattern; attach new `file:line`
|
|
712
|
+
instances to existing Patterns where the surface just adds another
|
|
713
|
+
occurrence. Do not rewrite the existing findings.
|
|
714
|
+
3. **Re-measure the off-limits god-object table.** New large files in
|
|
715
|
+
the delta cross the freeze threshold — add their rows; update LOC
|
|
716
|
+
on any existing entry that grew. This table is data and must stay
|
|
717
|
+
current (it is duplicated by reference: authoritative in the
|
|
718
|
+
Critic, pointed at from the Implementer).
|
|
719
|
+
4. **Re-run only the factual + FP lenses on the touched sections.** The
|
|
720
|
+
**V1 audit-alignment lens** (numbers/paths in the new rows and instances
|
|
721
|
+
are real) and the **V2 adversarial FP/FN lens** (any new detection cue
|
|
722
|
+
must carry its FP exception) are the two that matter for a delta. Skip the
|
|
723
|
+
generalization-quality (VV1) and retro (VV2) lenses unless the delta
|
|
724
|
+
introduced a brand-new *class* of mistake (then it earns a real v1→v2
|
|
725
|
+
pass for that one rule).
|
|
726
|
+
5. **Apply convergent fixes, then update the pair the same way Phase 8
|
|
727
|
+
does — augment, never clobber** (existence check + diff + owner confirm
|
|
728
|
+
before overwriting an existing `architecture/project-*/SKILL.md`).
|
|
729
|
+
|
|
730
|
+
If the delta is not additive — it contradicts an existing principle,
|
|
731
|
+
or the project's stack/threat-model shifted — that is not a delta;
|
|
732
|
+
re-run the relevant full phases.
|
|
733
|
+
|
|
734
|
+
---
|
|
735
|
+
|
|
736
|
+
## Validator prompt template
|
|
737
|
+
|
|
738
|
+
For every parallel validator (Phase 5 or 7), the prompt has the
|
|
739
|
+
same shape:
|
|
740
|
+
|
|
741
|
+
1. **Context** (1 paragraph). What the skills are. What pain they
|
|
742
|
+
address. Why this validation exists.
|
|
743
|
+
2. **Files to read** (explicit absolute paths). Primary
|
|
744
|
+
(Implementer/Critic v1 or v2) + supplementary (`findings.md`,
|
|
745
|
+
`analysis.md`, optional samples of recent diffs / sessions).
|
|
746
|
+
3. **The user's verbatim constraints**. Quoted phrases — Russian
|
|
747
|
+
or English, in the original language — so validators internalize
|
|
748
|
+
intent. Examples: "не давай ложных exaggerated замечаний",
|
|
749
|
+
"tier 1 слишком конкретно", "не доверяй слепо одному агенту".
|
|
750
|
+
4. **Your role** (the lens). One paragraph naming the specific
|
|
751
|
+
slice this validator owns.
|
|
752
|
+
5. **Concrete sub-tasks**, numbered. "Build a coverage matrix",
|
|
753
|
+
"Construct 3 realistic FP scenarios per check", "Score each
|
|
754
|
+
rule on principle-vs-instance scale", etc. Specific is
|
|
755
|
+
non-optional.
|
|
756
|
+
6. **Output format** — what file to write, what structure the
|
|
757
|
+
report has.
|
|
758
|
+
7. **What you do NOT do** — typically: do not edit the skills, do
|
|
759
|
+
not enumerate every defect (focus on patterns), do not pad.
|
|
760
|
+
|
|
761
|
+
Keep the prompt under ~3K tokens. If it grows, the validator drifts.
|
|
762
|
+
|
|
763
|
+
---
|
|
764
|
+
|
|
765
|
+
## Cross-validation tiering rule
|
|
766
|
+
|
|
767
|
+
After all validators in a round return:
|
|
768
|
+
|
|
769
|
+
| Signal | Action |
|
|
770
|
+
|---|---|
|
|
771
|
+
| ≥2 validators converge on a finding | TRUST → apply |
|
|
772
|
+
| 1 validator + matches user verbatim concern | TRUST → apply |
|
|
773
|
+
| 1 validator, no user concern, aligns with stated goal | APPLY with caveat |
|
|
774
|
+
| 1 validator, no user concern, no goal-alignment | SKIP, document why |
|
|
775
|
+
| Validator surfaces inflated frequency claim | DEFLATE before applying |
|
|
776
|
+
| Fewer validators returned than spawned | If 1 is missing → treat as no-vote, proceed; if >half missing → re-spawn the missing role(s) before applying anything (single-perspective application is the failure mode tiering exists to prevent) |
|
|
777
|
+
| Validators contradict each other on the same finding | Surface to user; do not auto-apply either |
|
|
778
|
+
|
|
779
|
+
This tiering prevents two failure modes:
|
|
780
|
+
- **Trust collapse.** Solo findings that contradict each other →
|
|
781
|
+
apply both → contradictory rules. Tiering forces
|
|
782
|
+
cross-validation.
|
|
783
|
+
- **Over-application.** A single anxious validator can over-
|
|
784
|
+
populate the report. Filter through user-goal alignment.
|
|
785
|
+
|
|
786
|
+
---
|
|
787
|
+
|
|
788
|
+
## Asymmetry rule (the principle)
|
|
789
|
+
|
|
790
|
+
The Implementer is **slightly more abstract** than the Critic.
|
|
791
|
+
- Implementer: "Do not catch broad exceptions and silently return
|
|
792
|
+
a default." (principle)
|
|
793
|
+
- Critic: "AP1: try/except where the except branch logs at warning
|
|
794
|
+
and returns None. FP exception: optional-infrastructure
|
|
795
|
+
unavailability with narrow exception class." (principle +
|
|
796
|
+
detection cue + FP exception)
|
|
797
|
+
|
|
798
|
+
Why: at write-time the developer needs to know the *class* of
|
|
799
|
+
mistake to avoid. At review-time the reviewer needs the *cue* to
|
|
800
|
+
spot a violation. Symmetric skills duplicate each other and force
|
|
801
|
+
the developer to scan two long lists.
|
|
802
|
+
|
|
803
|
+
---
|
|
804
|
+
|
|
805
|
+
## Anti-padding rule
|
|
806
|
+
|
|
807
|
+
A rule earns its place by being **load-bearing**: removing it
|
|
808
|
+
would let a real defect class through. Decorative rules
|
|
809
|
+
(stylistic preferences, generic best-practices not tied to this
|
|
810
|
+
stack) are not load-bearing — drop them.
|
|
811
|
+
|
|
812
|
+
The test: after v2, can you point at every rule and name the
|
|
813
|
+
defect class it prevents? If no, the rule is padding.
|
|
814
|
+
|
|
815
|
+
---
|
|
816
|
+
|
|
817
|
+
## Semantic-over-mechanical rule
|
|
818
|
+
|
|
819
|
+
Never instruct the Critic in mechanical terms ("run regex X",
|
|
820
|
+
"grep for token Y", "scan for the literal string Z"). Modern
|
|
821
|
+
agents are competent at picking *how* to detect once they know
|
|
822
|
+
*what* to detect.
|
|
823
|
+
|
|
824
|
+
- ❌ "Search for `except Exception:` followed by `pass`."
|
|
825
|
+
- ✅ "Catching broad exceptions and converting failure into a
|
|
826
|
+
silent default. Detect: any try/except where the except branch
|
|
827
|
+
either passes, logs without diagnostic context, or returns a
|
|
828
|
+
fallback indistinguishable from real success — regardless of
|
|
829
|
+
syntactic shape."
|
|
830
|
+
|
|
831
|
+
This was the single most-corrected category in the original
|
|
832
|
+
project. Mechanical cues miss the same defect in a new syntactic
|
|
833
|
+
form (recursion instead of loop; wrapper helper instead of inline
|
|
834
|
+
try; broad `BaseException` instead of `Exception`).
|
|
835
|
+
|
|
836
|
+
---
|
|
837
|
+
|
|
838
|
+
## Pitfalls catalogue
|
|
839
|
+
|
|
840
|
+
Failure modes the workflow must prevent (each was hit in the
|
|
841
|
+
original project):
|
|
842
|
+
|
|
843
|
+
1. **Splitting by mode/task-type instead of checkpoint.** The
|
|
844
|
+
axis is *when* (pre-impl, post-impl), not *what kind of work*.
|
|
845
|
+
2. **Bug-list-as-skill.** Skipping the v1→v2 generalization step.
|
|
846
|
+
Result: linter that misses the same defect in new shapes.
|
|
847
|
+
2a. **Producing process-hygiene rules instead of code-quality
|
|
848
|
+
rules.** "Don't leave extra .md files", "tidy git status
|
|
849
|
+
before commit", "don't break the dev-server" — these are
|
|
850
|
+
minor in time-cost. The real cost is bad code that gets
|
|
851
|
+
redone multiple times. The skill pair must focus on
|
|
852
|
+
architectural and security defects, not tidiness.
|
|
853
|
+
3. **Symmetric Implementer/Critic.** Both at the same level of
|
|
854
|
+
abstraction → duplication → user reads twice.
|
|
855
|
+
4. **Mechanical instructions** ("regex / grep / specific token").
|
|
856
|
+
Replace with semantic intent.
|
|
857
|
+
5. **Padding low-severity items as if HIGH.** Process hygiene
|
|
858
|
+
crowds out architectural concerns. Use severity discipline.
|
|
859
|
+
6. **Procedural ceremony** ("invoke critic skill", "fill out
|
|
860
|
+
checklist"). Content problems are not fixed by procedure-
|
|
861
|
+
in-skill.
|
|
862
|
+
7. **Bureaucratic spec-fitness gates** ("write acceptance criteria
|
|
863
|
+
for every task"). Replace with anti-drift principle (ask only
|
|
864
|
+
on **major** invariant changes).
|
|
865
|
+
8. **God-object rule stated imprecisely**, so 1-2-line fixes get
|
|
866
|
+
flagged as god-object growth. Rule needs precise
|
|
867
|
+
modification-vs-new-code distinction with examples.
|
|
868
|
+
9. **FP exceptions stated as instances**, not principles.
|
|
869
|
+
"FP exception: file X is allowed" → not generalizable. Use:
|
|
870
|
+
"FP exception: optional-infrastructure unavailability,
|
|
871
|
+
explicit narrow exception class".
|
|
872
|
+
10. **Hallucinated quotes/numbers in analysis.** Cross-validate
|
|
873
|
+
against raw evidence with `VERIFIED` / `PARAPHRASED` /
|
|
874
|
+
`NOT FOUND` markings. Always.
|
|
875
|
+
11. **Over-fitting to one cohort of sessions.** Run a time-
|
|
876
|
+
persistence check on an earlier window if available.
|
|
877
|
+
12. **Trusting a single validator.** Always parallel + convergence
|
|
878
|
+
rule.
|
|
879
|
+
13. **Solo findings applied without filter.** Filter through user-
|
|
880
|
+
goal alignment.
|
|
881
|
+
14. **Validators returning content as text instead of writing
|
|
882
|
+
files.** Specify output paths in the prompt; verify they wrote
|
|
883
|
+
where instructed.
|
|
884
|
+
15. **Single-pass validation.** Always one round on v1; if the
|
|
885
|
+
v1→v2 reframe happens (it usually does), a fresh round on v2
|
|
886
|
+
with different lenses.
|
|
887
|
+
16. **Skill self-invocation in skill body.** "Now invoke the
|
|
888
|
+
critic skill" — orchestration is the parent's job.
|
|
889
|
+
17. **Stripping the off-limits god-object table to "general
|
|
890
|
+
guidance".** The table is data; data is concrete; concrete
|
|
891
|
+
survives the v1→v2 generalization unchanged.
|
|
892
|
+
18. **Ignoring user verbatim corrections.** When the user says
|
|
893
|
+
"слишком конкретно", that is the trigger for v1→v2; do not
|
|
894
|
+
interpret it as a polish request.
|
|
895
|
+
|
|
896
|
+
---
|
|
897
|
+
|
|
898
|
+
## Calibration before finalizing
|
|
899
|
+
|
|
900
|
+
Before declaring the skill pair done, walk this checklist:
|
|
901
|
+
|
|
902
|
+
- [ ] Both skills cite their evidence base (`findings.md`,
|
|
903
|
+
`analysis.md`).
|
|
904
|
+
- [ ] Cross-references between the two skills resolve (Section
|
|
905
|
+
numbers match).
|
|
906
|
+
- [ ] God-object off-limits table is in **one** skill (Critic),
|
|
907
|
+
referenced from the other (Implementer).
|
|
908
|
+
- [ ] Every Critic check has either a `FP exception` line or an
|
|
909
|
+
explicit `no FP exception by design` justification.
|
|
910
|
+
- [ ] Severity ladder is honest — every BLOCKING corresponds to
|
|
911
|
+
a hard rule.
|
|
912
|
+
- [ ] No rule says "regex" / "grep" / "look for the literal
|
|
913
|
+
string".
|
|
914
|
+
- [ ] No procedural ceremony in skill body.
|
|
915
|
+
- [ ] Anti-drift principle is in Implementer (P19-ish), not
|
|
916
|
+
spec-fitness gate.
|
|
917
|
+
- [ ] Final word count: ~600-900 lines per skill is healthy.
|
|
918
|
+
>1500 is bloat; <400 is thin.
|
|
919
|
+
|
|
920
|
+
---
|
|
921
|
+
|
|
922
|
+
## References
|
|
923
|
+
|
|
924
|
+
- Evidence base (primary): `dz mr-rakes --json` (recurring code rakes) +
|
|
925
|
+
`dz retro --json` (per-session process rakes).
|
|
926
|
+
- Base to specialize: the bundled generic `code-impl` + `code-critic` skills
|
|
927
|
+
in this pack — a v2-quality example of the target shape.
|
|
928
|
+
- Boundaries/invariants: `architecture/vision.md` + `architecture/degradations.md`.
|
|
929
|
+
- Audit artifacts (when the parallel-critic fallback runs):
|
|
930
|
+
`plan/code-critique/findings.md` (codebase audit) +
|
|
931
|
+
`plan/code-critique/sessions/analysis.md` (session history if available).
|