@zio.dev/zio-blocks 0.0.32 → 0.0.33
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/guides/query-dsl-extending.md +1 -1
- package/guides/query-dsl-fluent-builder.md +1 -1
- package/guides/query-dsl-reified-optics.md +1 -1
- package/guides/query-dsl-sql.md +1 -1
- package/guides/zio-schema-migration.md +6 -6
- package/index.md +13 -13
- package/package.json +1 -1
- package/reference/codec.md +10 -10
- package/reference/context.md +1 -1
- package/reference/docs.md +1 -1
- package/reference/dynamic-schema.md +7 -7
- package/reference/json-patch.md +2 -2
- package/reference/media-type.md +2 -2
- package/reference/resource-management/resource.md +2 -2
- package/reference/resource-management/scope.md +1 -1
- package/reference/resource-management/wire.md +2 -2
- package/reference/schema-evolution/as.md +7 -7
- package/reference/schema-evolution/into.md +7 -7
- package/reference/schema-expr.md +2 -2
- package/reference/schema.md +1 -1
- package/reference/type-class-derivation.md +1 -1
- package/reference/typeid.md +2936 -583
- package/reference/xml.md +21 -183
- package/ringbuffer.md +1 -1
- package/superpowers/plans/2026-03-19-docs-critique-subagent.md +407 -0
- package/superpowers/specs/2026-03-19-docs-critique-subagent-design.md +222 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# Design: Subagent-Based Documentation Review
|
|
2
|
+
|
|
3
|
+
**Date:** 2026-03-19
|
|
4
|
+
**Status:** Draft
|
|
5
|
+
**Scope:** Add a maker-critic workflow to all documentation creation skills
|
|
6
|
+
|
|
7
|
+
## Problem
|
|
8
|
+
|
|
9
|
+
The existing documentation pipeline has layered mechanical checks (writing style, mdoc conventions, compilation gates) but lacks a content-level reviewer. No system verifies that documentation is clear, technically accurate against source code, complete in coverage, or consistent with related pages. These gaps are caught only by human review — if at all.
|
|
10
|
+
|
|
11
|
+
## Decisions
|
|
12
|
+
|
|
13
|
+
| Decision | Choice |
|
|
14
|
+
|----------|--------|
|
|
15
|
+
| Critique level | Full spectrum — content quality, technical accuracy, completeness, consistency |
|
|
16
|
+
| Trigger scope | All 6 creation skills automatically |
|
|
17
|
+
| Iteration model | Severity-gated — iterate for HIGH/MEDIUM, single pass for LOW |
|
|
18
|
+
| Architecture | Maker-critic agent pair — maker produces and fixes, critic reviews, orchestrator coordinates |
|
|
19
|
+
| Output format | Structured report + commit-per-fix |
|
|
20
|
+
| Critic context | Doc file + source code + related docs |
|
|
21
|
+
| Who fixes | The maker agent — it receives critique and fixes its own work |
|
|
22
|
+
| Agent lifecycles | Maker stays alive across rounds; critic freshly spawned each round |
|
|
23
|
+
|
|
24
|
+
## Architecture: Maker Agent + Critic Agent + Orchestrator
|
|
25
|
+
|
|
26
|
+
Three components:
|
|
27
|
+
|
|
28
|
+
1. **`.claude/agents/docs-critic.md`** — Reusable agent definition with persona, review dimensions, severity rubric, and report format. Read-only tools (`Read`, `Glob`, `Grep`).
|
|
29
|
+
2. **`.claude/skills/docs-critique/SKILL.md`** — Pure coordinator that spawns the maker, spawns the critic, passes messages between them, and manages the iteration loop. Never edits files itself.
|
|
30
|
+
3. **Maker agent** — A general-purpose agent spawned by the orchestrator to run the doc creation skill. Stays alive via `SendMessage` to receive critique and fix its own work.
|
|
31
|
+
|
|
32
|
+
## Agent Definition: `docs-critic`
|
|
33
|
+
|
|
34
|
+
**Persona:** Senior technical writer and Scala developer. Skeptical by default — assumes the doc has problems and looks for them.
|
|
35
|
+
|
|
36
|
+
**Tools:** `Read`, `Glob`, `Grep` only. No write access.
|
|
37
|
+
|
|
38
|
+
**Review Dimensions:**
|
|
39
|
+
|
|
40
|
+
| Dimension | What it checks |
|
|
41
|
+
|-----------|---------------|
|
|
42
|
+
| Content Quality | Clarity, narrative flow, example realism, audience fit, motivation before code |
|
|
43
|
+
| Technical Accuracy | API signatures match source (static text comparison — critic cannot compile), examples correct beyond compilation, described behavior matches implementation |
|
|
44
|
+
| Completeness | Required sections present (detect doc type from path/frontmatter, compare against appropriate section list: `docs-data-type-ref` for reference pages, `docs-how-to-guide` for guides, `docs-tutorial` for tutorials; if doc type cannot be determined, skip required-sections check and note in report), edge cases mentioned, error scenarios covered, cross-references adequate |
|
|
45
|
+
| Consistency | Matches terminology/tone of related docs, no contradictions with other pages |
|
|
46
|
+
|
|
47
|
+
**Severity Rubric:**
|
|
48
|
+
|
|
49
|
+
| Severity | Definition | Iteration? |
|
|
50
|
+
|----------|-----------|------------|
|
|
51
|
+
| HIGH | Factually wrong, misleading, or missing critical content. Reader would be confused or write buggy code. | Yes — must iterate until fixed |
|
|
52
|
+
| MEDIUM | Incomplete, unclear, or inconsistent. Reader could figure it out but shouldn't have to. | Yes — iterate once |
|
|
53
|
+
| LOW | Stylistic nit, minor improvement. Reader wouldn't notice. | No — single pass, fix if easy |
|
|
54
|
+
|
|
55
|
+
**Report Format:**
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
## Docs Critic Report: <filename>
|
|
59
|
+
|
|
60
|
+
### Summary
|
|
61
|
+
<1-2 sentence overall assessment>
|
|
62
|
+
|
|
63
|
+
### Findings
|
|
64
|
+
|
|
65
|
+
#### [HIGH/accuracy] <title>
|
|
66
|
+
**Location:** <section name or line range>
|
|
67
|
+
**Issue:** <what's wrong>
|
|
68
|
+
**Evidence:** <quote from source code or related doc that proves it>
|
|
69
|
+
**Suggested fix:** <concrete suggestion>
|
|
70
|
+
|
|
71
|
+
#### [MEDIUM/completeness] <title>
|
|
72
|
+
...
|
|
73
|
+
|
|
74
|
+
### Verdict
|
|
75
|
+
<APPROVED | ITERATE — N high, M medium issues remain>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Orchestrating Skill: `docs-critique`
|
|
79
|
+
|
|
80
|
+
**Invocation:** `/docs-critique <skill-name> <skill-args>`
|
|
81
|
+
|
|
82
|
+
Example: `/docs-critique docs-data-type-ref Schema`
|
|
83
|
+
|
|
84
|
+
The orchestrator is a pure coordinator. It never reads, writes, or edits documentation files. It only spawns agents and passes messages between them.
|
|
85
|
+
|
|
86
|
+
### Phase 1: Spawn Maker Agent
|
|
87
|
+
|
|
88
|
+
Spawn a general-purpose agent via the `Agent` tool:
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
"Run /docs-data-type-ref for Schema. Complete all steps of the skill.
|
|
92
|
+
Report the path of the generated documentation file when done."
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The maker agent runs the full creation skill (research, write, verify, format, integrate) and returns the doc file path.
|
|
96
|
+
|
|
97
|
+
### Phase 2: Gather Critic Context
|
|
98
|
+
|
|
99
|
+
Using the doc path returned by the maker, the orchestrator prepares context for the critic:
|
|
100
|
+
|
|
101
|
+
1. Extract type names from the doc path/filename
|
|
102
|
+
2. Find corresponding Scala source files and tests (via `Glob`/`Grep`)
|
|
103
|
+
3. Find related doc pages (scan `sidebars.js` for siblings, scan doc for cross-reference links)
|
|
104
|
+
4. Collect these as a list of file paths
|
|
105
|
+
|
|
106
|
+
### Phase 3: Spawn Critic Agent
|
|
107
|
+
|
|
108
|
+
Spawn `docs-critic` agent with a prompt containing:
|
|
109
|
+
|
|
110
|
+
- The doc file path (agent reads it via `Read` tool for live content)
|
|
111
|
+
- List of relevant source file paths (agent reads them itself)
|
|
112
|
+
- List of related doc file paths (agent reads them itself)
|
|
113
|
+
|
|
114
|
+
Passing paths rather than inline content keeps the prompt small and ensures the agent sees live file state.
|
|
115
|
+
|
|
116
|
+
**Error handling:** If the agent returns a response without a `### Findings` section or without a `### Verdict` line, treat it as an agent failure. Retry once. If the second attempt also fails, report the raw response to the user and skip the fix loop.
|
|
117
|
+
|
|
118
|
+
### Phase 4: Triage
|
|
119
|
+
|
|
120
|
+
Parse the critic's report. Sort findings by severity.
|
|
121
|
+
|
|
122
|
+
- Any HIGH or MEDIUM → enter fix loop (Phase 5)
|
|
123
|
+
- Only LOW → send LOWs to maker for single-pass fix, done
|
|
124
|
+
- No findings → APPROVED, done
|
|
125
|
+
|
|
126
|
+
### Phase 5: Fix Loop (severity-gated, max 3 rounds)
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
Round 1:
|
|
130
|
+
Orchestrator → SendMessage to Maker Agent:
|
|
131
|
+
"The critic found these issues. Fix all HIGH and MEDIUM findings.
|
|
132
|
+
One commit per fix (co-located issues may share a commit).
|
|
133
|
+
Commit format: docs(<file-stem>): fix <severity>/<dimension> — <description>"
|
|
134
|
+
Maker fixes and commits
|
|
135
|
+
Orchestrator → Spawn fresh Critic Agent (fresh eyes)
|
|
136
|
+
Critic re-reviews → returns new report
|
|
137
|
+
If new HIGH/MEDIUM → Round 2
|
|
138
|
+
|
|
139
|
+
Round 2:
|
|
140
|
+
Orchestrator → SendMessage to Maker Agent with new findings
|
|
141
|
+
Maker fixes and commits
|
|
142
|
+
Orchestrator → Spawn fresh Critic Agent
|
|
143
|
+
Critic re-reviews
|
|
144
|
+
If still HIGH/MEDIUM → Round 3 (final)
|
|
145
|
+
|
|
146
|
+
Round 3 (cap):
|
|
147
|
+
Orchestrator → SendMessage to Maker Agent with remaining findings
|
|
148
|
+
Maker fixes what it can
|
|
149
|
+
Orchestrator reports any remaining issues to user
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Why fresh critic each round:** The critic gets true fresh eyes on each re-review — no anchoring to its prior findings or assumptions. This catches regressions that a persistent critic might overlook because it "already checked that."
|
|
153
|
+
|
|
154
|
+
**Co-located issues:** When multiple findings target the same paragraph or sentence, the maker combines them into a single commit with the highest severity level. Example: `docs(schema): fix HIGH/accuracy+completeness — correct API and add missing context in Construction`
|
|
155
|
+
|
|
156
|
+
## Data Flow
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
User invokes: /docs-critique docs-data-type-ref Schema
|
|
160
|
+
│
|
|
161
|
+
▼
|
|
162
|
+
Orchestrator (pure coordinator, never edits files)
|
|
163
|
+
│
|
|
164
|
+
├──► Phase 1: Spawn Maker Agent
|
|
165
|
+
│ Maker runs /docs-data-type-ref Schema
|
|
166
|
+
│ Produces doc, commits, returns doc path
|
|
167
|
+
│
|
|
168
|
+
├──► Phase 2: Gather critic context
|
|
169
|
+
│ Find source files, related docs
|
|
170
|
+
│
|
|
171
|
+
├──► Phase 3: Spawn Critic Agent (fresh)
|
|
172
|
+
│ Critic reads doc + sources + related docs
|
|
173
|
+
│ Returns structured report
|
|
174
|
+
│
|
|
175
|
+
├──► Phase 4: Triage by severity
|
|
176
|
+
│ HIGH/MEDIUM found?
|
|
177
|
+
│ │
|
|
178
|
+
│ ┌───┴────┐
|
|
179
|
+
│ │ yes │ no
|
|
180
|
+
│ ▼ ▼
|
|
181
|
+
│ Phase 5 Single-pass LOWs → Done
|
|
182
|
+
│ │
|
|
183
|
+
│ ├──► SendMessage → Maker: "Fix these issues"
|
|
184
|
+
│ │ Maker fixes, commits (one per fix)
|
|
185
|
+
│ │
|
|
186
|
+
│ ├──► Spawn fresh Critic Agent
|
|
187
|
+
│ │ Critic re-reviews
|
|
188
|
+
│ │ APPROVED? → Done
|
|
189
|
+
│ │ ITERATE? → next round (max 3)
|
|
190
|
+
│ │
|
|
191
|
+
│ └──► Round cap reached → report remaining to user
|
|
192
|
+
│
|
|
193
|
+
└──► Final state: APPROVED or remaining issues reported
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Integration Into Creation Skills
|
|
197
|
+
|
|
198
|
+
**No modifications to existing skills.** The orchestrator wraps them — the maker agent runs the skill as-is, then stays alive to receive critique. This is less invasive and keeps existing skills clean.
|
|
199
|
+
|
|
200
|
+
The user invokes `/docs-critique <skill-name> <args>` instead of invoking the creation skill directly. The orchestrator handles the rest.
|
|
201
|
+
|
|
202
|
+
## File Inventory
|
|
203
|
+
|
|
204
|
+
**New files (2):**
|
|
205
|
+
|
|
206
|
+
- `.claude/agents/docs-critic.md` — critic agent definition
|
|
207
|
+
- `.claude/skills/docs-critique/SKILL.md` — orchestrating skill (pure coordinator)
|
|
208
|
+
|
|
209
|
+
**Modified files (0):**
|
|
210
|
+
|
|
211
|
+
No existing skills are modified.
|
|
212
|
+
|
|
213
|
+
## Token Cost Estimate
|
|
214
|
+
|
|
215
|
+
- Maker agent (creation + alive across rounds): ~30-50K tokens
|
|
216
|
+
- Critic agent per spawn: ~15-25K tokens
|
|
217
|
+
- Orchestrator overhead: ~2-5K tokens
|
|
218
|
+
|
|
219
|
+
Typical scenarios:
|
|
220
|
+
- APPROVED on first review: ~50-80K tokens (maker + 1 critic)
|
|
221
|
+
- 1 round of fixes: ~70-110K tokens (maker + 2 critics)
|
|
222
|
+
- 3 rounds (worst case): ~110-150K tokens (maker + 3 critics)
|