@vpxa/aikit 0.1.63 → 0.1.65

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 (47) hide show
  1. package/README.md +41 -1
  2. package/package.json +2 -2
  3. package/packages/cli/dist/constants-BjDyZo-l.js +1 -0
  4. package/packages/cli/dist/index.js +4 -4
  5. package/packages/cli/dist/{init-C0VZ6PkG.js → init-DBo2fDoM.js} +1 -1
  6. package/packages/cli/dist/{user-CDSf9aCI.js → user-CXIL0rVI.js} +1 -1
  7. package/packages/flows/dist/index.d.ts +111 -11
  8. package/packages/flows/dist/index.js +2 -2
  9. package/packages/indexer/dist/index.js +1 -1
  10. package/packages/server/dist/index.js +1 -1
  11. package/packages/server/dist/{server-BlBBxAQO.js → server-DFqOZEJC.js} +165 -165
  12. package/scaffold/definitions/agents.mjs +5 -0
  13. package/scaffold/definitions/bodies.mjs +65 -17
  14. package/scaffold/definitions/plugins.mjs +6 -0
  15. package/scaffold/definitions/protocols.mjs +7 -2
  16. package/scaffold/flows/_epilogue/steps/docs-sync/README.md +120 -0
  17. package/scaffold/flows/aikit-advanced/README.md +1 -1
  18. package/scaffold/flows/aikit-advanced/steps/execute/README.md +4 -4
  19. package/scaffold/flows/aikit-advanced/steps/plan/README.md +4 -4
  20. package/scaffold/flows/aikit-advanced/steps/spec/README.md +2 -2
  21. package/scaffold/flows/aikit-advanced/steps/task/README.md +4 -4
  22. package/scaffold/flows/aikit-advanced/steps/verify/README.md +7 -7
  23. package/scaffold/flows/aikit-basic/README.md +1 -1
  24. package/scaffold/flows/aikit-basic/steps/assess/README.md +2 -2
  25. package/scaffold/flows/aikit-basic/steps/implement/README.md +4 -4
  26. package/scaffold/flows/aikit-basic/steps/verify/README.md +4 -4
  27. package/scaffold/general/agents/Debugger.agent.md +8 -3
  28. package/scaffold/general/agents/Documenter.agent.md +46 -6
  29. package/scaffold/general/agents/Frontend.agent.md +7 -2
  30. package/scaffold/general/agents/Implementer.agent.md +8 -3
  31. package/scaffold/general/agents/Orchestrator.agent.md +25 -11
  32. package/scaffold/general/agents/Planner.agent.md +7 -2
  33. package/scaffold/general/agents/Refactor.agent.md +7 -2
  34. package/scaffold/general/agents/Security.agent.md +7 -2
  35. package/scaffold/general/agents/_shared/code-agent-base.md +7 -2
  36. package/scaffold/general/skills/aikit/SKILL.md +52 -15
  37. package/scaffold/general/skills/docs/SKILL.md +509 -0
  38. package/scaffold/general/skills/docs/references/diataxis-anti-patterns.md +147 -0
  39. package/scaffold/general/skills/docs/references/diataxis-compass.md +123 -0
  40. package/scaffold/general/skills/docs/references/diataxis-quadrants.md +192 -0
  41. package/scaffold/general/skills/docs/references/diataxis-quality.md +76 -0
  42. package/scaffold/general/skills/docs/references/diataxis-templates.md +120 -0
  43. package/scaffold/general/skills/docs/references/flow-artifacts-guide.md +70 -0
  44. package/scaffold/general/skills/docs/references/project-knowledge-gotchas.md +32 -0
  45. package/scaffold/general/skills/docs/references/project-knowledge-templates.md +281 -0
  46. package/scaffold/general/skills/docs/references/project-knowledge-workflow.md +80 -0
  47. package/packages/cli/dist/constants-D3v4VDf0.js +0 -1
@@ -0,0 +1,509 @@
1
+ ---
2
+ name: docs
3
+ description: "Living documentation management — Diátaxis framework, docs/ convention, create/update rules, staleness detection, integration with adr-skill and c4-architecture."
4
+ metadata:
5
+ category: cross-cutting
6
+ domain: general
7
+ applicability: on-demand
8
+ inputs: [code-changes, flow-artifacts, architecture]
9
+ outputs: [documentation]
10
+ relatedSkills: [adr-skill, c4-architecture]
11
+ internal: true
12
+ ---
13
+
14
+ # Docs — Living Documentation Skill
15
+
16
+ Manage the `docs/` folder as a single source of truth for project documentation. This skill runs during the mandatory `_docs-sync` epilogue step of every flow, ensuring documentation stays in sync with code changes.
17
+
18
+ ## Principles
19
+
20
+ 1. **Living, not legacy** — Documentation is updated as code changes, never as a separate "docs sprint"
21
+ 2. **One source of truth** — Never duplicate what's in code comments, READMEs, or inline JSDoc
22
+ 3. **Diátaxis framework** — Organize docs into four categories using the two-question compass:
23
+ - **Q1**: Is the reader trying to **do** something (action) or **understand** something (cognition)?
24
+ - **Q2**: Is the reader **learning** (study) or **working** (work)?
25
+ - Action+Study → Tutorial · Action+Work → How-to · Cognition+Work → Reference · Cognition+Study → Explanation
26
+ - See [references/diataxis-compass.md](references/diataxis-compass.md) for the full classification system
27
+ 4. **Minimal but complete** — Create docs only when they add value beyond what code communicates
28
+ 5. **Delegate to specialists** — Architecture diagrams → `c4-architecture` skill. Decision records → `adr-skill`
29
+
30
+ ## Documentation Modes
31
+
32
+ This skill operates in two modes, often combined:
33
+
34
+ ### Source-Only Mode
35
+ Generate documentation from code analysis alone. Used when:
36
+ - Bootstrapping `docs/` for the first time (`produce_knowledge`, `analyze_*` tools)
37
+ - Running outside a flow context (manual documentation refresh)
38
+ - Flow produced no artifacts (auto-skipped design step)
39
+
40
+ ### Flow-Aware Mode (Primary)
41
+ Generate documentation from code changes **plus** flow artifacts. This is the primary mode during `_docs-sync` because every completed flow produces structured artifacts containing design decisions, requirements, and verification results.
42
+
43
+ Flow artifacts are the most valuable documentation input — they capture the *why* behind changes (decisions, constraints, trade-offs, risks) while code only shows the *what*.
44
+
45
+ **Artifact reading sequence:**
46
+ ```
47
+ flow_status() # Get artifactsPath
48
+ find({ pattern: "*.md", path: "<artifactsPath>" }) # Discover all artifacts
49
+ digest({ sources: [ # Compress into working context
50
+ { path: "<found-artifact-1>" },
51
+ { path: "<found-artifact-2>" },
52
+ ...
53
+ ]})
54
+ ```
55
+
56
+ See [references/flow-artifacts-guide.md](references/flow-artifacts-guide.md) for the artifact catalog and artifact-to-documentation mapping.
57
+
58
+ ## AI Kit Tools for Documentation
59
+
60
+ Use these existing AI Kit tools to generate documentation content — never write docs from scratch when a tool can provide the foundation:
61
+
62
+ | Documentation Task | AI Kit Tool | What It Provides |
63
+ |---|---|---|
64
+ | Project overview | `produce_knowledge({ path: "." })` | Comprehensive analysis: structure, patterns, dependencies → `docs/README.md` |
65
+ | Architecture overview | `analyze_structure({ path: "." })` | File tree, package layout, layer organization → `docs/architecture/overview.md` |
66
+ | Architecture diagrams | `analyze_diagram({ path: "." })` | Mermaid diagrams of component relationships → `docs/architecture/` |
67
+ | Dependency map | `analyze_dependencies({ path: "." })` | Import graph, cross-package edges → `docs/architecture/overview.md` dependencies section |
68
+ | Component analysis | `analyze_symbols({ path: "src/component" })` | Exports, classes, interfaces → `docs/architecture/components/{name}.md` |
69
+ | Entry points / API surface | `analyze_entry_points({ path: "." })` | CLI bins, route handlers, main exports → `docs/reference/api.md` |
70
+ | Code patterns | `analyze_patterns({ path: "." })` | Design patterns, conventions → `docs/architecture/overview.md` patterns section |
71
+ | Impact analysis | `blast_radius({ changed_files: [...] })` | What's affected by changes → targeted doc updates |
72
+ | Change detection | `git_context({})` | Recent changes, diff summary → determine which docs need updating |
73
+ | Module graph | `graph({ action: 'neighbors', node_id })` | Who-imports-whom, cross-package dependencies → architecture diagrams |
74
+ | Full audit | `audit({ path: "." })` | Structure + deps + patterns + health + dead symbols → comprehensive docs refresh |
75
+
76
+ ### Tool-First Workflow
77
+
78
+ When creating documentation, always start with tool output, then enhance with human context:
79
+
80
+ ```
81
+ 1. Run the relevant analysis tool(s)
82
+ 2. Use the output as the doc's foundation
83
+ 3. Add: purpose/motivation (why, not just what)
84
+ 4. Add: decision context (link to ADRs)
85
+ 5. Add: cross-references to related docs
86
+ 6. Remove: implementation details visible in code
87
+ ```
88
+
89
+ ## `docs/` Convention
90
+
91
+ ```
92
+ docs/
93
+ ├── README.md ← Project overview + docs index (always exists)
94
+ ├── architecture/
95
+ │ ├── overview.md ← C4 context + container diagrams (c4-architecture skill)
96
+ │ ├── stack.md ← Language, runtime, frameworks, all dependencies
97
+ │ ├── structure.md ← Directory layout, entry points, key files
98
+ │ ├── design.md ← Layers, patterns, data flow
99
+ │ ├── conventions.md ← Naming, formatting, error handling, imports
100
+ │ ├── integrations.md ← External APIs, databases, auth, monitoring
101
+ │ ├── testing.md ← Frameworks, file organization, mocking strategy
102
+ │ ├── concerns.md ← Tech debt, bugs, security risks, perf bottlenecks
103
+ │ └── components/
104
+ │ └── {component-name}.md ← Per-component technical docs
105
+ ├── decisions/ ← Architecture Decision Records (adr-skill)
106
+ │ ├── index.md ← ADR log / table of contents
107
+ │ └── NNN-{title}.md ← Individual ADRs
108
+ ├── guides/
109
+ │ ├── tutorials/ ← Learning-oriented lessons (Diátaxis: Tutorial)
110
+ │ │ └── {topic}.md
111
+ │ └── {topic}.md ← How-to guides for common tasks (Diátaxis: How-To)
112
+ └── reference/
113
+ ├── api.md ← API reference (endpoints, schemas, auth)
114
+ └── configuration.md ← Configuration options and environment variables
115
+ ```
116
+
117
+ ### Directory Purposes
118
+
119
+ | Directory | Diátaxis Quadrant | What Goes Here | When to Create/Update |
120
+ |-----------|-------------------|----------------|----------------------|
121
+ | `architecture/` | Explanation + Reference | C4 diagrams, project knowledge (stack, structure, design, conventions, integrations, testing, concerns), component docs | Initial onboarding, new component, structural change, architecture decision |
122
+ | `decisions/` | Explanation | ADRs — why decisions were made | Non-trivial technical decision (see adr-skill triggers) |
123
+ | `guides/` | How-To | Step-by-step instructions for tasks | New workflow, complex setup, common operations |
124
+ | `guides/tutorials/` | Tutorial | Learning-oriented guided lessons with concrete outcomes | New technology/feature adoption, onboarding new developers |
125
+ | `reference/` | Reference | API docs, config options, data schemas | API change, new config option, schema modification |
126
+
127
+ ## Change-to-Doc Mapping
128
+
129
+ Use this decision tree to determine what documentation action to take after a flow completes:
130
+
131
+ ```
132
+ What changed?
133
+ ├── New component/module/package
134
+ │ ├── Creates public API? → Create docs/architecture/components/{name}.md + update reference/api.md
135
+ │ └── Internal only? → Update docs/architecture/overview.md (component list)
136
+ ├── API change (new endpoint, changed contract, new config)
137
+ │ └── Update docs/reference/api.md or docs/reference/configuration.md
138
+ ├── Architecture/infrastructure decision
139
+ │ └── Delegate to adr-skill → creates/updates docs/decisions/NNN-{title}.md
140
+ ├── Structural/architecture change
141
+ │ └── Delegate to c4-architecture skill → updates docs/architecture/overview.md
142
+ ├── New developer workflow (build, deploy, test pattern)
143
+ │ └── Create or update docs/guides/{topic}.md
144
+ ├── Bug fix
145
+ │ ├── Reveals missing docs? → Create the missing doc
146
+ │ └── Straightforward fix? → No docs update needed
147
+ └── Dependency update / refactor / cleanup
148
+ └── No docs update needed (unless public API changed)
149
+ ```
150
+
151
+ ### Classify by Diátaxis Quadrant
152
+
153
+ After determining the documentation action, classify the target document's quadrant:
154
+
155
+ | Action → Cognition? | Study → Work? | Quadrant | Target Directory |
156
+ |---------------------|---------------|----------|------------------|
157
+ | Action (doing) | Study (learning) | **Tutorial** | `guides/tutorials/` |
158
+ | Action (doing) | Work (applying) | **How-To** | `guides/` |
159
+ | Cognition (understanding) | Work (using) | **Reference** | `reference/` |
160
+ | Cognition (understanding) | Study (grasping) | **Explanation** | `architecture/`, `decisions/` |
161
+
162
+ Use the [Diátaxis Compass](references/diataxis-compass.md) for edge cases and ambiguous content.
163
+
164
+ ## Templates
165
+
166
+ ### Component Doc Template (`docs/architecture/components/{name}.md`)
167
+
168
+ ```markdown
169
+ # {Component Name}
170
+
171
+ ## Purpose
172
+ One-paragraph description of what this component does and why it exists.
173
+
174
+ ## Architecture
175
+ - **Location**: `src/{path}/`
176
+ - **Entry point**: `{file}`
177
+ - **Key dependencies**: {list}
178
+
179
+ ## Public API
180
+ Brief description of the component's public interface.
181
+
182
+ ## Design Decisions
183
+ - Link to relevant ADRs: [ADR-NNN](../../decisions/NNN-{title}.md)
184
+
185
+ ## Data Flow
186
+ How data enters, transforms through, and exits this component.
187
+ ```
188
+
189
+ ### Guide Template (`docs/guides/{topic}.md`)
190
+
191
+ ```markdown
192
+ # How to {Task}
193
+
194
+ ## Prerequisites
195
+ What you need before starting.
196
+
197
+ ## Steps
198
+ 1. Step one
199
+ 2. Step two
200
+ 3. Step three
201
+
202
+ ## Verification
203
+ How to confirm it worked.
204
+
205
+ ## Troubleshooting
206
+ Common issues and solutions.
207
+ ```
208
+
209
+ ### Reference Template (`docs/reference/{topic}.md`)
210
+
211
+ ```markdown
212
+ # {Topic} Reference
213
+
214
+ ## Overview
215
+ Brief description of what this reference covers.
216
+
217
+ ## {Section}
218
+
219
+ | Item | Type | Default | Description |
220
+ |------|------|---------|-------------|
221
+ | ... | ... | ... | ... |
222
+ ```
223
+
224
+ > **Tutorial and Explanation templates**: For the remaining two Diátaxis quadrants, see [references/diataxis-templates.md](references/diataxis-templates.md).
225
+
226
+ ## Integration with Other Skills
227
+
228
+ ### `adr-skill` Integration
229
+ - All ADRs live in `docs/decisions/`
230
+ - When the docs-sync step detects an architecture decision was made during the flow, delegate to `adr-skill`
231
+ - After `adr-skill` creates/updates an ADR, update `docs/decisions/index.md`
232
+ - Cross-reference ADRs from component docs where relevant
233
+
234
+ ### `c4-architecture` Integration
235
+ - Architecture diagrams live in `docs/architecture/`
236
+ - When the docs-sync step detects structural changes (new packages, changed boundaries), delegate to `c4-architecture`
237
+ - Use Mermaid format for docs files (not HTML) — markdown renders in GitHub
238
+ - Reference diagrams from component docs
239
+
240
+ ## Project Knowledge Acquisition
241
+
242
+ Produces seven populated documents in `docs/architecture/` covering everything needed to work effectively on the project — stack, structure, design, conventions, integrations, testing, and concerns.
243
+
244
+ **Only document what is verifiable from files or tool output — never infer or assume.**
245
+
246
+ ### Output Contract
247
+
248
+ All of the following must be true before finishing:
249
+
250
+ 1. All seven files exist in `docs/architecture/`: `stack.md`, `structure.md`, `design.md`, `conventions.md`, `integrations.md`, `testing.md`, `concerns.md`
251
+ 2. Every claim is traceable to source files, config, or AI Kit tool output
252
+ 3. Unknowns are marked `[TODO]`; intent-dependent decisions are marked `[ASK USER]`
253
+ 4. Every document includes a short "Evidence" section with file paths or tool receipts
254
+ 5. Final response includes numbered `[ASK USER]` questions and intent-vs-reality divergences
255
+
256
+ ### Documents
257
+
258
+ | Document | Covers | Primary Tools |
259
+ |----------|--------|---------------|
260
+ | `stack.md` | Language, runtime, frameworks, dependencies, dev tooling | `analyze_dependencies`, `analyze_structure` |
261
+ | `structure.md` | Directory layout, entry points, key files, packages | `analyze_structure`, `analyze_entry_points` |
262
+ | `design.md` | Layers, patterns, data flow, component boundaries | `analyze_structure`, `analyze_patterns`, `analyze_diagram` |
263
+ | `conventions.md` | Naming, formatting, error handling, import conventions | `analyze_patterns`, `search("conventions")` |
264
+ | `integrations.md` | External APIs, databases, auth, monitoring, CI/CD | `analyze_dependencies`, `search("API\|database\|auth")` |
265
+ | `testing.md` | Test frameworks, file organization, mocking, coverage | `analyze_patterns`, `test_run({})`, `search("test")` |
266
+ | `concerns.md` | Tech debt, bugs, security risks, perf, high-churn files | `audit()`, `dead_symbols()`, `git_context()` |
267
+
268
+ Use [references/project-knowledge-templates.md](references/project-knowledge-templates.md) for the standard template of each document.
269
+
270
+ ### Workflow & References
271
+
272
+ Follow the four-phase workflow: **Scan → Investigate → Populate → Validate**.
273
+
274
+ - [references/project-knowledge-workflow.md](references/project-knowledge-workflow.md) — Full 4-phase workflow, investigation tools per document, population rules, focus area mode
275
+ - [references/project-knowledge-gotchas.md](references/project-knowledge-gotchas.md) — Environment gotchas and anti-pattern table
276
+
277
+ ## Architecture Blueprint Generation
278
+
279
+ When bootstrapping `docs/` for the first time or refreshing architecture documentation, generate a comprehensive architecture blueprint. This replaces manual documentation with tool-driven analysis.
280
+
281
+ ### Blueprint Workflow
282
+
283
+ ```
284
+ Step 1: Detect & Analyze
285
+ analyze_structure({ path: "." }) → project layout, packages, layers
286
+ analyze_patterns({ path: "." }) → conventions, design patterns
287
+ analyze_entry_points({ path: "." }) → API surface, CLI entry points
288
+
289
+ Step 2: Map Dependencies
290
+ analyze_dependencies({ path: "." }) → import graph, cross-package edges
291
+ graph({ action: 'find_nodes', name_pattern: '*' }) → module graph nodes
292
+ graph({ action: 'neighbors', node_id: '...' }) → dependency directions
293
+
294
+ Step 3: Visualize
295
+ analyze_diagram({ path: "." }) → Mermaid architecture diagrams
296
+ Delegate to c4-architecture skill → C4 context/container/component views
297
+
298
+ Step 4: Synthesize
299
+ produce_knowledge({ path: "." }) → comprehensive analysis
300
+ Combine outputs into docs/ structure
301
+ ```
302
+
303
+ ### Blueprint Sections
304
+
305
+ The architecture blueprint should cover these areas (adapted from the Architecture Blueprint Generator pattern):
306
+
307
+ #### 1. Architecture Detection & Analysis
308
+ - **Auto-detect**: Project type, framework, architectural pattern (Clean Architecture, Microservices, Layered, etc.)
309
+ - **Tools**: `analyze_structure` → folder organization, `analyze_patterns` → framework detection, `analyze_dependencies` → dependency flow
310
+ - **Output**: `docs/architecture/overview.md` header section
311
+
312
+ #### 2. Architectural Overview
313
+ - Guiding principles from code structure
314
+ - Architectural boundaries and enforcement mechanisms
315
+ - Hybrid patterns or adaptations
316
+ - **Tools**: `produce_knowledge` + `analyze_structure`
317
+ - **Output**: `docs/architecture/overview.md` main body
318
+
319
+ #### 3. Architecture Visualization
320
+ - High-level subsystem diagram
321
+ - Component interaction diagrams
322
+ - Data flow diagrams
323
+ - **Tools**: `analyze_diagram` + `c4-architecture` skill
324
+ - **Output**: `docs/architecture/overview.md` diagrams + `docs/architecture/diagrams/`
325
+
326
+ #### 4. Core Architectural Components
327
+ For each major component:
328
+ - Purpose and responsibility
329
+ - Internal structure
330
+ - Key abstractions
331
+ - Interaction patterns
332
+ - **Tools**: `analyze_symbols({ path: "component/" })` + `compact({ path, query: "exports" })`
333
+ - **Output**: `docs/architecture/components/{name}.md`
334
+
335
+ #### 5. Layers & Dependencies
336
+ - Layer structure as implemented
337
+ - Dependency rules between layers
338
+ - Abstraction mechanisms for separation
339
+ - Circular dependencies or violations
340
+ - **Tools**: `analyze_dependencies` + `graph({ action: 'neighbors' })`
341
+ - **Output**: `docs/architecture/overview.md` layers section
342
+
343
+ #### 6. Cross-Cutting Concerns
344
+ Document implementation patterns for:
345
+ - Error handling & resilience
346
+ - Logging & observability
347
+ - Validation patterns
348
+ - Configuration management
349
+ - **Tools**: `analyze_patterns` + `search({ query: "error handling" })`
350
+ - **Output**: `docs/architecture/overview.md` cross-cutting section
351
+
352
+ #### 7. Testing Architecture
353
+ - Test framework and strategy
354
+ - Test boundary patterns (unit, integration, e2e)
355
+ - Test file conventions
356
+ - **Tools**: `analyze_patterns` + `search({ query: "test" })`
357
+ - **Output**: `docs/guides/testing.md`
358
+
359
+ #### 8. Extension & Evolution
360
+ - How to add features while preserving architecture
361
+ - Component creation patterns
362
+ - Integration patterns for external systems
363
+ - **Tools**: `analyze_entry_points` + `analyze_patterns`
364
+ - **Output**: `docs/guides/contributing.md` or `docs/architecture/overview.md` extension section
365
+
366
+ ## Rules for the `_docs-sync` Epilogue Step
367
+
368
+ When this skill is loaded during the `_docs-sync` epilogue:
369
+
370
+ ### 0. Gather Flow Artifacts
371
+
372
+ Read all available artifacts from the completed flow before assessing code changes:
373
+
374
+ ```
375
+ flow_status() # Get artifactsPath, topic, phase
376
+ find({ pattern: "*.md", path: "<artifactsPath>" }) # Discover all flow artifacts
377
+ digest({ sources: [ # Compress artifacts for context
378
+ { path: "<found-artifact-1>" },
379
+ { path: "<found-artifact-2>" },
380
+ ...
381
+ ]})
382
+ ```
383
+
384
+ Map each discovered artifact to documentation actions using [references/flow-artifacts-guide.md](references/flow-artifacts-guide.md).
385
+
386
+ Read every artifact `find()` returns — different flows produce different files. Focus on artifacts that contain decisions, requirements, and verification results; skip artifacts that only repeat completed work.
387
+
388
+ If `flow_status()` returns no active flow or no artifacts directory exists, skip this step (source-only mode).
389
+
390
+ ### 1. Assess Changes (tool-driven)
391
+
392
+ ```
393
+ git_context({}) # What changed in this flow
394
+ blast_radius({ changed_files: ["changed-files"] }) # Impact analysis
395
+ ```
396
+
397
+ Use the output to classify changes against the Change-to-Doc Mapping decision tree.
398
+
399
+ ### 1b. Classify Target Quadrant
400
+
401
+ For each doc action identified in Step 1, determine the Diátaxis quadrant:
402
+
403
+ 1. Ask: **Action or Cognition?** Is the reader doing something or understanding something?
404
+ 2. Ask: **Study or Work?** Is the reader learning or applying?
405
+ 3. Match the answer pair to a quadrant → pick the target directory
406
+ 4. If ambiguous → consult [references/diataxis-compass.md](references/diataxis-compass.md) for edge cases
407
+
408
+ Run the [quality checklist](references/diataxis-quality.md) against any doc created or substantially modified.
409
+
410
+ ### 2. Apply the Mapping
411
+
412
+ Follow the Change-to-Doc Mapping decision tree above to determine required documentation actions.
413
+
414
+ ### 3. Bootstrap `docs/` If Needed (tool-driven)
415
+
416
+ If `docs/` doesn't exist, run the full Architecture Blueprint workflow:
417
+
418
+ ```
419
+ # Generate content with tools
420
+ produce_knowledge({ path: "." }) # → docs/README.md foundation
421
+ analyze_structure({ path: "." }) # → docs/architecture/overview.md structure section
422
+ analyze_diagram({ path: "." }) # → docs/architecture/ Mermaid diagrams
423
+ analyze_dependencies({ path: "." }) # → docs/architecture/overview.md dependency section
424
+ analyze_entry_points({ path: "." }) # → docs/reference/api.md foundation
425
+ analyze_patterns({ path: "." }) # → docs/architecture/overview.md patterns section
426
+
427
+ # Create the docs/ tree
428
+ docs/
429
+ ├── README.md ← From produce_knowledge output + project context
430
+ ├── architecture/
431
+ │ ├── overview.md ← From analyze_structure + analyze_dependencies + analyze_diagram
432
+ │ └── components/ ← From analyze_symbols per major component
433
+ ├── decisions/
434
+ │ └── index.md ← ADR log (delegate to adr-skill)
435
+ ├── guides/
436
+ │ └── testing.md ← From analyze_patterns test info
437
+ └── reference/
438
+ └── api.md ← From analyze_entry_points
439
+ ```
440
+
441
+ ### 4. Update Existing Docs (tool-assisted)
442
+
443
+ - Use `compact({ path: "docs/existing.md", query: "section to update" })` to read the current section
444
+ - Use `blast_radius` output to identify which sections need updating
445
+ - **Don't rewrite** — update relevant sections, preserve existing content
446
+ - **Don't duplicate** — reference code comments/READMEs instead of copying
447
+
448
+ ### 5. Delegate When Appropriate
449
+
450
+ - Architecture decisions → `adr-skill` → `docs/decisions/`
451
+ - Architecture diagrams → `c4-architecture` skill → `docs/architecture/`
452
+ - Blueprint refresh → Run Blueprint Workflow above
453
+
454
+ ### 6. Update the Index
455
+
456
+ If docs were added/removed, update `docs/README.md` index.
457
+
458
+ ### 7. Skip If Nothing Changed
459
+
460
+ If the flow's changes don't warrant doc updates (e.g., pure bug fix with no revelations), report "No documentation updates needed" and move on.
461
+
462
+ ## Writing Style
463
+
464
+ Follow these rules when generating documentation content. Adapted from *The Elements of Agent Style* (CC BY 4.0, Yue Zhao) and classic writing authorities.
465
+
466
+ ### Clarity and Precision
467
+ - **Concrete over abstract** — Use specific terms, not vague language ("the retry handler" not "the relevant component")
468
+ - **No needless words** — Cut filler; every sentence earns its place
469
+ - **Active voice when the agent matters** — "The scheduler retries failed jobs" not "Failed jobs are retried"
470
+ - **Affirmative form** — State what something does, not what it does not do (unless a warning)
471
+ - **Claims match evidence** — Do not overstate or understate; back factual claims with file paths or tool output
472
+
473
+ ### Structure
474
+ - **Parallel structure** — Express coordinate ideas in similar form (consistent table columns, consistent list grammar)
475
+ - **Stress position** — Place the important information at the end of the sentence
476
+ - **Sentence variety** — Break sentences over 30 words; vary length to maintain rhythm
477
+ - **Bullets only for genuine lists** — Do not convert flowing prose into bullet points; two items or a sentence do not need bullets
478
+
479
+ ### AI-Tell Avoidance
480
+ - **No dying metaphors** — Avoid "cutting-edge", "leverages", "streamlines", "robust", "seamless"
481
+ - **No transition-word openers** — Do not start paragraphs with "Additionally", "Furthermore", "Moreover"
482
+ - **No em-dash overuse** — Use commas, semicolons, or separate sentences instead
483
+ - **No summary closers** — Do not end every paragraph by restating what it just said
484
+ - **Consistent terminology** — Pick one term and use it throughout; do not alternate synonyms for variety
485
+
486
+ ## Anti-Patterns
487
+
488
+ ### Documentation Maintenance
489
+ - ❌ Documenting implementation details that are obvious from code
490
+ - ❌ Creating docs for every small change (use the mapping tree)
491
+ - ❌ Duplicating information already in code comments or README files
492
+ - ❌ Writing docs that will be immediately outdated (e.g., exact version numbers)
493
+ - ❌ Creating empty placeholder docs "for later"
494
+ - ❌ Rewriting existing docs from scratch instead of updating sections
495
+
496
+ ### Quadrant Mixing (Diátaxis)
497
+ - ❌ **Tutorial with Explanation** — conceptual paragraphs between steps → extract "why" to Explanation doc, link from tutorial
498
+ - ❌ **How-To that Teaches** — "Let's learn..." framing in a task guide → assume competence, link prerequisites
499
+ - ❌ **Reference with Narrative** — opinions in API tables ("I recommend...") → strip opinions to Explanation doc
500
+ - ❌ **Explanation with Procedures** — numbered steps in a conceptual doc → move procedures to How-To
501
+ - ❌ **Mixed-Mode Document** — one doc serving multiple quadrants → split into separate documents per quadrant
502
+ - See [references/diataxis-anti-patterns.md](references/diataxis-anti-patterns.md) for detection signals, counterexamples, and blur zones
503
+
504
+ ### Project Knowledge
505
+ - See [references/project-knowledge-gotchas.md](references/project-knowledge-gotchas.md) for environment gotchas and anti-pattern table
506
+
507
+ ---
508
+
509
+ *Diátaxis content in this skill and its reference files is adapted from the [Diátaxis framework](https://diataxis.fr/) by Daniele Procida, used under [CC-BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/).*
@@ -0,0 +1,147 @@
1
+ # Diátaxis Anti-Patterns
2
+
3
+ Five common documentation anti-patterns that violate Diátaxis quadrant boundaries. Each pattern includes detection signals, a violation/compliant example pair, and remediation.
4
+
5
+ ## Anti-Pattern 1: Tutorial with Explanation
6
+
7
+ **Detection signals:** "This is because...", conceptual paragraphs between steps, "Let's understand why..." mid-tutorial.
8
+
9
+ **Failure mode:** Learner loses momentum; cognitive load increases; tutorial becomes reference-like.
10
+
11
+ **Violation example:**
12
+
13
+ > Step 4: Exchange the authorization code for a token.
14
+ >
15
+ > The authorization code grant exists because the client and server need a temporary credential that can be verified before issuing a bearer token. In OAuth 2.0, this protects the user agent from exposing long-lived credentials and supports redirect-based trust establishment. The protocol also separates authentication from authorization, which matters when multiple identity providers are involved.
16
+ >
17
+ > Now paste the token into the next command.
18
+
19
+ **Compliant example:**
20
+
21
+ > Step 4: Exchange the authorization code for a token.
22
+ >
23
+ > Note: For why this works, see [Explanation: Authentication Flow].
24
+
25
+ **Fix:** Extract all "why" content to a separate explanation document. Leave only the action and the minimum guidance needed to complete the learning exercise.
26
+
27
+ ## Anti-Pattern 2: How-To That Teaches
28
+
29
+ **Detection signals:** "Let's learn...", "First, understand that...", explanations of basic concepts, beginner-level framing.
30
+
31
+ **Failure mode:** Experienced users waste time reading fundamentals they already know.
32
+
33
+ **Violation example:**
34
+
35
+ > # How to Deploy
36
+ >
37
+ > Before we deploy, let's learn what Docker is. Docker is a containerization platform that packages software with its dependencies so it can run consistently across environments. Containers differ from virtual machines because they share the host kernel...
38
+
39
+ **Compliant example:**
40
+
41
+ > # How to Deploy
42
+ >
43
+ > Prerequisites: Docker installed. If you need setup help, see [Tutorial: Getting Started with Docker].
44
+ >
45
+ > 1. Build the image.
46
+ > 2. Push it to the registry.
47
+ > 3. Roll out the new version.
48
+
49
+ **Fix:** Assume competence. Split foundational teaching into a tutorial for learners and keep the how-to focused on completing a task for someone who already knows the basics.
50
+
51
+ ## Anti-Pattern 3: Reference with Narrative
52
+
53
+ **Detection signals:** First-person voice ("I recommend..."), opinions, step-by-step instructions in a reference table, anecdotes.
54
+
55
+ **Failure mode:** Reference becomes unreliable for quick lookup; opinions pollute facts.
56
+
57
+ **Violation example:**
58
+
59
+ > | Parameter | Type | Description |
60
+ > |-----------|------|-------------|
61
+ > | `retry` | `number` | I usually set this to `5` because it feels safer in production, and in my experience lower values make operators nervous. |
62
+
63
+ **Compliant example:**
64
+
65
+ > | Parameter | Type | Default | Constraints |
66
+ > |-----------|------|---------|-------------|
67
+ > | `retry` | `number` | `3` | Integer, `0-10` |
68
+ >
69
+ > For recommended usage patterns, see [How-To: Retry Configuration Best Practices].
70
+
71
+ **Fix:** Strip opinions into explanation content and move procedures into a how-to. Keep the reference page factual, terse, and optimized for lookup.
72
+
73
+ ## Anti-Pattern 4: Explanation with Procedures
74
+
75
+ **Detection signals:** Numbered steps, imperative commands, "Step 1:", code blocks with instructions to run.
76
+
77
+ **Failure mode:** Reader expecting understanding gets confused by action items; the document serves neither purpose well.
78
+
79
+ **Violation example:**
80
+
81
+ > # Why We Use Microservices
82
+ >
83
+ > Our architecture separates services by deployment boundary and ownership model.
84
+ >
85
+ > Step 1: Create a new service directory under `services/`.
86
+ > Step 2: Copy the standard Dockerfile.
87
+ > Step 3: Register the service in the gateway config.
88
+
89
+ **Compliant example:**
90
+
91
+ > # Why We Use Microservices
92
+ >
93
+ > This architecture reduces coupling between release cycles, lets teams own isolated domains, and supports scaling services unevenly.
94
+ >
95
+ > For the practical workflow, see [How-To: Create a New Service].
96
+
97
+ **Fix:** Move procedures to a how-to or tutorial. Keep explanation documents discursive, interpretive, and focused on reasoning rather than execution.
98
+
99
+ ## Anti-Pattern 5: Mixed-Mode Document
100
+
101
+ **Detection signals:** Multiple quadrant signals in one document; tutorial narration plus reference tables plus explanation prose; a page with more than two distinct purposes.
102
+
103
+ **Failure mode:** The document serves no single purpose well, becomes impossible to maintain, and grows without bound.
104
+
105
+ **Violation example:**
106
+
107
+ > # Authentication Guide
108
+ >
109
+ > OAuth lets users delegate access without sharing passwords. Here is a beginner-friendly walkthrough of the handshake. Below is the full endpoint matrix and token schema. Next, compare session cookies with JWTs and evaluate the security trade-offs. Finally, follow these steps to configure SSO in production.
110
+
111
+ **Compliant example:**
112
+
113
+ Split the material into four documents:
114
+
115
+ 1. Tutorial: Getting Started with Authentication
116
+ 2. Reference: Authentication API
117
+ 3. Explanation: Authentication Architecture Decisions
118
+ 4. How-To: Configure SSO
119
+
120
+ **Fix:** Split the page into separate documents, one per quadrant. Cross-link them so readers can move between learning, doing, understanding, and lookup without mode-switching inside a single page.
121
+
122
+ ## Blur Zones
123
+
124
+ Common cases where the boundary between two quadrants is genuinely ambiguous:
125
+
126
+ | Content | Looks Like | Actually Is | Disambiguation |
127
+ |---------|-----------|-------------|----------------|
128
+ | Getting Started | Tutorial or How-to | Ask whether there is a learning journey. If yes, it is a Tutorial. If it is just "get it running", it is a How-to. | Look for staged learning versus immediate task completion. |
129
+ | Architecture Overview | Explanation or Reference | If it explains why the system is shaped this way, it is Explanation. If it lists components, schemas, or interfaces, it is Reference. | Ask whether the page interprets or inventories. |
130
+ | Troubleshooting | How-to or Reference | If it says "do X when Y happens", it is a How-to. If it is a lookup table of error codes or symptoms, it is Reference. | Ask whether the reader is acting or checking. |
131
+ | Best Practices | Explanation or How-to | If it explains reasoning and trade-offs, it is Explanation. If it gives actionable steps to follow, it is a How-to. | Ask whether the content persuades or instructs. |
132
+ | Changelog | Reference or Explanation | It is almost always Reference because it is a factual record. It only becomes Explanation when it includes design rationale and interpretation. | Ask whether the entry records changes or argues for them. |
133
+
134
+ ## Common Mistakes
135
+
136
+ | Mistake | Why It's Wrong | Fix |
137
+ |---------|----------------|-----|
138
+ | Writing a tutorial that tries to be comprehensive | Tutorials should teach one thing well, not cover everything. | Narrow the scope and link to reference for completeness. |
139
+ | Embedding opinions in reference docs | Reference must be factual and trustworthy. | Move opinions to explanation docs. |
140
+ | Creating empty four-section structures | Diátaxis is a quality framework, not a template to fill. | Let structure emerge from actual content needs. |
141
+ | Making how-to guides that explain everything | How-to assumes competence; explanations break flow. | Link to tutorials for prerequisites and explanations for context. |
142
+ | Writing explanation that lacks opinion or perspective | Good explanation connects concepts and provides insight. | Take a position and explain trade-offs and reasoning. |
143
+ | Trying to classify every page | Some pages, such as README or index pages, are navigation rather than content. | Navigation pages do not need quadrant classification. |
144
+
145
+ ## Attribution
146
+
147
+ This reference adapts concepts from the Diátaxis framework at diataxis.fr and from keithpatton/diataxis-agent-skill. Diátaxis framework content is licensed under CC-BY-SA 4.0; retain attribution and share-alike terms for further adaptations.