@vpxa/aikit 0.1.147 → 0.1.148
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.
|
@@ -1,657 +1,229 @@
|
|
|
1
|
-
function e({
|
|
1
|
+
function e({_blockDocs:e}={}){return[{file:`references/diataxis-reference.md`,content:`# Diátaxis Reference
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Use this reference to classify documentation before writing, choose the right document shape, review quality, and detect quadrant drift early.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Two-Question Compass
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The Diátaxis compass classifies documentation with two questions:
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
| Axis | Question | Poles | What it decides |
|
|
10
|
+
|------|----------|-------|-----------------|
|
|
11
|
+
| Intent | Is the reader trying to do something or understand something? | Action vs Cognition | Whether the document guides work or develops understanding |
|
|
12
|
+
| Context | Is the reader learning or working? | Study vs Work | Whether the document supports acquisition or application |
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
Interpret the axes this way:
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
> Now paste the token into the next command.
|
|
16
|
+
- **Action** means practical doing, following steps, executing work, or completing a task.
|
|
17
|
+
- **Cognition** means understanding, context, concepts, relationships, or meaning.
|
|
18
|
+
- **Study** means the reader is building skill or knowledge.
|
|
19
|
+
- **Work** means the reader is applying existing skill to a real task.
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
Use the compass when a draft feels mixed, when a request could fit more than one document type, or when you need a quick check before creating a new page.
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
>
|
|
23
|
-
> Note: For why this works, see [Explanation: Authentication Flow].
|
|
23
|
+
## Four Quadrants
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
The two axes produce four document forms:
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
| Quadrant | Reader need | Outcome | Typical signals | Avoid |
|
|
28
|
+
|----------|-------------|---------|-----------------|-------|
|
|
29
|
+
| Tutorial | Action + Study | Learner completes a guided lesson | staged steps, visible checkpoints, one skill at a time | reference tables, deep rationale, broad coverage |
|
|
30
|
+
| How-To | Action + Work | Capable user completes a specific task | imperative steps, prerequisites, verification | long teaching sections, conceptual detours |
|
|
31
|
+
| Reference | Cognition + Work | Reader looks up facts quickly | exhaustive tables, schemas, parameters, contracts | opinion, narrative, workflow instruction |
|
|
32
|
+
| Explanation | Cognition + Study | Reader understands why something is shaped this way | trade-offs, concepts, relationships, architecture reasoning | procedural steps, command sequences |
|
|
28
33
|
|
|
29
|
-
|
|
34
|
+
Common blur zones:
|
|
30
35
|
|
|
31
|
-
|
|
36
|
+
| Content | Looks Like | Actually Is | Disambiguation |
|
|
37
|
+
|---------|-----------|-------------|----------------|
|
|
38
|
+
| Getting Started | Tutorial or How-To | Tutorial if there is a learning journey; How-To if it only gets the system running | Look for staged learning versus immediate task completion |
|
|
39
|
+
| Architecture Overview | Explanation or Reference | Explanation if it interprets design; Reference if it inventories components or schemas | Ask whether the page argues or catalogs |
|
|
40
|
+
| Troubleshooting | How-To or Reference | How-To if it says what to do; Reference if it lists symptoms or codes | Ask whether the reader is acting or checking |
|
|
41
|
+
| Best Practices | Explanation or How-To | Explanation if it discusses trade-offs; How-To if it gives concrete steps | Ask whether the page persuades or instructs |
|
|
42
|
+
| Changelog | Reference or Explanation | Usually Reference; Explanation only when it includes rationale and interpretation | Ask whether the entry records changes or explains them |
|
|
32
43
|
|
|
33
|
-
|
|
44
|
+
If a draft mixes signals from multiple rows, re-run the [Two-Question Compass](#two-question-compass), then reshape it with the matching section under [Templates](#templates).
|
|
34
45
|
|
|
35
|
-
|
|
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...
|
|
46
|
+
## Templates
|
|
38
47
|
|
|
39
|
-
|
|
48
|
+
Pick one template and keep the whole page in that mode.
|
|
40
49
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
> 3. Roll out the new version.
|
|
50
|
+
| Quadrant | Recommended structure | Notes |
|
|
51
|
+
|----------|-----------------------|-------|
|
|
52
|
+
| Tutorial | Goal, prerequisites, staged steps, visible checkpoints, recap | Teach one skill well. Keep momentum. |
|
|
53
|
+
| How-To | Goal, prerequisites, steps, verification, troubleshooting | Assume competence. Omit background unless strictly needed to act. |
|
|
54
|
+
| Reference | Overview, schema or API surface, options, constraints, examples for lookup | Keep tone factual, terse, and consistent. |
|
|
55
|
+
| Explanation | Problem, context, concepts, trade-offs, related decisions, links to evidence | Take a position. Connect ideas instead of listing procedures. |
|
|
48
56
|
|
|
49
|
-
|
|
57
|
+
Quadrant-specific rules:
|
|
50
58
|
|
|
51
|
-
|
|
59
|
+
- **Tutorial**: show visible results at each stage, avoid digressions, and link outward for depth.
|
|
60
|
+
- **How-To**: focus on one task, use imperative language, and keep supporting context brief.
|
|
61
|
+
- **Reference**: optimize for lookup speed, stable structure, and completeness.
|
|
62
|
+
- **Explanation**: explain why, connect causes and consequences, and link to code, ADRs, or tool output.
|
|
52
63
|
|
|
53
|
-
|
|
64
|
+
Run the finished draft against the [Quality Checklist](#quality-checklist) before shipping it.
|
|
54
65
|
|
|
55
|
-
|
|
66
|
+
## Quality Checklist
|
|
56
67
|
|
|
57
|
-
|
|
68
|
+
Run this checklist against every document created or updated during \`_docs-sync\`:
|
|
58
69
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
70
|
+
### Quadrant Purity
|
|
71
|
+
- [ ] Document serves exactly one Diátaxis quadrant
|
|
72
|
+
- [ ] No mixed-mode content such as tutorial narration plus reference tables plus explanation prose
|
|
73
|
+
- [ ] Language patterns match the selected quadrant (see [Four Quadrants](#four-quadrants))
|
|
74
|
+
- [ ] If content from another quadrant is needed, it is linked, not embedded
|
|
62
75
|
|
|
63
|
-
|
|
76
|
+
### Structure & Completeness
|
|
77
|
+
- [ ] All required sections for the chosen form are present (see [Templates](#templates))
|
|
78
|
+
- [ ] No empty placeholder sections
|
|
79
|
+
- [ ] Cross-references to related docs in other quadrants exist where useful
|
|
80
|
+
- [ ] Any \`type:\` frontmatter or metadata matches the actual quadrant
|
|
64
81
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
82
|
+
### Evidence & Accuracy
|
|
83
|
+
- [ ] Claims are traceable to source files, config, or AI Kit tool output
|
|
84
|
+
- [ ] Unknowns are marked \`[TODO]\`, not guessed
|
|
85
|
+
- [ ] Team-intent items are marked \`[ASK USER]\`
|
|
86
|
+
- [ ] No stale facts such as removed features, deprecated APIs, or obsolete version details
|
|
70
87
|
|
|
71
|
-
|
|
88
|
+
### Audience Fit
|
|
89
|
+
- [ ] Tutorial assumes a learner and teaches one skill at a time
|
|
90
|
+
- [ ] How-To assumes competence and stays task-focused
|
|
91
|
+
- [ ] Reference stays factual, comprehensive, and structurally consistent
|
|
92
|
+
- [ ] Explanation provides context, perspective, and connected reasoning
|
|
72
93
|
|
|
73
|
-
|
|
94
|
+
Iterate in small loops:
|
|
74
95
|
|
|
75
|
-
|
|
96
|
+
1. Pick one document, section, or paragraph.
|
|
97
|
+
2. Classify it with the [Two-Question Compass](#two-question-compass).
|
|
98
|
+
3. Check it against this checklist.
|
|
99
|
+
4. Make one improvement.
|
|
100
|
+
5. Repeat.
|
|
76
101
|
|
|
77
|
-
|
|
102
|
+
Optional audit scoring:
|
|
78
103
|
|
|
79
|
-
|
|
104
|
+
| Score | Quality | Action |
|
|
105
|
+
|-------|---------|--------|
|
|
106
|
+
| 100% | Excellent | No action needed |
|
|
107
|
+
| 75-99% | Good | Fix during the next related change |
|
|
108
|
+
| 50-74% | Needs work | Schedule improvement |
|
|
109
|
+
| <50% | Poor | Rewrite or split immediately |
|
|
80
110
|
|
|
81
|
-
|
|
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.
|
|
111
|
+
Organic growth rules:
|
|
88
112
|
|
|
89
|
-
|
|
113
|
+
- Let structure emerge from real content needs; do not create empty four-folder layouts.
|
|
114
|
+
- A project with no tutorials does not need a \`tutorials/\` directory.
|
|
115
|
+
- Add document types as the codebase and team actually need them.
|
|
116
|
+
- A correct, narrow document is better than an ambitious mixed document.
|
|
90
117
|
|
|
91
|
-
|
|
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].
|
|
118
|
+
## Anti-Patterns
|
|
96
119
|
|
|
97
|
-
|
|
120
|
+
These patterns signal quadrant mixing or misplaced content.
|
|
98
121
|
|
|
99
|
-
|
|
122
|
+
| Anti-pattern | Detection signals | Failure mode | Fix |
|
|
123
|
+
|--------------|-------------------|--------------|-----|
|
|
124
|
+
| Tutorial with Explanation | conceptual paragraphs between steps, "why" digressions mid-lesson | learner loses momentum and the lesson becomes reference-like | move reasoning to Explanation and leave only the learning path |
|
|
125
|
+
| How-To That Teaches | beginner framing, concept lessons, long fundamentals | experienced users must read material they do not need | assume competence and link to Tutorial for prerequisites |
|
|
126
|
+
| Reference with Narrative | opinion, anecdotes, first-person recommendations, workflow prose | lookup becomes slow and facts become unreliable | keep facts in Reference, move interpretation to Explanation |
|
|
127
|
+
| Explanation with Procedures | numbered commands, imperative instructions, run-this-now blocks | the page stops explaining and starts acting like a guide | move procedures to How-To or Tutorial |
|
|
128
|
+
| Mixed-Mode Document | one page tries to teach, instruct, explain, and catalog at once | the page serves no audience well and becomes hard to maintain | split the page by quadrant and cross-link the results |
|
|
100
129
|
|
|
101
|
-
|
|
130
|
+
Common mistakes worth catching in review:
|
|
102
131
|
|
|
103
|
-
|
|
132
|
+
- Writing a tutorial that tries to be comprehensive instead of teach one skill.
|
|
133
|
+
- Embedding opinion in reference material.
|
|
134
|
+
- Creating empty four-quadrant structures before the content exists.
|
|
135
|
+
- Writing how-to guides that explain everything instead of helping the reader finish the task.
|
|
136
|
+
- Writing explanation without perspective, trade-offs, or evidence.
|
|
137
|
+
- Trying to classify navigation pages such as indexes or README landing pages; navigation pages can remain unclassified.
|
|
104
138
|
|
|
105
|
-
|
|
139
|
+
This reference adapts concepts from the Diátaxis framework at diataxis.fr. Diátaxis framework content is licensed under CC-BY-SA 4.0; retain attribution and share-alike terms for further adaptations.`},{file:`references/project-knowledge-reference.md`,content:`# Project Knowledge Reference
|
|
106
140
|
|
|
107
|
-
|
|
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.
|
|
141
|
+
## Workflow
|
|
110
142
|
|
|
111
|
-
|
|
143
|
+
### Project Knowledge — Workflow
|
|
112
144
|
|
|
113
|
-
|
|
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.`},{file:`references/diataxis-compass.md`,content:`# The Diataxis Compass
|
|
148
|
-
|
|
149
|
-
The Diataxis Compass is a simple classification aid for documentation. It reduces classification to two axes so an author can decide what kind of document they are writing before structure and tone drift across quadrants.
|
|
150
|
-
|
|
151
|
-
Use it when a draft feels mixed, when a request could fit more than one documentation type, or when you need a quick check before creating a new document.
|
|
152
|
-
|
|
153
|
-
## The Two Axes
|
|
154
|
-
|
|
155
|
-
The compass uses two independent axes:
|
|
156
|
-
|
|
157
|
-
| Axis | Question | Poles | What it tells you |
|
|
158
|
-
|------|----------|-------|-------------------|
|
|
159
|
-
| Horizontal | Is the reader trying to do something or understand something? | Action vs Cognition | Whether the content should guide behavior or develop understanding |
|
|
160
|
-
| Vertical | Is the reader learning or working? | Study vs Work | Whether the content serves acquisition or application |
|
|
161
|
-
|
|
162
|
-
Interpret the axes this way:
|
|
163
|
-
|
|
164
|
-
- **Action** means practical doing, following steps, executing work, or completing a task.
|
|
165
|
-
- **Cognition** means understanding, context, concepts, relationships, or meaning.
|
|
166
|
-
- **Study** means the reader is acquiring skill or knowledge.
|
|
167
|
-
- **Work** means the reader is applying skill or knowledge to a real task.
|
|
168
|
-
|
|
169
|
-
## ASCII Quadrant Diagram
|
|
170
|
-
|
|
171
|
-
\`\`\`text
|
|
172
|
-
ACTION COGNITION
|
|
173
|
-
+--------------------------------+--------------------------------+
|
|
174
|
-
STUDY | Tutorial | Explanation |
|
|
175
|
-
| Learn by doing | Learn by understanding |
|
|
176
|
-
+--------------------------------+--------------------------------+
|
|
177
|
-
WORK | How-to Guide | Reference |
|
|
178
|
-
| Accomplish a specific task | Consult facts while working |
|
|
179
|
-
+--------------------------------+--------------------------------+
|
|
180
|
-
\`\`\`
|
|
181
|
-
|
|
182
|
-
## Two-Question Decision Tree
|
|
183
|
-
|
|
184
|
-
Ask these questions in order:
|
|
185
|
-
|
|
186
|
-
1. Is the reader trying to **DO** something or **UNDERSTAND** something?
|
|
187
|
-
2. Is the reader **LEARNING** or **WORKING**?
|
|
188
|
-
|
|
189
|
-
Answer matrix:
|
|
190
|
-
|
|
191
|
-
| Q1 | Q2 | Result |
|
|
192
|
-
|----|----|--------|
|
|
193
|
-
| Action | Study | Tutorial |
|
|
194
|
-
| Action | Work | How-to guide |
|
|
195
|
-
| Cognition | Work | Reference |
|
|
196
|
-
| Cognition | Study | Explanation |
|
|
197
|
-
|
|
198
|
-
Short version:
|
|
199
|
-
|
|
200
|
-
- Action + Study = **Tutorial**
|
|
201
|
-
- Action + Work = **How-to guide**
|
|
202
|
-
- Cognition + Work = **Reference**
|
|
203
|
-
- Cognition + Study = **Explanation**
|
|
204
|
-
|
|
205
|
-
## Content Type Signals
|
|
206
|
-
|
|
207
|
-
Trigger phrases are not absolute rules, but they are strong signals.
|
|
208
|
-
|
|
209
|
-
| Quadrant | Typical trigger phrases or patterns | What they usually indicate |
|
|
210
|
-
|----------|-------------------------------------|----------------------------|
|
|
211
|
-
| Tutorial | \`build your first\`, \`getting started\`, \`learn\`, \`introduction to\`, \`beginner\`, \`walkthrough\` | A guided learning path with a defined outcome |
|
|
212
|
-
| How-to guide | \`how to\`, \`configure\`, \`deploy\`, \`set up\`, \`integrate\`, \`migrate\`, \`troubleshoot\` | A task-focused guide for a user trying to solve a real problem |
|
|
213
|
-
| Reference | \`API\`, \`parameters\`, \`options\`, \`schema\`, \`configuration\`, \`specification\`, \`returns\` | Structured factual material consulted during work |
|
|
214
|
-
| Explanation | \`why\`, \`how it works\`, \`overview\`, \`trade-offs\`, \`background\`, \`concepts\`, \`design\` | Material meant to increase understanding and context |
|
|
215
|
-
|
|
216
|
-
Signals become more reliable when they align across title, headings, verbs, and document structure.
|
|
217
|
-
|
|
218
|
-
## Confidence Calibration
|
|
219
|
-
|
|
220
|
-
Use confidence to decide whether to classify, split, or rewrite.
|
|
221
|
-
|
|
222
|
-
| Confidence | Interpretation | Recommended action |
|
|
223
|
-
|------------|----------------|--------------------|
|
|
224
|
-
| High | All signals match one quadrant | Classify directly and write fully in that mode |
|
|
225
|
-
| Medium | Signals match one quadrant but the topic could span two | Classify to the dominant quadrant and cross-link the adjacent need |
|
|
226
|
-
| Low | Mixed signals across quadrants | Split the document rather than forcing one label |
|
|
227
|
-
|
|
228
|
-
Practical rule:
|
|
229
|
-
|
|
230
|
-
- **High** means title, tone, structure, and user need all point the same way.
|
|
231
|
-
- **Medium** means one quadrant clearly dominates, but a neighboring quadrant is tempting.
|
|
232
|
-
- **Low** means the document is trying to teach, guide, explain, and describe at once.
|
|
233
|
-
|
|
234
|
-
## Edge Cases
|
|
235
|
-
|
|
236
|
-
Some common document labels are ambiguous on their face. Classify by function, not by title alone.
|
|
237
|
-
|
|
238
|
-
| Content label | Recommended classification | Reasoning |
|
|
239
|
-
|---------------|----------------------------|-----------|
|
|
240
|
-
| README | Reference | Usually a project summary and entry point, not a discursive explanation |
|
|
241
|
-
| FAQ | Split per question | Each answer may belong to a different quadrant |
|
|
242
|
-
| Getting Started | Tutorial or How-to guide | Tutorial if aimed at learning; How-to if aimed at competent users getting started in work |
|
|
243
|
-
| Troubleshooting | How-to guide | It is task-oriented problem solving |
|
|
244
|
-
| Changelog | Reference | It is a factual record |
|
|
245
|
-
| Architecture overview | Explanation | It exists to help the reader understand system design |
|
|
246
|
-
| Migration guide | How-to guide | It helps the reader complete a concrete transition task |
|
|
247
|
-
|
|
248
|
-
## Ambiguity Protocol
|
|
249
|
-
|
|
250
|
-
When classification is uncertain:
|
|
251
|
-
|
|
252
|
-
1. Default to the quadrant that serves the reader's immediate need.
|
|
253
|
-
2. If it is still unclear, split the document by quadrant.
|
|
254
|
-
3. If splitting is not worth the cost, classify it by the dominant quadrant and explicitly note the secondary one.
|
|
255
|
-
|
|
256
|
-
Useful signs that a split is warranted:
|
|
257
|
-
|
|
258
|
-
- the introduction promises learning, but the body is a task checklist
|
|
259
|
-
- the document alternates between step-by-step actions and API facts
|
|
260
|
-
- the writer keeps adding “why” digressions to operational instructions
|
|
261
|
-
- headings naturally group into two different quadrant modes
|
|
262
|
-
|
|
263
|
-
## Attribution
|
|
264
|
-
|
|
265
|
-
This document adapts concepts from the Diataxis framework at [diataxis.fr](https://diataxis.fr/), especially the Compass and related quadrant descriptions.
|
|
266
|
-
|
|
267
|
-
Source material is licensed under **CC-BY-SA 4.0**.
|
|
268
|
-
|
|
269
|
-
Attribution: Daniele Procida, *Diataxis*, [https://diataxis.fr/](https://diataxis.fr/).`},{file:`references/diataxis-quadrants.md`,content:`# Diataxis Quadrants
|
|
270
|
-
|
|
271
|
-
This reference describes the four documentation quadrants in Diataxis: Tutorial, How-to guide, Reference, and Explanation. Use it when a document has already been classified, or when you need boundary tests to decide whether content belongs in one quadrant or has drifted into another.
|
|
272
|
-
|
|
273
|
-
## Tutorial
|
|
274
|
-
|
|
275
|
-
### Definition
|
|
276
|
-
|
|
277
|
-
A tutorial is a guided learning experience. It helps a reader acquire competence by doing something meaningful in a controlled path toward a defined outcome.
|
|
278
|
-
|
|
279
|
-
### Tutorial Is / Is Not
|
|
280
|
-
|
|
281
|
-
| IS | IS NOT |
|
|
282
|
-
|----|--------|
|
|
283
|
-
| Learning-oriented | A reference to consult |
|
|
284
|
-
| Practical and guided | A set of independent steps |
|
|
285
|
-
| Structured as a path | Complete coverage of a topic |
|
|
286
|
-
| Built around a defined outcome | A free-form discussion |
|
|
287
|
-
|
|
288
|
-
### Defining Characteristics
|
|
289
|
-
|
|
290
|
-
- It is designed for a reader who is still learning.
|
|
291
|
-
- It follows a deliberate path from start to finish.
|
|
292
|
-
- It creates a successful encounter with the product or skill.
|
|
293
|
-
- It limits choices so the learner can focus.
|
|
294
|
-
- It optimizes for confidence, momentum, and visible progress.
|
|
295
|
-
|
|
296
|
-
### Language Patterns
|
|
297
|
-
|
|
298
|
-
Tutorial language is guided, concrete, and supportive. It commonly uses second person and first-person plural.
|
|
299
|
-
|
|
300
|
-
- \`In this tutorial, you will ...\`
|
|
301
|
-
- \`You'll see ...\`
|
|
302
|
-
- \`Next, we ...\`
|
|
303
|
-
- \`Notice that ...\`
|
|
304
|
-
- \`The output should look something like ...\`
|
|
305
|
-
|
|
306
|
-
The tone should reduce uncertainty, set expectations, and keep the learner on a single path.
|
|
307
|
-
|
|
308
|
-
### Boundary Tests
|
|
309
|
-
|
|
310
|
-
- If the steps can be done in any order, it is probably **not** a tutorial.
|
|
311
|
-
- If there is no learning outcome, it is probably a **How-to guide**.
|
|
312
|
-
- If the content starts listing all options and variants, it is drifting toward **Reference**.
|
|
313
|
-
- If the content spends time on rationale and design history, it is drifting toward **Explanation**.
|
|
314
|
-
|
|
315
|
-
## How-to Guide
|
|
316
|
-
|
|
317
|
-
### Definition
|
|
318
|
-
|
|
319
|
-
A how-to guide is a task-oriented document for someone trying to solve a specific problem or complete a real piece of work. It assumes the reader already has enough competence to act on concise guidance.
|
|
320
|
-
|
|
321
|
-
### How-to Is / Is Not
|
|
322
|
-
|
|
323
|
-
| IS | IS NOT |
|
|
324
|
-
|----|--------|
|
|
325
|
-
| Task-oriented | A lesson |
|
|
326
|
-
| Practical | An explanation of concepts |
|
|
327
|
-
| Focused on a specific problem | A comprehensive reference |
|
|
328
|
-
| Written for application in real work | A broad introduction |
|
|
329
|
-
|
|
330
|
-
### Defining Characteristics
|
|
331
|
-
|
|
332
|
-
- It starts from a concrete goal or problem.
|
|
333
|
-
- It is written for readers who are already doing work.
|
|
334
|
-
- It emphasizes action, judgement, and usable sequence.
|
|
335
|
-
- It avoids digressions into fundamentals unless strictly necessary.
|
|
336
|
-
- It may branch for real-world conditions and alternatives.
|
|
337
|
-
|
|
338
|
-
### Language Patterns
|
|
339
|
-
|
|
340
|
-
How-to language is direct and imperative. It should sound executable.
|
|
341
|
-
|
|
342
|
-
- \`Configure X.\`
|
|
343
|
-
- \`Deploy to Y.\`
|
|
344
|
-
- \`Set up the service account.\`
|
|
345
|
-
- \`If you need Z, do ...\`
|
|
346
|
-
- \`To migrate safely, first ...\`
|
|
347
|
-
|
|
348
|
-
Good how-to writing is short, concrete, and free of conceptual detours.
|
|
349
|
-
|
|
350
|
-
### Boundary Tests
|
|
351
|
-
|
|
352
|
-
- If it teaches fundamentals before the task, it is drifting toward **Tutorial**.
|
|
353
|
-
- If it mostly describes available options rather than choosing a path, it is drifting toward **Reference**.
|
|
354
|
-
- If it answers \`why\` more than \`what to do\`, it is drifting toward **Explanation**.
|
|
355
|
-
- If success depends on following a pedagogical sequence rather than solving a task, it belongs in **Tutorial**.
|
|
356
|
-
|
|
357
|
-
## Reference
|
|
358
|
-
|
|
359
|
-
### Definition
|
|
360
|
-
|
|
361
|
-
Reference is factual documentation consulted during work. It describes the machinery, interface, structure, or behavior of the system as clearly and consistently as possible.
|
|
362
|
-
|
|
363
|
-
### Reference Is / Is Not
|
|
364
|
-
|
|
365
|
-
| IS | IS NOT |
|
|
366
|
-
|----|--------|
|
|
367
|
-
| Information-oriented | A guide |
|
|
368
|
-
| Austere and factual | Opinionated |
|
|
369
|
-
| Comprehensive within scope | Narrative |
|
|
370
|
-
| Structured consistently | Selective in the style of a lesson |
|
|
371
|
-
|
|
372
|
-
### Defining Characteristics
|
|
373
|
-
|
|
374
|
-
- It is optimized for lookup, not for linear reading.
|
|
375
|
-
- It presents facts, interfaces, constraints, and structure.
|
|
376
|
-
- It uses a consistent pattern so readers can find answers quickly.
|
|
377
|
-
- It aims for completeness inside a defined scope.
|
|
378
|
-
- It avoids persuasion, instruction-heavy flow, and discursive context.
|
|
379
|
-
|
|
380
|
-
### Language Patterns
|
|
381
|
-
|
|
382
|
-
Reference language is descriptive, factual, and usually third person.
|
|
383
|
-
|
|
384
|
-
- \`Returns {type}.\`
|
|
385
|
-
- \`Accepts the following parameters ...\`
|
|
386
|
-
- \`Option values are ...\`
|
|
387
|
-
- \`The schema contains ...\`
|
|
388
|
-
- \`Configuration keys include ...\`
|
|
389
|
-
|
|
390
|
-
Warnings and constraints are fine, but they should remain factual rather than tutorial or argumentative.
|
|
391
|
-
|
|
392
|
-
### Boundary Tests
|
|
393
|
-
|
|
394
|
-
- If the content explains why a design exists, it belongs in **Explanation**.
|
|
395
|
-
- If the content shows how to accomplish a task with the feature, it belongs in **How-to guide**.
|
|
396
|
-
- If the content walks a newcomer through a first success path, it belongs in **Tutorial**.
|
|
397
|
-
- If the content becomes selective and outcome-driven rather than complete and structured, it is no longer pure reference.
|
|
398
|
-
|
|
399
|
-
## Explanation
|
|
400
|
-
|
|
401
|
-
### Definition
|
|
402
|
-
|
|
403
|
-
Explanation is understanding-oriented documentation. It connects concepts, provides rationale and background, and helps the reader build a mental model of the system or topic.
|
|
404
|
-
|
|
405
|
-
### Explanation Is / Is Not
|
|
406
|
-
|
|
407
|
-
| IS | IS NOT |
|
|
408
|
-
|----|--------|
|
|
409
|
-
| Understanding-oriented | Step-by-step instructions |
|
|
410
|
-
| Discursive and connective | A lookup table |
|
|
411
|
-
| Rich in context | A tutorial |
|
|
412
|
-
| Concerned with reasons and implications | A terse list of facts |
|
|
413
|
-
|
|
414
|
-
### Defining Characteristics
|
|
415
|
-
|
|
416
|
-
- It provides context, rationale, and conceptual framing.
|
|
417
|
-
- It connects details into a broader mental model.
|
|
418
|
-
- It can discuss trade-offs, history, alternatives, and design intent.
|
|
419
|
-
- It supports reflection more than immediate action.
|
|
420
|
-
- It is bounded by topic rather than by task or API surface.
|
|
421
|
-
|
|
422
|
-
### Language Patterns
|
|
423
|
-
|
|
424
|
-
Explanation language is descriptive, interpretive, and often comparative.
|
|
425
|
-
|
|
426
|
-
- \`The reason for ...\`
|
|
427
|
-
- \`This approach was chosen because ...\`
|
|
428
|
-
- \`Consider the trade-off ...\`
|
|
429
|
-
- \`Historically, the system evolved this way because ...\`
|
|
430
|
-
- \`An X in this system is analogous to ...\`
|
|
431
|
-
|
|
432
|
-
It is acceptable here to surface perspective, evaluation, and multiple interpretations.
|
|
433
|
-
|
|
434
|
-
### Boundary Tests
|
|
435
|
-
|
|
436
|
-
- If the document has numbered operational steps, it likely belongs in **How-to guide** or **Tutorial**.
|
|
437
|
-
- If it lists facts without context, it likely belongs in **Reference**.
|
|
438
|
-
- If it promises a concrete outcome the reader will build, it likely belongs in **Tutorial**.
|
|
439
|
-
- If it exists mainly to solve an immediate operational problem, it belongs in **How-to guide**.
|
|
440
|
-
|
|
441
|
-
## Cross-Linking Rules
|
|
442
|
-
|
|
443
|
-
Quadrants should cooperate rather than compete. Each document should point to adjacent documentation types when a different reader need appears.
|
|
444
|
-
|
|
445
|
-
| From | Cross-link pattern |
|
|
446
|
-
|------|--------------------|
|
|
447
|
-
| Tutorial | \`For the full API, see [Reference].\` |
|
|
448
|
-
| How-to guide | \`To understand why, see [Explanation].\` |
|
|
449
|
-
| Reference | \`For a guide on using this, see [How-to].\` |
|
|
450
|
-
| Explanation | \`To get started, see [Tutorial].\` |
|
|
451
|
-
|
|
452
|
-
Use cross-links when content would otherwise drift into the wrong quadrant. Link instead of absorbing the adjacent material.
|
|
453
|
-
|
|
454
|
-
## Attribution
|
|
455
|
-
|
|
456
|
-
This document adapts concepts from the Diataxis framework at [diataxis.fr](https://diataxis.fr/), especially the quadrant descriptions and distinction pages.
|
|
457
|
-
|
|
458
|
-
Source material is licensed under **CC-BY-SA 4.0**.
|
|
459
|
-
|
|
460
|
-
Attribution: Daniele Procida, *Diataxis*, [https://diataxis.fr/](https://diataxis.fr/).`},{file:`references/diataxis-quality.md`,content:`# Diataxis Quality & Iteration
|
|
461
|
-
|
|
462
|
-
How to assess and improve documentation quality using the Diátaxis framework.
|
|
463
|
-
|
|
464
|
-
## Quality Checklist
|
|
465
|
-
|
|
466
|
-
Run this checklist against every document created or updated during \`_docs-sync\`:
|
|
467
|
-
|
|
468
|
-
### Quadrant Purity
|
|
469
|
-
- [ ] Document serves exactly ONE Diátaxis quadrant
|
|
470
|
-
- [ ] No mixed-mode content (tutorial narration + reference tables + explanation prose)
|
|
471
|
-
- [ ] Language patterns match the quadrant (see diataxis-quadrants.md)
|
|
472
|
-
- [ ] If content from another quadrant is needed, it's linked — not embedded
|
|
473
|
-
|
|
474
|
-
### Structure & Completeness
|
|
475
|
-
- [ ] All required template sections are present (see diataxis-templates.md)
|
|
476
|
-
- [ ] No empty placeholder sections
|
|
477
|
-
- [ ] Cross-references to related docs in other quadrants exist
|
|
478
|
-
- [ ] \`type:\` frontmatter tag matches the actual content quadrant
|
|
479
|
-
|
|
480
|
-
### Evidence & Accuracy
|
|
481
|
-
- [ ] Claims are traceable to source files, config, or AI Kit tool output
|
|
482
|
-
- [ ] Unknowns are marked \`[TODO]\`, not guessed
|
|
483
|
-
- [ ] Team-intent items are marked \`[ASK USER]\`
|
|
484
|
-
- [ ] No stale information (version numbers, deprecated APIs, removed features)
|
|
485
|
-
|
|
486
|
-
### Audience Fit
|
|
487
|
-
- [ ] Tutorial: assumes beginner, teaches one skill, shows visible results at each step
|
|
488
|
-
- [ ] How-To: assumes competence, addresses specific task, no unnecessary explanation
|
|
489
|
-
- [ ] Reference: factual, comprehensive, consistent structure, austere
|
|
490
|
-
- [ ] Explanation: provides context, takes a position, connects concepts
|
|
491
|
-
|
|
492
|
-
## Iterative Improvement Process
|
|
493
|
-
|
|
494
|
-
Documentation improves incrementally. Don't try to perfect everything at once.
|
|
145
|
+
Detailed workflow for acquiring and documenting project knowledge into \`docs/architecture/\`.
|
|
495
146
|
|
|
496
|
-
|
|
147
|
+
## Four-Phase Workflow
|
|
497
148
|
|
|
498
149
|
\`\`\`
|
|
499
|
-
1
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
4
|
|
503
|
-
5. Repeat
|
|
150
|
+
- [ ] Phase 1: Scan with AI Kit tools, read intent documents
|
|
151
|
+
- [ ] Phase 2: Investigate each documentation area
|
|
152
|
+
- [ ] Phase 3: Populate all seven docs in docs/architecture/
|
|
153
|
+
- [ ] Phase 4: Validate docs, present findings, resolve all [ASK USER] items
|
|
504
154
|
\`\`\`
|
|
505
155
|
|
|
506
|
-
###
|
|
507
|
-
|
|
508
|
-
| Trigger | Action |
|
|
509
|
-
|---------|--------|
|
|
510
|
-
| New doc created during \`_docs-sync\` | Run full checklist before committing |
|
|
511
|
-
| Existing doc updated | Check only the modified sections |
|
|
512
|
-
| Docs audit requested | Run checklist on all docs; prioritize by staleness |
|
|
513
|
-
| Content feels wrong but works | Classify first — often the issue is quadrant mixing |
|
|
514
|
-
|
|
515
|
-
### Organic Growth (from diataxis.fr)
|
|
516
|
-
|
|
517
|
-
- Let documentation structure emerge from content needs — don't create empty four-section structures
|
|
518
|
-
- A project with no tutorials doesn't need a \`tutorials/\` directory
|
|
519
|
-
- Add documentation types as the project actually needs them
|
|
520
|
-
- Perfect is the enemy of good — a correct how-to guide is better than no documentation
|
|
521
|
-
|
|
522
|
-
### Scoring (optional, for audits)
|
|
523
|
-
|
|
524
|
-
Per document, count how many checklist items pass out of the total applicable items.
|
|
525
|
-
|
|
526
|
-
| Score | Quality | Action |
|
|
527
|
-
|-------|---------|--------|
|
|
528
|
-
| 100% | Excellent | No action needed |
|
|
529
|
-
| 75-99% | Good | Fix during next relevant change |
|
|
530
|
-
| 50-74% | Needs work | Schedule improvement |
|
|
531
|
-
| <50% | Poor | Rewrite or split immediately |
|
|
532
|
-
|
|
533
|
-
---
|
|
534
|
-
|
|
535
|
-
*Quality framework follows the Diátaxis documentation framework (CC-BY-SA 4.0, Daniele Procida).*`},{file:`references/diataxis-templates.md`,content:`# Diataxis Templates
|
|
536
|
-
|
|
537
|
-
Templates for Tutorial and Explanation documents. For How-To and Reference templates, see the main docs SKILL.md.
|
|
538
|
-
|
|
539
|
-
## Tutorial Template
|
|
540
|
-
|
|
541
|
-
**Location**: \`docs/guides/tutorials/{topic}.md\`
|
|
542
|
-
**Quadrant**: Tutorial (learning-oriented, practical)
|
|
543
|
-
|
|
544
|
-
\`\`\`markdown
|
|
545
|
-
---
|
|
546
|
-
type: tutorial
|
|
547
|
-
---
|
|
548
|
-
|
|
549
|
-
# Tutorial: {Title — Start with a Verb Phrase}
|
|
550
|
-
|
|
551
|
-
> **What you'll build/learn**: One sentence describing the concrete outcome.
|
|
552
|
-
|
|
553
|
-
## Prerequisites
|
|
554
|
-
|
|
555
|
-
- {Prerequisite 1} — [install guide](link)
|
|
556
|
-
- {Prerequisite 2}
|
|
557
|
-
|
|
558
|
-
## Steps
|
|
559
|
-
|
|
560
|
-
### 1. {First Visible Result}
|
|
561
|
-
|
|
562
|
-
{Concrete action with immediate, visible output.}
|
|
156
|
+
### Phase 1: Scan and Read Intent
|
|
563
157
|
|
|
564
|
-
\`\`\`bash
|
|
565
|
-
{command or code}
|
|
566
158
|
\`\`\`
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
{Next concrete action that builds on the previous result.}
|
|
573
|
-
|
|
574
|
-
> **You'll see**: {expected output}
|
|
575
|
-
|
|
576
|
-
### 3. {Complete the Goal}
|
|
577
|
-
|
|
578
|
-
{Final action that achieves the tutorial's stated outcome.}
|
|
579
|
-
|
|
580
|
-
> **You'll see**: {final result matching the "What you'll build" promise}
|
|
581
|
-
|
|
582
|
-
## What You Learned
|
|
583
|
-
|
|
584
|
-
{One-paragraph summary of skills acquired. No new concepts here.}
|
|
585
|
-
|
|
586
|
-
## Next Steps
|
|
587
|
-
|
|
588
|
-
- [How to {related task}](../guides/{topic}.md) — apply what you learned
|
|
589
|
-
- [{Topic} Reference](../../reference/{topic}.md) — full API details
|
|
590
|
-
- [About {concept}](../../architecture/{topic}.md) — understand the design
|
|
159
|
+
onboard({ path: "." }) # Full codebase scan
|
|
160
|
+
produce_knowledge({ path: "." }) # Comprehensive analysis
|
|
161
|
+
analyze({ aspect: "structure", path: "." }) # Project layout, packages, layers
|
|
162
|
+
analyze({ aspect: "dependencies", path: "." }) # All dependencies + import graph
|
|
591
163
|
\`\`\`
|
|
592
164
|
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
1. **Always show results** — every step must have a "You'll see" block
|
|
596
|
-
2. **Linear path only** — no branching, no optional steps, no alternatives
|
|
597
|
-
3. **No explanations** — if the reader asks "why?", link to an Explanation doc
|
|
598
|
-
4. **Concrete outcome** — the tutorial must produce something visible (output, file, running service)
|
|
599
|
-
5. **Minimum viable scope** — teach ONE thing; link to other tutorials for more
|
|
600
|
-
|
|
601
|
-
## Explanation Template
|
|
602
|
-
|
|
603
|
-
**Location**: \`docs/architecture/{topic}.md\` or \`docs/decisions/NNN-{title}.md\`
|
|
604
|
-
**Quadrant**: Explanation (understanding-oriented, theoretical)
|
|
605
|
-
|
|
606
|
-
\`\`\`markdown
|
|
607
|
-
---
|
|
608
|
-
type: explanation
|
|
609
|
-
---
|
|
165
|
+
Then read \`README\`, \`PRD\`, \`TRD\`, \`ROADMAP\`, \`SPEC\`, \`DESIGN\` files if they exist.
|
|
166
|
+
Summarise the stated project intent before reading any source code.
|
|
610
167
|
|
|
611
|
-
|
|
168
|
+
### Phase 2: Investigate
|
|
612
169
|
|
|
613
|
-
|
|
170
|
+
Use Phase 1 tool outputs to answer questions for each of the seven documents. Run additional targeted tools:
|
|
614
171
|
|
|
615
|
-
|
|
172
|
+
| Document | Investigation Tools |
|
|
173
|
+
|----------|-------------------|
|
|
174
|
+
| stack.md | \`analyze({ aspect: "dependencies", ... })\` → manifests, frameworks; \`analyze({ aspect: "structure", ... })\` → runtime signals |
|
|
175
|
+
| structure.md | \`analyze({ aspect: "structure", ... })\` → file tree, packages; \`analyze({ aspect: "entry_points", ... })\` → entry points, key files |
|
|
176
|
+
| design.md | \`analyze({ aspect: "structure", ... })\` → layers; \`analyze({ aspect: "patterns", ... })\` → design patterns; \`analyze({ aspect: "diagram", ... })\` → component diagrams |
|
|
177
|
+
| conventions.md | \`analyze({ aspect: "patterns", ... })\` → naming, formatting; \`search("conventions")\` → detected conventions |
|
|
178
|
+
| integrations.md | \`analyze({ aspect: "dependencies", ... })\` → external deps; \`search("API\\|database\\|auth\\|webhook")\` → integration points |
|
|
179
|
+
| testing.md | \`analyze({ aspect: "patterns", ... })\` → test patterns; \`search("test framework")\` → test setup; \`test_run({})\` → test health |
|
|
180
|
+
| concerns.md | \`audit({ path: "." })\` → health issues; \`dead_symbols({})\` → dead code; \`git_context({})\` → high-churn files |
|
|
616
181
|
|
|
617
|
-
|
|
182
|
+
### Phase 3: Populate Documents
|
|
618
183
|
|
|
619
|
-
|
|
184
|
+
Create each document in \`docs/architecture/\` in this order:
|
|
620
185
|
|
|
621
|
-
|
|
186
|
+
1. **stack.md** — Language, runtime version, frameworks, production dependencies, dev tooling
|
|
187
|
+
2. **structure.md** — Directory layout, entry points, key files, package organization
|
|
188
|
+
3. **design.md** — Layers, architectural patterns, data flow, component boundaries
|
|
189
|
+
4. **conventions.md** — Naming conventions, formatting rules, error handling patterns, import conventions
|
|
190
|
+
5. **integrations.md** — External APIs, databases, auth providers, monitoring, CI/CD
|
|
191
|
+
6. **testing.md** — Test frameworks, file organization, mocking strategy, coverage approach
|
|
192
|
+
7. **concerns.md** — Tech debt, known bugs, security risks, performance bottlenecks, high-churn files
|
|
622
193
|
|
|
623
|
-
|
|
624
|
-
|
|
194
|
+
Rules:
|
|
195
|
+
- Use \`[TODO]\` for anything that cannot be determined from code
|
|
196
|
+
- Use \`[ASK USER]\` where the right answer requires team intent
|
|
197
|
+
- Include an "Evidence" section in each doc with file paths and tool receipts
|
|
625
198
|
|
|
626
|
-
|
|
199
|
+
### Phase 4: Validate, Repair, Verify
|
|
627
200
|
|
|
628
|
-
|
|
629
|
-
{Link to ADRs where they exist: [ADR-NNN](../decisions/NNN-{title}.md)}
|
|
201
|
+
Run this mandatory validation loop before finalizing:
|
|
630
202
|
|
|
631
|
-
|
|
203
|
+
1. For each non-trivial claim, confirm at least one evidence reference exists
|
|
204
|
+
2. If any required section is missing or unsupported → fix and re-validate
|
|
205
|
+
3. Repeat until all seven docs pass
|
|
632
206
|
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
207
|
+
Validation pass criteria:
|
|
208
|
+
- No unsupported claims
|
|
209
|
+
- No empty required sections
|
|
210
|
+
- Unknowns use \`[TODO]\` rather than assumptions
|
|
211
|
+
- Team-intent gaps are explicitly marked \`[ASK USER]\`
|
|
636
212
|
|
|
637
|
-
|
|
213
|
+
Then present a summary, list every \`[ASK USER]\` item as a numbered question, and highlight any Intent vs. Reality divergences from Phase 1.
|
|
638
214
|
|
|
639
|
-
|
|
640
|
-
- [{API} Reference](../reference/{topic}.md) — technical details
|
|
641
|
-
- [Tutorial: {topic}](../guides/tutorials/{topic}.md) — hands-on introduction
|
|
642
|
-
\`\`\`
|
|
215
|
+
## Focus Area Mode
|
|
643
216
|
|
|
644
|
-
|
|
217
|
+
If the user specifies a focus area (e.g., "architecture only" or "testing and concerns"):
|
|
645
218
|
|
|
646
|
-
1.
|
|
647
|
-
2.
|
|
648
|
-
3.
|
|
649
|
-
4.
|
|
650
|
-
5. **Link to evidence** — reference ADRs, code, or analysis tool output
|
|
219
|
+
1. Always run Phase 1 in full
|
|
220
|
+
2. Fully complete focus-area documents first
|
|
221
|
+
3. For non-focus documents, keep required sections present and mark unknowns as \`[TODO]\`
|
|
222
|
+
4. Still run the Phase 4 validation loop on all seven documents
|
|
651
223
|
|
|
652
|
-
|
|
224
|
+
## Templates
|
|
653
225
|
|
|
654
|
-
|
|
226
|
+
### Project Knowledge Templates
|
|
655
227
|
|
|
656
228
|
Templates for the seven project knowledge documents in \`docs/architecture/\`. Use these to ensure consistent structure across projects.
|
|
657
229
|
|
|
@@ -931,253 +503,81 @@ Templates for the seven project knowledge documents in \`docs/architecture/\`. U
|
|
|
931
503
|
- \`audit()\` output — health issues
|
|
932
504
|
- \`dead_symbols({})\` output — dead code
|
|
933
505
|
- \`git_context({})\` output — high-churn files
|
|
934
|
-
|
|
506
|
+
\`\`\`
|
|
935
507
|
|
|
936
|
-
|
|
508
|
+
## Gotchas & Anti-Patterns
|
|
937
509
|
|
|
938
|
-
|
|
510
|
+
### Project Knowledge — Gotchas
|
|
939
511
|
|
|
940
|
-
|
|
941
|
-
- [ ] Phase 1: Scan with AI Kit tools, read intent documents
|
|
942
|
-
- [ ] Phase 2: Investigate each documentation area
|
|
943
|
-
- [ ] Phase 3: Populate all seven docs in docs/architecture/
|
|
944
|
-
- [ ] Phase 4: Validate docs, present findings, resolve all [ASK USER] items
|
|
945
|
-
\`\`\`
|
|
512
|
+
Common pitfalls when documenting project knowledge. Reference this during Phase 2 (Investigate) and Phase 4 (Validate).
|
|
946
513
|
|
|
947
|
-
|
|
514
|
+
## Environment Gotchas
|
|
948
515
|
|
|
949
|
-
|
|
950
|
-
onboard({ path: "." }) # Full codebase scan
|
|
951
|
-
produce_knowledge({ path: "." }) # Comprehensive analysis
|
|
952
|
-
analyze({ aspect: "structure", path: "." }) # Project layout, packages, layers
|
|
953
|
-
analyze({ aspect: "dependencies", path: "." }) # All dependencies + import graph
|
|
954
|
-
\`\`\`
|
|
516
|
+
**Monorepos:** Root \`package.json\` may have no source — check for \`workspaces\`, \`packages/\`, or \`apps/\` directories. Each workspace may have independent dependencies and conventions. Map each sub-package separately.
|
|
955
517
|
|
|
956
|
-
|
|
957
|
-
Summarise the stated project intent before reading any source code.
|
|
518
|
+
**Outdated README:** README often describes intended architecture, not the current one. Cross-reference with actual file structure before treating any README claim as fact.
|
|
958
519
|
|
|
959
|
-
|
|
520
|
+
**TypeScript path aliases:** \`tsconfig.json\` \`paths\` config means imports like \`@/foo\` don't map directly to the filesystem. Map aliases to real paths before documenting structure.
|
|
960
521
|
|
|
961
|
-
|
|
522
|
+
**Generated/compiled output:** Never document patterns from \`dist/\`, \`build/\`, \`generated/\`, \`.next/\`, \`out/\`, or \`__pycache__/\`. These are artefacts — document source conventions only.
|
|
962
523
|
|
|
963
|
-
|
|
964
|
-
|----------|-------------------|
|
|
965
|
-
| stack.md | \`analyze({ aspect: "dependencies", ... })\` → manifests, frameworks; \`analyze({ aspect: "structure", ... })\` → runtime signals |
|
|
966
|
-
| structure.md | \`analyze({ aspect: "structure", ... })\` → file tree, packages; \`analyze({ aspect: "entry_points", ... })\` → entry points, key files |
|
|
967
|
-
| design.md | \`analyze({ aspect: "structure", ... })\` → layers; \`analyze({ aspect: "patterns", ... })\` → design patterns; \`analyze({ aspect: "diagram", ... })\` → component diagrams |
|
|
968
|
-
| conventions.md | \`analyze({ aspect: "patterns", ... })\` → naming, formatting; \`search("conventions")\` → detected conventions |
|
|
969
|
-
| integrations.md | \`analyze({ aspect: "dependencies", ... })\` → external deps; \`search("API\\|database\\|auth\\|webhook")\` → integration points |
|
|
970
|
-
| testing.md | \`analyze({ aspect: "patterns", ... })\` → test patterns; \`search("test framework")\` → test setup; \`test_run({})\` → test health |
|
|
971
|
-
| concerns.md | \`audit({ path: "." })\` → health issues; \`dead_symbols({})\` → dead code; \`git_context({})\` → high-churn files |
|
|
524
|
+
**\`.env.example\` reveals required config:** Secrets are never committed. Read \`.env.example\`, \`.env.template\`, or \`.env.sample\` to discover required environment variables.
|
|
972
525
|
|
|
973
|
-
|
|
526
|
+
**\`devDependencies\` ≠ production stack:** Only \`dependencies\` (or equivalent) runs in production. Document linters, formatters, and test frameworks separately as dev tooling in \`stack.md\`.
|
|
974
527
|
|
|
975
|
-
|
|
528
|
+
**Test TODOs ≠ production debt:** TODOs inside test directories are coverage gaps, not production technical debt. Separate them in \`concerns.md\`.
|
|
976
529
|
|
|
977
|
-
|
|
978
|
-
2. **structure.md** — Directory layout, entry points, key files, package organization
|
|
979
|
-
3. **design.md** — Layers, architectural patterns, data flow, component boundaries
|
|
980
|
-
4. **conventions.md** — Naming conventions, formatting rules, error handling patterns, import conventions
|
|
981
|
-
5. **integrations.md** — External APIs, databases, auth providers, monitoring, CI/CD
|
|
982
|
-
6. **testing.md** — Test frameworks, file organization, mocking strategy, coverage approach
|
|
983
|
-
7. **concerns.md** — Tech debt, known bugs, security risks, performance bottlenecks, high-churn files
|
|
984
|
-
|
|
985
|
-
Rules:
|
|
986
|
-
- Use \`[TODO]\` for anything that cannot be determined from code
|
|
987
|
-
- Use \`[ASK USER]\` where the right answer requires team intent
|
|
988
|
-
- Include an "Evidence" section in each doc with file paths and tool receipts
|
|
989
|
-
|
|
990
|
-
### Phase 4: Validate, Repair, Verify
|
|
991
|
-
|
|
992
|
-
Run this mandatory validation loop before finalizing:
|
|
993
|
-
|
|
994
|
-
1. For each non-trivial claim, confirm at least one evidence reference exists
|
|
995
|
-
2. If any required section is missing or unsupported → fix and re-validate
|
|
996
|
-
3. Repeat until all seven docs pass
|
|
997
|
-
|
|
998
|
-
Validation pass criteria:
|
|
999
|
-
- No unsupported claims
|
|
1000
|
-
- No empty required sections
|
|
1001
|
-
- Unknowns use \`[TODO]\` rather than assumptions
|
|
1002
|
-
- Team-intent gaps are explicitly marked \`[ASK USER]\`
|
|
1003
|
-
|
|
1004
|
-
Then present a summary, list every \`[ASK USER]\` item as a numbered question, and highlight any Intent vs. Reality divergences from Phase 1.
|
|
1005
|
-
|
|
1006
|
-
## Focus Area Mode
|
|
1007
|
-
|
|
1008
|
-
If the user specifies a focus area (e.g., "architecture only" or "testing and concerns"):
|
|
1009
|
-
|
|
1010
|
-
1. Always run Phase 1 in full
|
|
1011
|
-
2. Fully complete focus-area documents first
|
|
1012
|
-
3. For non-focus documents, keep required sections present and mark unknowns as \`[TODO]\`
|
|
1013
|
-
4. Still run the Phase 4 validation loop on all seven documents`},{file:`SKILL.md`,content:`---
|
|
1014
|
-
name: docs
|
|
1015
|
-
description: "Living documentation management — Diátaxis framework, docs/ convention, create/update rules, staleness detection, integration with adr-skill and c4-architecture."
|
|
1016
|
-
metadata:
|
|
1017
|
-
category: cross-cutting
|
|
1018
|
-
domain: general
|
|
1019
|
-
applicability: on-demand
|
|
1020
|
-
inputs: [code-changes, flow-artifacts, architecture]
|
|
1021
|
-
outputs: [documentation]
|
|
1022
|
-
relatedSkills: [adr-skill, c4-architecture]
|
|
1023
|
-
internal: true
|
|
1024
|
-
---
|
|
1025
|
-
|
|
1026
|
-
# Docs — Living Documentation Skill
|
|
1027
|
-
|
|
1028
|
-
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.
|
|
1029
|
-
|
|
1030
|
-
## Principles
|
|
1031
|
-
|
|
1032
|
-
1. **Living, not legacy** — Documentation is updated as code changes, never as a separate "docs sprint"
|
|
1033
|
-
2. **One source of truth** — Never duplicate what's in code comments, READMEs, or inline JSDoc
|
|
1034
|
-
3. **Diátaxis framework** — Organize docs into four categories using the two-question compass:
|
|
1035
|
-
- **Q1**: Is the reader trying to **do** something (action) or **understand** something (cognition)?
|
|
1036
|
-
- **Q2**: Is the reader **learning** (study) or **working** (work)?
|
|
1037
|
-
- Action+Study → Tutorial · Action+Work → How-to · Cognition+Work → Reference · Cognition+Study → Explanation
|
|
1038
|
-
- See [references/diataxis-compass.md](references/diataxis-compass.md) for the full classification system
|
|
1039
|
-
4. **Minimal but complete** — Create docs only when they add value beyond what code communicates
|
|
1040
|
-
5. **Delegate to specialists** — Architecture diagrams → \`c4-architecture\` skill. Decision records → \`adr-skill\`
|
|
1041
|
-
|
|
1042
|
-
## Documentation Modes
|
|
1043
|
-
|
|
1044
|
-
This skill operates in two modes, often combined:
|
|
1045
|
-
|
|
1046
|
-
### Source-Only Mode
|
|
1047
|
-
Generate documentation from code analysis alone. Used when:
|
|
1048
|
-
- Bootstrapping \`docs/\` for the first time (\`produce_knowledge\`, \`analyze_*\` tools)
|
|
1049
|
-
- Running outside a flow context (manual documentation refresh)
|
|
1050
|
-
- Flow produced no artifacts (auto-skipped design step)
|
|
1051
|
-
|
|
1052
|
-
### Flow-Aware Mode (Primary)
|
|
1053
|
-
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.
|
|
1054
|
-
|
|
1055
|
-
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*.
|
|
1056
|
-
|
|
1057
|
-
**Artifact reading sequence:**
|
|
1058
|
-
\`\`\`
|
|
1059
|
-
flow({ action: 'status' }) # Get artifactsPath
|
|
1060
|
-
find({ pattern: "*.md", path: "<artifactsPath>" }) # Discover all artifacts
|
|
1061
|
-
digest({ sources: [ # Compress into working context
|
|
1062
|
-
{ path: "<found-artifact-1>" },
|
|
1063
|
-
{ path: "<found-artifact-2>" },
|
|
1064
|
-
...
|
|
1065
|
-
]})
|
|
1066
|
-
\`\`\`
|
|
1067
|
-
|
|
1068
|
-
See [references/flow-artifacts-guide.md](references/flow-artifacts-guide.md) for the artifact catalog and artifact-to-documentation mapping.
|
|
1069
|
-
|
|
1070
|
-
## AI Kit Tools for Documentation
|
|
1071
|
-
|
|
1072
|
-
Use these existing AI Kit tools to generate documentation content — never write docs from scratch when a tool can provide the foundation:
|
|
1073
|
-
|
|
1074
|
-
| Documentation Task | AI Kit Tool | What It Provides |
|
|
1075
|
-
|---|---|---|
|
|
1076
|
-
| Project overview | \`produce_knowledge({ path: "." })\` | Comprehensive analysis: structure, patterns, dependencies → \`docs/README.md\` |
|
|
1077
|
-
| Architecture overview | \`analyze({ aspect: "structure", path: "." })\` | File tree, package layout, layer organization → \`docs/architecture/overview.md\` |
|
|
1078
|
-
| Architecture diagrams | \`analyze({ aspect: "diagram", path: "." })\` | Mermaid diagrams of component relationships → \`docs/architecture/\` |
|
|
1079
|
-
| Dependency map | \`analyze({ aspect: "dependencies", path: "." })\` | Import graph, cross-package edges → \`docs/architecture/overview.md\` dependencies section |
|
|
1080
|
-
| Component analysis | \`analyze({ aspect: "symbols", path: "src/component" })\` | Exports, classes, interfaces → \`docs/architecture/components/{name}.md\` |
|
|
1081
|
-
| Entry points / API surface | \`analyze({ aspect: "entry_points", path: "." })\` | CLI bins, route handlers, main exports → \`docs/reference/api.md\` |
|
|
1082
|
-
| Code patterns | \`analyze({ aspect: "patterns", path: "." })\` | Design patterns, conventions → \`docs/architecture/overview.md\` patterns section |
|
|
1083
|
-
| Impact analysis | \`blast_radius({ changed_files: [...] })\` | What's affected by changes → targeted doc updates |
|
|
1084
|
-
| Change detection | \`git_context({})\` | Recent changes, diff summary → determine which docs need updating |
|
|
1085
|
-
| Module graph | \`graph({ action: 'neighbors', node_id })\` | Who-imports-whom, cross-package dependencies → architecture diagrams |
|
|
1086
|
-
| Full audit | \`audit({ path: "." })\` | Structure + deps + patterns + health + dead symbols → comprehensive docs refresh |
|
|
530
|
+
**High-churn files = fragile areas:** Files appearing most in recent \`git_context({})\` output have the highest modification rate and likely hidden complexity. Always note them in \`concerns.md\`.
|
|
1087
531
|
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
When creating documentation, always start with tool output, then enhance with human context:
|
|
1091
|
-
|
|
1092
|
-
\`\`\`
|
|
1093
|
-
1. Run the relevant analysis tool(s)
|
|
1094
|
-
2. Use the output as the doc's foundation
|
|
1095
|
-
3. Add: purpose/motivation (why, not just what)
|
|
1096
|
-
4. Add: decision context (link to ADRs)
|
|
1097
|
-
5. Add: cross-references to related docs
|
|
1098
|
-
6. Remove: implementation details visible in code
|
|
1099
|
-
\`\`\`
|
|
532
|
+
## Anti-Pattern Table
|
|
1100
533
|
|
|
1101
|
-
|
|
534
|
+
| ❌ Don't | ✅ Do instead |
|
|
535
|
+
|---------|--------------|
|
|
536
|
+
| "Uses Clean Architecture with Domain/Data layers" (when no such directories exist) | State only what directory structure actually shows |
|
|
537
|
+
| "This is a Next.js project" (without checking \`package.json\`) | Check \`dependencies\` first. State what's actually there |
|
|
538
|
+
| Guess the database from a variable name like \`dbUrl\` | Check manifest for \`pg\`, \`mysql2\`, \`mongoose\`, \`prisma\`, etc. |
|
|
539
|
+
| Document \`dist/\` or \`build/\` naming patterns as conventions | Source files only |
|
|
540
|
+
| Assume README describes current architecture | Cross-reference with actual file structure via \`analyze({ aspect: "structure", ... })\` |
|
|
541
|
+
| Treat test TODOs as production tech debt | Separate coverage gaps from production concerns in \`concerns.md\` |
|
|
1102
542
|
|
|
1103
|
-
|
|
543
|
+
## Acquisition Workflow
|
|
1104
544
|
|
|
1105
|
-
|
|
545
|
+
Produces seven populated documents in \`docs/architecture/\` covering everything needed to work effectively on the project — stack, structure, design, conventions, integrations, testing, and concerns.
|
|
1106
546
|
|
|
1107
|
-
|
|
1108
|
-
docs/
|
|
1109
|
-
├── README.md ← Project overview + docs index (always exists)
|
|
1110
|
-
├── architecture/
|
|
1111
|
-
│ ├── overview.md ← C4 context + container diagrams (c4-architecture skill)
|
|
1112
|
-
│ ├── stack.md ← Language, runtime, frameworks, all dependencies
|
|
1113
|
-
│ ├── structure.md ← Directory layout, entry points, key files
|
|
1114
|
-
│ ├── design.md ← Layers, patterns, data flow
|
|
1115
|
-
│ ├── conventions.md ← Naming, formatting, error handling, imports
|
|
1116
|
-
│ ├── integrations.md ← External APIs, databases, auth, monitoring
|
|
1117
|
-
│ ├── testing.md ← Frameworks, file organization, mocking strategy
|
|
1118
|
-
│ ├── concerns.md ← Tech debt, bugs, security risks, perf bottlenecks
|
|
1119
|
-
│ └── components/
|
|
1120
|
-
│ └── {component-name}.md ← Per-component technical docs
|
|
1121
|
-
├── decisions/ ← Architecture Decision Records (adr-skill)
|
|
1122
|
-
│ ├── index.md ← ADR log / table of contents
|
|
1123
|
-
│ └── NNN-{title}.md ← Individual ADRs
|
|
1124
|
-
├── guides/
|
|
1125
|
-
│ ├── tutorials/ ← Learning-oriented lessons (Diátaxis: Tutorial)
|
|
1126
|
-
│ │ └── {topic}.md
|
|
1127
|
-
│ └── {topic}.md ← How-to guides for common tasks (Diátaxis: How-To)
|
|
1128
|
-
└── reference/
|
|
1129
|
-
├── api.md ← API reference (endpoints, schemas, auth)
|
|
1130
|
-
└── configuration.md ← Configuration options and environment variables
|
|
1131
|
-
\`\`\`
|
|
547
|
+
**Only document what is verifiable from files or tool output — never infer or assume.**
|
|
1132
548
|
|
|
1133
|
-
###
|
|
549
|
+
### Output Contract
|
|
1134
550
|
|
|
1135
|
-
|
|
1136
|
-
|-----------|-------------------|----------------|----------------------|
|
|
1137
|
-
| \`architecture/\` | Explanation + Reference | C4 diagrams, project knowledge (stack, structure, design, conventions, integrations, testing, concerns), component docs | Initial onboarding, new component, structural change, architecture decision |
|
|
1138
|
-
| \`decisions/\` | Explanation | ADRs — why decisions were made | Non-trivial technical decision (see adr-skill triggers) |
|
|
1139
|
-
| \`guides/\` | How-To | Step-by-step instructions for tasks | New workflow, complex setup, common operations |
|
|
1140
|
-
| \`guides/tutorials/\` | Tutorial | Learning-oriented guided lessons with concrete outcomes | New technology/feature adoption, onboarding new developers |
|
|
1141
|
-
| \`reference/\` | Reference | API docs, config options, data schemas | API change, new config option, schema modification |
|
|
551
|
+
All of the following must be true before finishing:
|
|
1142
552
|
|
|
1143
|
-
|
|
553
|
+
1. All seven files exist in \`docs/architecture/\`: \`stack.md\`, \`structure.md\`, \`design.md\`, \`conventions.md\`, \`integrations.md\`, \`testing.md\`, \`concerns.md\`
|
|
554
|
+
2. Every claim is traceable to source files, config, or AI Kit tool output
|
|
555
|
+
3. Unknowns are marked \`[TODO]\`; intent-dependent decisions are marked \`[ASK USER]\`
|
|
556
|
+
4. Every document includes a short "Evidence" section with file paths or tool receipts
|
|
557
|
+
5. Final response includes numbered \`[ASK USER]\` questions and intent-vs-reality divergences
|
|
1144
558
|
|
|
1145
|
-
|
|
559
|
+
### Documents
|
|
1146
560
|
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
├── Structural/architecture change
|
|
1157
|
-
│ └── Delegate to c4-architecture skill → updates docs/architecture/overview.md
|
|
1158
|
-
├── New developer workflow (build, deploy, test pattern)
|
|
1159
|
-
│ └── Create or update docs/guides/{topic}.md
|
|
1160
|
-
├── Bug fix
|
|
1161
|
-
│ ├── Reveals missing docs? → Create the missing doc
|
|
1162
|
-
│ └── Straightforward fix? → No docs update needed
|
|
1163
|
-
└── Dependency update / refactor / cleanup
|
|
1164
|
-
└── No docs update needed (unless public API changed)
|
|
1165
|
-
\`\`\`
|
|
561
|
+
| Document | Covers | Primary Tools |
|
|
562
|
+
|----------|--------|---------------|
|
|
563
|
+
| \`stack.md\` | Language, runtime, frameworks, dependencies, dev tooling | \`analyze({ aspect: "dependencies", ... })\`, \`analyze({ aspect: "structure", ... })\` |
|
|
564
|
+
| \`structure.md\` | Directory layout, entry points, key files, packages | \`analyze({ aspect: "structure", ... })\`, \`analyze({ aspect: "entry_points", ... })\` |
|
|
565
|
+
| \`design.md\` | Layers, patterns, data flow, component boundaries | \`analyze({ aspect: "structure", ... })\`, \`analyze({ aspect: "patterns", ... })\`, \`analyze({ aspect: "diagram", ... })\` |
|
|
566
|
+
| \`conventions.md\` | Naming, formatting, error handling, import conventions | \`analyze({ aspect: "patterns", ... })\`, \`search("conventions")\` |
|
|
567
|
+
| \`integrations.md\` | External APIs, databases, auth, monitoring, CI/CD | \`analyze({ aspect: "dependencies", ... })\`, \`search("API\\|database\\|auth")\` |
|
|
568
|
+
| \`testing.md\` | Test frameworks, file organization, mocking, coverage | \`analyze({ aspect: "patterns", ... })\`, \`test_run({})\`, \`search("test")\` |
|
|
569
|
+
| \`concerns.md\` | Tech debt, bugs, security risks, perf, high-churn files | \`audit()\`, \`dead_symbols()\`, \`git_context()\` |
|
|
1166
570
|
|
|
1167
|
-
|
|
571
|
+
Use [references/project-knowledge-reference.md](references/project-knowledge-reference.md) for the standard template of each document.
|
|
1168
572
|
|
|
1169
|
-
|
|
573
|
+
### Workflow & References
|
|
1170
574
|
|
|
1171
|
-
|
|
1172
|
-
|---------------------|---------------|----------|------------------|
|
|
1173
|
-
| Action (doing) | Study (learning) | **Tutorial** | \`guides/tutorials/\` |
|
|
1174
|
-
| Action (doing) | Work (applying) | **How-To** | \`guides/\` |
|
|
1175
|
-
| Cognition (understanding) | Work (using) | **Reference** | \`reference/\` |
|
|
1176
|
-
| Cognition (understanding) | Study (grasping) | **Explanation** | \`architecture/\`, \`decisions/\` |
|
|
575
|
+
Follow the four-phase workflow: **Scan → Investigate → Populate → Validate**.
|
|
1177
576
|
|
|
1178
|
-
|
|
577
|
+
- [references/project-knowledge-reference.md](references/project-knowledge-reference.md) — Full 4-phase workflow, investigation tools per document, population rules, focus area mode
|
|
578
|
+
- [references/project-knowledge-reference.md](references/project-knowledge-reference.md) — Environment gotchas and anti-pattern table`},{file:`references/doc-templates.md`,content:`# Document Templates Reference
|
|
1179
579
|
|
|
1180
|
-
|
|
580
|
+
Use depth-specific templates. Do not hand the model a generic instruction like "document this" without the correct structure for the target document type.
|
|
1181
581
|
|
|
1182
582
|
### Component Doc Template (\`docs/architecture/components/{name}.md\`)
|
|
1183
583
|
|
|
@@ -1195,11 +595,59 @@ One-paragraph description of what this component does and why it exists.
|
|
|
1195
595
|
## Public API
|
|
1196
596
|
Brief description of the component's public interface.
|
|
1197
597
|
|
|
598
|
+
## Integration Contracts
|
|
599
|
+
- **Incoming**: {caller/component} → {contract or payload}
|
|
600
|
+
- **Outgoing**: {dependency/component} ← {contract or payload}
|
|
601
|
+
|
|
1198
602
|
## Design Decisions
|
|
1199
603
|
- Link to relevant ADRs: [ADR-NNN](../../decisions/NNN-{title}.md)
|
|
1200
604
|
|
|
1201
605
|
## Data Flow
|
|
1202
606
|
How data enters, transforms through, and exits this component.
|
|
607
|
+
|
|
608
|
+
## Sequence Diagram
|
|
609
|
+
\`\`\`mermaid
|
|
610
|
+
sequenceDiagram
|
|
611
|
+
participant Caller
|
|
612
|
+
participant Component
|
|
613
|
+
participant Dependency
|
|
614
|
+
Caller->>Component: {request or event}
|
|
615
|
+
Component->>Dependency: {integration contract}
|
|
616
|
+
Dependency-->>Component: {response}
|
|
617
|
+
Component-->>Caller: {result}
|
|
618
|
+
\`\`\`
|
|
619
|
+
|
|
620
|
+
## Error Paths & Failure Modes
|
|
621
|
+
- {failure mode} → {observable symptom} → {recovery or fallback}
|
|
622
|
+
\`\`\`
|
|
623
|
+
|
|
624
|
+
### Tutorial Template (\`docs/guides/tutorials/{topic}.md\`)
|
|
625
|
+
|
|
626
|
+
\`\`\`markdown
|
|
627
|
+
# Tutorial: {Outcome}
|
|
628
|
+
|
|
629
|
+
## Prerequisite Check
|
|
630
|
+
- Verify {tool, account, or repo state}
|
|
631
|
+
- Expected output: {what confirms the reader can start}
|
|
632
|
+
|
|
633
|
+
## Step 1: {First milestone}
|
|
634
|
+
Explain the goal of this step.
|
|
635
|
+
|
|
636
|
+
\`\`\`{language}
|
|
637
|
+
{code example}
|
|
638
|
+
\`\`\`
|
|
639
|
+
|
|
640
|
+
Expected output:
|
|
641
|
+
\`\`\`text
|
|
642
|
+
{visible result}
|
|
643
|
+
\`\`\`
|
|
644
|
+
|
|
645
|
+
## Step 2: {Next milestone}
|
|
646
|
+
Repeat the pattern: explain, show code, show expected output.
|
|
647
|
+
|
|
648
|
+
## Common Mistakes
|
|
649
|
+
- {mistake} — {how to fix it}
|
|
650
|
+
- {mistake} — {how to fix it}
|
|
1203
651
|
\`\`\`
|
|
1204
652
|
|
|
1205
653
|
### Guide Template (\`docs/guides/{topic}.md\`)
|
|
@@ -1208,18 +656,27 @@ How data enters, transforms through, and exits this component.
|
|
|
1208
656
|
# How to {Task}
|
|
1209
657
|
|
|
1210
658
|
## Prerequisites
|
|
1211
|
-
|
|
659
|
+
- Required access, tools, and starting state.
|
|
660
|
+
|
|
661
|
+
## Step 1: {Action}
|
|
662
|
+
Describe the action.
|
|
663
|
+
|
|
664
|
+
### Verify
|
|
665
|
+
- Expected: {what success looks like}
|
|
666
|
+
- Actual if broken: {what usually differs}
|
|
1212
667
|
|
|
1213
|
-
##
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
668
|
+
## Step 2: {Action}
|
|
669
|
+
Describe the next action.
|
|
670
|
+
|
|
671
|
+
### Verify
|
|
672
|
+
- Expected: {what success looks like}
|
|
673
|
+
- Actual if broken: {what usually differs}
|
|
1217
674
|
|
|
1218
675
|
## Verification
|
|
1219
|
-
How to confirm
|
|
676
|
+
How to confirm the whole task worked end to end.
|
|
1220
677
|
|
|
1221
678
|
## Troubleshooting
|
|
1222
|
-
Common issues and
|
|
679
|
+
Common issues, likely causes, and fixes.
|
|
1223
680
|
\`\`\`
|
|
1224
681
|
|
|
1225
682
|
### Decision Index Template (\`docs/decisions/index.md\`)
|
|
@@ -1246,163 +703,31 @@ The **Source** column links to the flow artifact (typically \`design.md\` or \`d
|
|
|
1246
703
|
## Overview
|
|
1247
704
|
Brief description of what this reference covers.
|
|
1248
705
|
|
|
1249
|
-
##
|
|
1250
|
-
|
|
1251
|
-
| Item | Type | Default | Description |
|
|
1252
|
-
|------|------|---------|-------------|
|
|
1253
|
-
| ... | ... | ... | ... |
|
|
1254
|
-
\`\`\`
|
|
1255
|
-
|
|
1256
|
-
> **Tutorial and Explanation templates**: For the remaining two Diátaxis quadrants, see [references/diataxis-templates.md](references/diataxis-templates.md).
|
|
1257
|
-
|
|
1258
|
-
## Integration with Other Skills
|
|
1259
|
-
|
|
1260
|
-
### \`adr-skill\` Integration
|
|
1261
|
-
- All ADRs live in \`docs/decisions/\`
|
|
1262
|
-
- When the docs-sync step detects an architecture decision was made during the flow, delegate to \`adr-skill\`
|
|
1263
|
-
- After \`adr-skill\` creates/updates an ADR, update \`docs/decisions/index.md\`
|
|
1264
|
-
- Include the Source column linking to the flow artifact where the decision was designed.
|
|
1265
|
-
- Cross-reference ADRs from component docs where relevant
|
|
1266
|
-
|
|
1267
|
-
### \`c4-architecture\` Integration
|
|
1268
|
-
- Architecture diagrams live in \`docs/architecture/\`
|
|
1269
|
-
- When the docs-sync step detects structural changes (new packages, changed boundaries), delegate to \`c4-architecture\`
|
|
1270
|
-
- Use Mermaid format for docs files (not HTML) — markdown renders in GitHub
|
|
1271
|
-
- Reference diagrams from component docs
|
|
1272
|
-
|
|
1273
|
-
### Mermaid Syntax Rules
|
|
1274
|
-
|
|
1275
|
-
When generating Mermaid diagrams in documentation:
|
|
1276
|
-
|
|
1277
|
-
- **Quote node labels containing special characters** — Names with \`@\`, \`/\`, or other special characters must be wrapped in double quotes inside square brackets: \`subgraph Commons["@scope/package-name"]\`, \`NodeId["@org/lib"]\`
|
|
1278
|
-
- **Quote subgraph titles with special characters** — \`subgraph Title["@scope/name"]\` not \`subgraph @scope/name\`
|
|
1279
|
-
- Node IDs (aliases) must not contain special characters — use plain alphanumeric IDs and put the display name in \`["..."]\`
|
|
1280
|
-
|
|
1281
|
-
## Project Knowledge Acquisition
|
|
1282
|
-
|
|
1283
|
-
Produces seven populated documents in \`docs/architecture/\` covering everything needed to work effectively on the project — stack, structure, design, conventions, integrations, testing, and concerns.
|
|
1284
|
-
|
|
1285
|
-
**Only document what is verifiable from files or tool output — never infer or assume.**
|
|
1286
|
-
|
|
1287
|
-
### Output Contract
|
|
1288
|
-
|
|
1289
|
-
All of the following must be true before finishing:
|
|
1290
|
-
|
|
1291
|
-
1. All seven files exist in \`docs/architecture/\`: \`stack.md\`, \`structure.md\`, \`design.md\`, \`conventions.md\`, \`integrations.md\`, \`testing.md\`, \`concerns.md\`
|
|
1292
|
-
2. Every claim is traceable to source files, config, or AI Kit tool output
|
|
1293
|
-
3. Unknowns are marked \`[TODO]\`; intent-dependent decisions are marked \`[ASK USER]\`
|
|
1294
|
-
4. Every document includes a short "Evidence" section with file paths or tool receipts
|
|
1295
|
-
5. Final response includes numbered \`[ASK USER]\` questions and intent-vs-reality divergences
|
|
1296
|
-
|
|
1297
|
-
### Documents
|
|
1298
|
-
|
|
1299
|
-
| Document | Covers | Primary Tools |
|
|
1300
|
-
|----------|--------|---------------|
|
|
1301
|
-
| \`stack.md\` | Language, runtime, frameworks, dependencies, dev tooling | \`analyze({ aspect: "dependencies", ... })\`, \`analyze({ aspect: "structure", ... })\` |
|
|
1302
|
-
| \`structure.md\` | Directory layout, entry points, key files, packages | \`analyze({ aspect: "structure", ... })\`, \`analyze({ aspect: "entry_points", ... })\` |
|
|
1303
|
-
| \`design.md\` | Layers, patterns, data flow, component boundaries | \`analyze({ aspect: "structure", ... })\`, \`analyze({ aspect: "patterns", ... })\`, \`analyze({ aspect: "diagram", ... })\` |
|
|
1304
|
-
| \`conventions.md\` | Naming, formatting, error handling, import conventions | \`analyze({ aspect: "patterns", ... })\`, \`search("conventions")\` |
|
|
1305
|
-
| \`integrations.md\` | External APIs, databases, auth, monitoring, CI/CD | \`analyze({ aspect: "dependencies", ... })\`, \`search("API\\|database\\|auth")\` |
|
|
1306
|
-
| \`testing.md\` | Test frameworks, file organization, mocking, coverage | \`analyze({ aspect: "patterns", ... })\`, \`test_run({})\`, \`search("test")\` |
|
|
1307
|
-
| \`concerns.md\` | Tech debt, bugs, security risks, perf, high-churn files | \`audit()\`, \`dead_symbols()\`, \`git_context()\` |
|
|
1308
|
-
|
|
1309
|
-
Use [references/project-knowledge-templates.md](references/project-knowledge-templates.md) for the standard template of each document.
|
|
1310
|
-
|
|
1311
|
-
### Workflow & References
|
|
1312
|
-
|
|
1313
|
-
Follow the four-phase workflow: **Scan → Investigate → Populate → Validate**.
|
|
1314
|
-
|
|
1315
|
-
- [references/project-knowledge-workflow.md](references/project-knowledge-workflow.md) — Full 4-phase workflow, investigation tools per document, population rules, focus area mode
|
|
1316
|
-
- [references/project-knowledge-gotchas.md](references/project-knowledge-gotchas.md) — Environment gotchas and anti-pattern table
|
|
1317
|
-
|
|
1318
|
-
## Architecture Blueprint Generation
|
|
1319
|
-
|
|
1320
|
-
When bootstrapping \`docs/\` for the first time or refreshing architecture documentation, generate a comprehensive architecture blueprint. This replaces manual documentation with tool-driven analysis.
|
|
1321
|
-
|
|
1322
|
-
### Blueprint Workflow
|
|
1323
|
-
|
|
1324
|
-
\`\`\`
|
|
1325
|
-
Step 1: Detect & Analyze
|
|
1326
|
-
analyze({ aspect: "structure", path: "." }) → project layout, packages, layers
|
|
1327
|
-
analyze({ aspect: "patterns", path: "." }) → conventions, design patterns
|
|
1328
|
-
analyze({ aspect: "entry_points", path: "." }) → API surface, CLI entry points
|
|
1329
|
-
|
|
1330
|
-
Step 2: Map Dependencies
|
|
1331
|
-
analyze({ aspect: "dependencies", path: "." }) → import graph, cross-package edges
|
|
1332
|
-
graph({ action: 'find_nodes', name_pattern: '*' }) → module graph nodes
|
|
1333
|
-
graph({ action: 'neighbors', node_id: '...' }) → dependency directions
|
|
1334
|
-
|
|
1335
|
-
Step 3: Visualize
|
|
1336
|
-
analyze({ aspect: "diagram", path: "." }) → Mermaid architecture diagrams
|
|
1337
|
-
Delegate to c4-architecture skill → C4 context/container/component views
|
|
1338
|
-
|
|
1339
|
-
Step 4: Synthesize
|
|
1340
|
-
produce_knowledge({ path: "." }) → comprehensive analysis
|
|
1341
|
-
Combine outputs into docs/ structure
|
|
1342
|
-
\`\`\`
|
|
1343
|
-
|
|
1344
|
-
### Blueprint Sections
|
|
1345
|
-
|
|
1346
|
-
The architecture blueprint should cover these areas (adapted from the Architecture Blueprint Generator pattern):
|
|
1347
|
-
|
|
1348
|
-
#### 1. Architecture Detection & Analysis
|
|
1349
|
-
- **Auto-detect**: Project type, framework, architectural pattern (Clean Architecture, Microservices, Layered, etc.)
|
|
1350
|
-
- **Tools**: \`analyze({ aspect: "structure", ... })\` → folder organization, \`analyze({ aspect: "patterns", ... })\` → framework detection, \`analyze({ aspect: "dependencies", ... })\` → dependency flow
|
|
1351
|
-
- **Output**: \`docs/architecture/overview.md\` header section
|
|
1352
|
-
|
|
1353
|
-
#### 2. Architectural Overview
|
|
1354
|
-
- Guiding principles from code structure
|
|
1355
|
-
- Architectural boundaries and enforcement mechanisms
|
|
1356
|
-
- Hybrid patterns or adaptations
|
|
1357
|
-
- **Tools**: \`produce_knowledge\` + \`analyze({ aspect: "structure", ... })\`
|
|
1358
|
-
- **Output**: \`docs/architecture/overview.md\` main body
|
|
1359
|
-
|
|
1360
|
-
#### 3. Architecture Visualization
|
|
1361
|
-
- High-level subsystem diagram
|
|
1362
|
-
- Component interaction diagrams
|
|
1363
|
-
- Data flow diagrams
|
|
1364
|
-
- **Tools**: \`analyze({ aspect: "diagram", ... })\` + \`c4-architecture\` skill
|
|
1365
|
-
- **Output**: \`docs/architecture/overview.md\` diagrams + \`docs/architecture/diagrams/\`
|
|
1366
|
-
|
|
1367
|
-
#### 4. Core Architectural Components
|
|
1368
|
-
For each major component:
|
|
1369
|
-
- Purpose and responsibility
|
|
1370
|
-
- Internal structure
|
|
1371
|
-
- Key abstractions
|
|
1372
|
-
- Interaction patterns
|
|
1373
|
-
- **Tools**: \`analyze({ aspect: "symbols", path: "component/" })\` + \`compact({ path, query: "exports" })\`
|
|
1374
|
-
- **Output**: \`docs/architecture/components/{name}.md\`
|
|
1375
|
-
|
|
1376
|
-
#### 5. Layers & Dependencies
|
|
1377
|
-
- Layer structure as implemented
|
|
1378
|
-
- Dependency rules between layers
|
|
1379
|
-
- Abstraction mechanisms for separation
|
|
1380
|
-
- Circular dependencies or violations
|
|
1381
|
-
- **Tools**: \`analyze({ aspect: "dependencies", ... })\` + \`graph({ action: 'neighbors' })\`
|
|
1382
|
-
- **Output**: \`docs/architecture/overview.md\` layers section
|
|
1383
|
-
|
|
1384
|
-
#### 6. Cross-Cutting Concerns
|
|
1385
|
-
Document implementation patterns for:
|
|
1386
|
-
- Error handling & resilience
|
|
1387
|
-
- Logging & observability
|
|
1388
|
-
- Validation patterns
|
|
1389
|
-
- Configuration management
|
|
1390
|
-
- **Tools**: \`analyze({ aspect: "patterns", ... })\` + \`search({ query: "error handling" })\`
|
|
1391
|
-
- **Output**: \`docs/architecture/overview.md\` cross-cutting section
|
|
1392
|
-
|
|
1393
|
-
#### 7. Testing Architecture
|
|
1394
|
-
- Test framework and strategy
|
|
1395
|
-
- Test boundary patterns (unit, integration, e2e)
|
|
1396
|
-
- Test file conventions
|
|
1397
|
-
- **Tools**: \`analyze({ aspect: "patterns", ... })\` + \`search({ query: "test" })\`
|
|
1398
|
-
- **Output**: \`docs/guides/testing.md\`
|
|
706
|
+
## Public API
|
|
1399
707
|
|
|
1400
|
-
|
|
1401
|
-
-
|
|
1402
|
-
-
|
|
1403
|
-
-
|
|
1404
|
-
- **
|
|
1405
|
-
|
|
708
|
+
### {Function or Endpoint}
|
|
709
|
+
- **Signature**: \`{full signature with parameter and return types}\`
|
|
710
|
+
- **Parameters**:
|
|
711
|
+
- \`{name}\` (\`{type}\`) — {purpose}
|
|
712
|
+
- **Returns**: \`{type}\` — {meaning}
|
|
713
|
+
|
|
714
|
+
#### Usage Example
|
|
715
|
+
\`\`\`{language}
|
|
716
|
+
{example}
|
|
717
|
+
\`\`\`
|
|
718
|
+
|
|
719
|
+
#### Error Codes
|
|
720
|
+
|
|
721
|
+
- | Code | Condition | Resolution |
|
|
722
|
+
- |------|-----------|------------|
|
|
723
|
+
- | ... | ... | ... |
|
|
724
|
+
|
|
725
|
+
#### Edge Cases
|
|
726
|
+
- {edge case}
|
|
727
|
+
- {edge case}
|
|
728
|
+
\`\`\`
|
|
729
|
+
|
|
730
|
+
> **Explanation templates**: For the remaining conceptual quadrant, see [references/diataxis-reference.md](references/diataxis-reference.md).`},{file:`references/flow-artifacts-guide.md`,content:'# Flow Artifacts Guide\n\n## What Are Flow Artifacts\n\nFlows produce structured markdown artifacts in `{{artifacts_path}}/`. These files capture requirements, decisions, plan shape, implementation progress, and verification results for the completed flow.\n\nUse artifacts to document the why behind changes. Code diffs still matter, but artifacts usually contain the rationale, constraints, risks, and review findings that should shape durable documentation.\n\n## How to Discover Artifacts\n\n```text\nflow({ action: \'status\' }) # Get artifactsPath\nfind({ pattern: "*.md", path: "<artifactsPath>" }) # Discover artifact files\ndigest({ sources: [ # Compress into working context\n { path: "<found-artifact-1>" },\n { path: "<found-artifact-2>" },\n ...\n]})\n```\n\nRead every artifact `find()` returns. Different flows produce different files — do not assume specific filenames exist.\n\n## Artifact Catalog\n\n| Artifact | Flow | Contains |\n|---|---|---|\n| `design-decisions.md` | `aikit:basic`, `aikit:advanced` | FORGE tier, approach, key decisions, constraints, and risks |\n| `assessment.md` | `aikit:basic` | Goal, affected files, approach steps, risks, and open questions |\n| `spec.md` | `aikit:advanced` | Requirements, acceptance criteria, and scope boundaries |\n| `plan.md` | `aikit:advanced` | Phased implementation plan and architecture decisions |\n| `tasks.md` | `aikit:advanced` | Atomic task list, dependencies, and agent assignments |\n| `progress.md` | `aikit:basic`, `aikit:advanced` | Changes made, tests, deviations, and validation results |\n| `verify-report.md` | `aikit:basic`, `aikit:advanced` | Verdict, quality gates, review findings, security, and recommendation |\n\n## Artifact-to-Documentation Mapping\n\n| Artifact | Contains | Documentation Target | Action |\n|---|---|---|---|\n| `design-decisions.md` | FORGE tier, approach, key decisions | `docs/decisions/` | Create or update ADRs via `adr-skill` for each key decision |\n| `design-decisions.md` | Architecture approach, constraints | `docs/architecture/overview.md` | Update the design rationale section |\n| `spec.md` | Requirements, acceptance criteria | `docs/reference/` | Update API or component reference when public surface changed |\n| `plan.md` | Architecture decisions, phase design | `docs/architecture/` | Update architecture docs with structural changes |\n| `tasks.md` | Task breakdown, dependencies | Usually skip | Only document if it reveals new component boundaries |\n| `progress.md` | Files changed, deviations, tests | `docs/guides/testing.md` | Update when testing strategy changed |\n| `progress.md` | Deviations from plan | `docs/decisions/` | Document significant deviations as ADRs |\n| `verify-report.md` | Code review findings, security | `docs/architecture/overview.md` | Update if findings reveal architectural patterns |\n| `verify-report.md` | Security concerns | `docs/guides/` | Create or update security guidance when concerns are material |\n\n## Reading Strategy\n\nRead every artifact `find()` returns. Triage by content type:\n\n| Content Signal | Documentation Value | Action |\n|---|---|---|\n| Decisions, rationale, constraints | High — durable knowledge | Extract into `docs/decisions/` or architecture docs |\n| Requirements, scope, acceptance criteria | High — defines intent | Update reference docs if public surface changed |\n| Review findings, security concerns, quality gates | Medium — surfaces issues | Update architecture or guides if findings are material |\n| Implementation progress, task lists | Low — transient | Document only meaningful deviations from the plan |\n\nSkip artifacts that only repeat completed work with no insights beyond the code diff.\n\n> The catalog and mapping tables above list artifacts from built-in flows (`aikit:basic`, `aikit:advanced`). Custom flows may produce entirely different artifacts — always discover dynamically with `find()` and classify by content, not by filename.\n\n## What Not to Document\n\n| Avoid | Do Instead |\n|---|---|\n| Copying artifact text verbatim into `docs/` | Extract decisions, rationale, constraints, and stable guidance |\n| Documenting every task or progress update | Keep only durable insights that help future readers |\n| Mirroring temporary planning details | Preserve the final reasoning, not the transient workflow chatter |'},{file:`references/tour-generation.md`,content:`# Tour Generation Reference
|
|
1406
731
|
|
|
1407
732
|
## Guided Tour Generation
|
|
1408
733
|
|
|
@@ -1410,36 +735,37 @@ Generate dependency-ordered codebase walkthroughs that teach the system through
|
|
|
1410
735
|
|
|
1411
736
|
### Algorithm
|
|
1412
737
|
|
|
1413
|
-
1. \`analyze({ aspect: "entry_points", path: "." })\` — find tour
|
|
1414
|
-
2. \`graph({ action: "find_nodes", name_pattern: "src" })\` — get
|
|
1415
|
-
3. \`graph({ action: "neighbors", node_id: "<entry>", direction: "outgoing" })\` — build dependency
|
|
738
|
+
1. \`analyze({ aspect: "entry_points", path: "." })\` — find likely tour starting points
|
|
739
|
+
2. \`graph({ action: "find_nodes", name_pattern: "src" })\` — get relevant module nodes
|
|
740
|
+
3. \`graph({ action: "neighbors", node_id: "<entry>", direction: "outgoing" })\` — build the local dependency view
|
|
1416
741
|
4. Topological sort on import edges — determine reading order
|
|
1417
|
-
5. Group by depth
|
|
1418
|
-
6. Batch
|
|
1419
|
-
7.
|
|
742
|
+
5. Group by depth or layer — create logical steps
|
|
743
|
+
6. Batch up to three closely related files per step — keep each step focused
|
|
744
|
+
7. End with cross-cutting concepts or follow-up links when needed
|
|
1420
745
|
|
|
1421
746
|
### Tour Step Format
|
|
1422
747
|
|
|
1423
|
-
Each step in a tour
|
|
748
|
+
Each prose step in a markdown tour should name the focus, explain what the reader will understand, and link to the relevant files.
|
|
1424
749
|
|
|
1425
750
|
\`\`\`markdown
|
|
1426
|
-
## Step
|
|
751
|
+
## {Step Title}
|
|
1427
752
|
|
|
1428
|
-
{
|
|
753
|
+
{What the reader should understand after this step}
|
|
1429
754
|
|
|
1430
755
|
**Files:**
|
|
1431
756
|
- \`{file1}\` — {role}
|
|
1432
757
|
- \`{file2}\` — {role}
|
|
1433
758
|
|
|
1434
|
-
**
|
|
1435
|
-
|
|
759
|
+
**Notes:**
|
|
760
|
+
- {important concept or callout}
|
|
761
|
+
- {follow-up detail or caution}
|
|
1436
762
|
\`\`\`
|
|
1437
763
|
|
|
1438
764
|
### Tour Generation Workflow
|
|
1439
765
|
|
|
1440
|
-
1. Run the algorithm above to produce ordered step list
|
|
766
|
+
1. Run the algorithm above to produce an ordered step list
|
|
1441
767
|
2. For each step, use \`compact({ path, query: "purpose and public API" })\` to extract key info
|
|
1442
|
-
3. Write tour as \`docs/tours/{topic}.md\`
|
|
768
|
+
3. Write the tour as \`docs/tours/{topic}.md\`
|
|
1443
769
|
4. Generate \`docs/tours/index.md\` linking all tours with descriptions
|
|
1444
770
|
|
|
1445
771
|
### Tour Index Template (\`docs/tours/index.md\`)
|
|
@@ -1447,7 +773,7 @@ Each step in a tour:
|
|
|
1447
773
|
\`\`\`markdown
|
|
1448
774
|
# Codebase Tours
|
|
1449
775
|
|
|
1450
|
-
Guided walkthroughs ordered
|
|
776
|
+
Guided walkthroughs ordered for understanding.
|
|
1451
777
|
|
|
1452
778
|
| Tour | Description | Steps | Audience |
|
|
1453
779
|
|------|-------------|-------|----------|
|
|
@@ -1461,9 +787,9 @@ Guided walkthroughs ordered by dependency — read them in sequence to understan
|
|
|
1461
787
|
\`\`\`
|
|
1462
788
|
docs/
|
|
1463
789
|
└── tours/
|
|
1464
|
-
├── index.md
|
|
1465
|
-
├── architecture.md
|
|
1466
|
-
├── data-flow.md
|
|
790
|
+
├── index.md # Tour listing with descriptions
|
|
791
|
+
├── architecture.md # System structure tour
|
|
792
|
+
├── data-flow.md # Data pipeline tour
|
|
1467
793
|
└── feature-{name}.md # Feature-specific tours
|
|
1468
794
|
\`\`\`
|
|
1469
795
|
|
|
@@ -1473,14 +799,14 @@ Document the business domain as a three-level hierarchy: **Domain → Flow → S
|
|
|
1473
799
|
|
|
1474
800
|
### Hierarchy
|
|
1475
801
|
|
|
1476
|
-
- **Domain**: A bounded business context
|
|
1477
|
-
- **Flow**: A business process within a domain
|
|
1478
|
-
- **Step**: An atomic action within a flow
|
|
802
|
+
- **Domain**: A bounded business context such as Authentication, Billing, or Inventory
|
|
803
|
+
- **Flow**: A business process within a domain such as User Login or Invoice Generation
|
|
804
|
+
- **Step**: An atomic action within a flow such as Validate Credentials or Generate PDF
|
|
1479
805
|
|
|
1480
806
|
### Domain Discovery Workflow
|
|
1481
807
|
|
|
1482
|
-
1. \`analyze({ aspect: "structure", path: "." })\` — identify top-level domain boundaries
|
|
1483
|
-
2. \`analyze({ aspect: "entry_points", path: "." })\` — detect flow entry types
|
|
808
|
+
1. \`analyze({ aspect: "structure", path: "." })\` — identify top-level domain boundaries
|
|
809
|
+
2. \`analyze({ aspect: "entry_points", path: "." })\` — detect flow entry types
|
|
1484
810
|
3. \`trace({ start: "<entry-point>", direction: "forward" })\` — map each flow's step sequence
|
|
1485
811
|
4. \`graph({ action: "neighbors", node_id: "<domain-module>", direction: "both" })\` — find cross-domain interactions
|
|
1486
812
|
|
|
@@ -1502,7 +828,7 @@ Document the business domain as a three-level hierarchy: **Domain → Flow → S
|
|
|
1502
828
|
- **{Entity}**: {description + key attributes}
|
|
1503
829
|
|
|
1504
830
|
## Business Rules
|
|
1505
|
-
- {rule 1
|
|
831
|
+
- {rule 1}
|
|
1506
832
|
- {rule 2}
|
|
1507
833
|
|
|
1508
834
|
## Flows
|
|
@@ -1515,9 +841,6 @@ Document the business domain as a three-level hierarchy: **Domain → Flow → S
|
|
|
1515
841
|
2. {Step 2} — \`{file:function}\` — {what happens}
|
|
1516
842
|
3. {Step 3} — \`{file:function}\` — {what happens}
|
|
1517
843
|
|
|
1518
|
-
### {Flow Name 2}
|
|
1519
|
-
...
|
|
1520
|
-
|
|
1521
844
|
## Cross-Domain Interactions
|
|
1522
845
|
|
|
1523
846
|
| This Domain | Direction | Other Domain | Mechanism |
|
|
@@ -1539,55 +862,84 @@ docs/
|
|
|
1539
862
|
|
|
1540
863
|
## Interactive Tour Visualization (Data-Driven Viewer)
|
|
1541
864
|
|
|
1542
|
-
AI Kit ships a pre-built \`tour-viewer.html\` that handles
|
|
865
|
+
AI Kit ships a pre-built \`tour-viewer.html\` that handles rendering, step navigation, code context, and interaction. The LLM's job is to produce valid JSON data and inject it into the shipped viewer. **Never generate tour HTML from scratch.**
|
|
866
|
+
|
|
867
|
+
Tour data must conform to [references/tour.schema.json](references/tour.schema.json).
|
|
1543
868
|
|
|
1544
869
|
### Usage
|
|
1545
870
|
|
|
1546
|
-
1. Generate JSON
|
|
871
|
+
1. Generate JSON that conforms to [references/tour.schema.json](references/tour.schema.json)
|
|
1547
872
|
2. Copy the shipped viewer from \`assets/tour-viewer.html\`
|
|
1548
873
|
3. Inject the JSON into the \`<script type="application/json" id="tour-data">\` block
|
|
1549
874
|
4. Save to \`docs/tours/interactive/{name}.html\`
|
|
1550
875
|
|
|
1551
|
-
### JSON
|
|
876
|
+
### JSON Example
|
|
1552
877
|
|
|
1553
878
|
\`\`\`json
|
|
1554
879
|
{
|
|
1555
|
-
"title": "Tour
|
|
1556
|
-
"description": "
|
|
1557
|
-
"
|
|
880
|
+
"title": "Authentication Tour",
|
|
881
|
+
"description": "Walk through the login path from entry point to token issuance.",
|
|
882
|
+
"version": "1.0.0",
|
|
883
|
+
"metadata": {
|
|
884
|
+
"author": "AI Kit",
|
|
885
|
+
"created": "2026-05-14T00:00:00Z",
|
|
886
|
+
"tags": ["authentication", "onboarding", "prerequisites:config"],
|
|
887
|
+
"difficulty": "intermediate"
|
|
888
|
+
},
|
|
1558
889
|
"steps": [
|
|
1559
890
|
{
|
|
1560
|
-
"
|
|
1561
|
-
"
|
|
1562
|
-
"
|
|
1563
|
-
"file": "src/
|
|
1564
|
-
"
|
|
1565
|
-
"
|
|
1566
|
-
"
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
891
|
+
"id": "entry-point",
|
|
892
|
+
"title": "Request Entry",
|
|
893
|
+
"description": "This handler receives the login request, validates the outer shape, and forwards work to the auth service.",
|
|
894
|
+
"file": "src/http/routes/login.ts",
|
|
895
|
+
"line": 1,
|
|
896
|
+
"endLine": 28,
|
|
897
|
+
"language": "ts",
|
|
898
|
+
"codeSnippet": "export async function loginRoute(req, res) { /* ... */ }",
|
|
899
|
+
"highlights": [
|
|
900
|
+
{
|
|
901
|
+
"line": 8,
|
|
902
|
+
"label": "Request validation starts here",
|
|
903
|
+
"style": "info"
|
|
904
|
+
}
|
|
905
|
+
],
|
|
906
|
+
"notes": [
|
|
907
|
+
"Introduces the request boundary.",
|
|
908
|
+
"The main concept here is input validation before auth logic."
|
|
909
|
+
]
|
|
1573
910
|
}
|
|
1574
911
|
]
|
|
1575
912
|
}
|
|
1576
913
|
\`\`\`
|
|
1577
914
|
|
|
915
|
+
### Tour Data Guidelines
|
|
916
|
+
|
|
917
|
+
1. **title**: Use a reader-facing tour name.
|
|
918
|
+
2. **description**: State the tour goal and scope in one or two sentences.
|
|
919
|
+
3. **version**: Set the schema version you are targeting.
|
|
920
|
+
4. **metadata**: Use optional metadata for authoring info, tags, timestamps, and difficulty.
|
|
921
|
+
5. **steps**: Order is defined by array position. Do not add a separate ordinal field.
|
|
922
|
+
6. **id**: Optional but recommended for stable references and analytics; use descriptive kebab-case when present.
|
|
923
|
+
7. **description** on each step: Explain what matters in this step and why it belongs in the tour.
|
|
924
|
+
8. **file**, **line**, and **endLine**: Point to the exact source span when possible.
|
|
925
|
+
9. **codeSnippet** and **language**: Provide a fallback snippet when the viewer cannot load the file directly.
|
|
926
|
+
10. **highlights**: Use line annotations for the few lines the reader should notice first.
|
|
927
|
+
11. **notes**: Capture concepts, tips, cautions, or prerequisite reminders that do not belong in the main description.
|
|
928
|
+
|
|
929
|
+
Mapping from the old contract to the current schema:
|
|
930
|
+
|
|
931
|
+
- Put learned concepts, tips, and follow-up reminders in \`notes\`.
|
|
932
|
+
- Put cross-cutting labels or prerequisite tags in \`metadata.tags\`.
|
|
933
|
+
- Do not emit legacy timing, sequencing, concept, or graph-edge fields from the previous contract.
|
|
934
|
+
|
|
1578
935
|
### Viewer Capabilities (automatic)
|
|
1579
936
|
|
|
1580
|
-
-
|
|
1581
|
-
-
|
|
1582
|
-
-
|
|
1583
|
-
-
|
|
1584
|
-
-
|
|
1585
|
-
-
|
|
1586
|
-
- **Clickable nodes**: Click any step node to jump to it
|
|
1587
|
-
- **Collapsible panel**: Toggle bottom panel to see more graph
|
|
1588
|
-
- **Dark theme**: Consistent slate/navy color scheme
|
|
1589
|
-
- **Responsive**: Full viewport with graph taking center stage
|
|
1590
|
-
- **AI Kit badge**: Fixed bottom-right attribution badge (auto-included)
|
|
937
|
+
- Step navigation with previous and next controls
|
|
938
|
+
- File context display using \`file\`, \`line\`, and \`endLine\`
|
|
939
|
+
- Syntax-highlighted fallback snippets using \`codeSnippet\` and \`language\`
|
|
940
|
+
- Line annotations from \`highlights\`
|
|
941
|
+
- Supplemental callouts from \`notes\`
|
|
942
|
+
- Responsive layout with shipped AI Kit branding
|
|
1591
943
|
|
|
1592
944
|
### File-Type Icons (automatic)
|
|
1593
945
|
|
|
@@ -1607,46 +959,148 @@ The viewer auto-detects file extensions and renders colored SVG icons:
|
|
|
1607
959
|
| .yaml, .yml | #cb171e (red) | "YML" text |
|
|
1608
960
|
| other | #6b7a90 (gray) | Generic file |
|
|
1609
961
|
|
|
1610
|
-
Icons appear automatically in step nodes. No configuration needed
|
|
1611
|
-
|
|
1612
|
-
### Tour Data Guidelines
|
|
1613
|
-
|
|
1614
|
-
1. **id**: Use kebab-case, descriptive (e.g., entry-point, auth-middleware, db-schema)
|
|
1615
|
-
2. **stepNumber**: Sequential 1-based numbering matching intended reading order
|
|
1616
|
-
3. **file**: Relative path from workspace root
|
|
1617
|
-
4. **explanation**: 1-3 sentences — what this file/module does and why it's important in the tour
|
|
1618
|
-
5. **learnsConcept**: Single concept name (2-4 words) the reader gains
|
|
1619
|
-
6. **dependencies**: Graph edges — which steps must be understood before this one
|
|
1620
|
-
7. **duration**: Estimated time for reader to absorb this step
|
|
962
|
+
Icons appear automatically in step nodes. No configuration is needed.
|
|
1621
963
|
|
|
1622
964
|
### Tour Generation Strategy
|
|
1623
965
|
|
|
1624
|
-
1. Identify entry points
|
|
1625
|
-
2. Trace critical
|
|
1626
|
-
3. Order
|
|
1627
|
-
4. Aim for 5-12 steps per tour
|
|
1628
|
-
5.
|
|
966
|
+
1. Identify entry points with \`entry_points\` analysis or \`scope_map\`.
|
|
967
|
+
2. Trace the critical reading path through the codebase.
|
|
968
|
+
3. Order steps so each step only depends on ideas already introduced by earlier steps.
|
|
969
|
+
4. Aim for 5-12 steps per tour; split longer tours by concern.
|
|
970
|
+
5. Let each step teach one main idea, with supporting detail in \`notes\`.
|
|
1629
971
|
|
|
1630
972
|
### Interactive C4 Architecture Visualization
|
|
1631
973
|
|
|
1632
974
|
For architecture documentation, generate interactive C4 diagrams using the shipped **c4-viewer.html** from the \`c4-architecture\` skill.
|
|
1633
975
|
|
|
1634
976
|
**Integration with docs skill:**
|
|
1635
|
-
- Architecture docs in \`docs/architecture/\`
|
|
1636
|
-
- Use the \`c4-architecture\` skill to generate C4 viewer HTML
|
|
1637
|
-
- The \`c4-architecture\` skill provides
|
|
977
|
+
- Architecture docs in \`docs/architecture/\` should have interactive HTML companions in \`docs/architecture/interactive/\`
|
|
978
|
+
- Use the \`c4-architecture\` skill to generate C4 viewer HTML; it handles JSON schema, ReactFlow rendering, and ELK auto-layout
|
|
979
|
+
- The \`c4-architecture\` skill provides zoom and pan, node search, detail panels, drag-to-rearrange, and consistent styling
|
|
1638
980
|
|
|
1639
981
|
**Workflow:**
|
|
1640
|
-
1. During
|
|
1641
|
-
2. For
|
|
982
|
+
1. During domain or architecture documentation work, identify system-level views.
|
|
983
|
+
2. For each architecture view such as system context, container, or component:
|
|
1642
984
|
- Generate C4 JSON data: \`{nodes: [{id, label, type, description, technology}], edges: [{from, to, label}]}\`
|
|
1643
985
|
- Use the \`c4-architecture\` skill to render interactive HTML
|
|
1644
986
|
- Save to \`docs/architecture/interactive/{view-name}.html\`
|
|
1645
|
-
3.
|
|
987
|
+
3. Link from the markdown docs to the interactive viewers.
|
|
988
|
+
|
|
989
|
+
**Critical:** Never generate architecture HTML from scratch. Always use the shipped \`c4-viewer.html\` via the \`c4-architecture\` skill.`},{file:`references/tour.schema.json`,content:`{
|
|
990
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
991
|
+
"title": "AIKIT Interactive Code Tour",
|
|
992
|
+
"description": "Schema for AI Kit interactive code tour data. The agent generates JSON matching this schema, which is injected into tour-viewer.html.",
|
|
993
|
+
"version": "1.0.0",
|
|
994
|
+
"type": "object",
|
|
995
|
+
"required": ["title", "steps"],
|
|
996
|
+
"properties": {
|
|
997
|
+
"title": {
|
|
998
|
+
"type": "string",
|
|
999
|
+
"description": "Tour title displayed in the viewer header"
|
|
1000
|
+
},
|
|
1001
|
+
"description": {
|
|
1002
|
+
"type": "string",
|
|
1003
|
+
"description": "Brief tour description shown below the title"
|
|
1004
|
+
},
|
|
1005
|
+
"version": {
|
|
1006
|
+
"type": "string",
|
|
1007
|
+
"description": "Schema version for forward compatibility",
|
|
1008
|
+
"default": "1.0.0"
|
|
1009
|
+
},
|
|
1010
|
+
"metadata": {
|
|
1011
|
+
"type": "object",
|
|
1012
|
+
"properties": {
|
|
1013
|
+
"author": { "type": "string" },
|
|
1014
|
+
"created": { "type": "string", "format": "date-time" },
|
|
1015
|
+
"tags": { "type": "array", "items": { "type": "string" } },
|
|
1016
|
+
"difficulty": { "type": "string", "enum": ["beginner", "intermediate", "advanced"] }
|
|
1017
|
+
}
|
|
1018
|
+
},
|
|
1019
|
+
"steps": {
|
|
1020
|
+
"type": "array",
|
|
1021
|
+
"minItems": 1,
|
|
1022
|
+
"items": {
|
|
1023
|
+
"type": "object",
|
|
1024
|
+
"required": ["title", "description"],
|
|
1025
|
+
"properties": {
|
|
1026
|
+
"title": {
|
|
1027
|
+
"type": "string",
|
|
1028
|
+
"description": "Step title shown in navigation"
|
|
1029
|
+
},
|
|
1030
|
+
"description": {
|
|
1031
|
+
"type": "string",
|
|
1032
|
+
"description": "Markdown content explaining this step"
|
|
1033
|
+
},
|
|
1034
|
+
"file": {
|
|
1035
|
+
"type": "string",
|
|
1036
|
+
"description": "Relative file path this step references"
|
|
1037
|
+
},
|
|
1038
|
+
"line": {
|
|
1039
|
+
"type": "integer",
|
|
1040
|
+
"description": "Starting line number in the file"
|
|
1041
|
+
},
|
|
1042
|
+
"endLine": {
|
|
1043
|
+
"type": "integer",
|
|
1044
|
+
"description": "Ending line number (for range highlights)"
|
|
1045
|
+
},
|
|
1046
|
+
"codeSnippet": {
|
|
1047
|
+
"type": "string",
|
|
1048
|
+
"description": "Code snippet to display if file is not available"
|
|
1049
|
+
},
|
|
1050
|
+
"language": {
|
|
1051
|
+
"type": "string",
|
|
1052
|
+
"description": "Language for syntax highlighting of codeSnippet"
|
|
1053
|
+
},
|
|
1054
|
+
"highlights": {
|
|
1055
|
+
"type": "array",
|
|
1056
|
+
"items": {
|
|
1057
|
+
"type": "object",
|
|
1058
|
+
"properties": {
|
|
1059
|
+
"line": { "type": "integer" },
|
|
1060
|
+
"label": { "type": "string" },
|
|
1061
|
+
"style": { "type": "string", "enum": ["info", "warning", "error", "success"] }
|
|
1062
|
+
},
|
|
1063
|
+
"required": ["line"]
|
|
1064
|
+
},
|
|
1065
|
+
"description": "Line-level highlights within the code"
|
|
1066
|
+
},
|
|
1067
|
+
"notes": {
|
|
1068
|
+
"type": "array",
|
|
1069
|
+
"items": { "type": "string" },
|
|
1070
|
+
"description": "Additional callouts or tips for this step"
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
}`},{file:`references/generation-pipeline.md`,content:`# Generation Pipeline Reference
|
|
1646
1077
|
|
|
1647
|
-
**CRITICAL:** NEVER generate architecture HTML from scratch. ALWAYS use the shipped c4-viewer.html via the \`c4-architecture\` skill. Hand-crafted HTML will be inconsistent and unprofessional.
|
|
1648
1078
|
## Documentation Generation Prompts
|
|
1649
1079
|
|
|
1080
|
+
Use document-type-specific output requirements. Do not ask the model to "write clearly", "document the feature", or "create comprehensive documentation" without attaching the right depth requirements.
|
|
1081
|
+
|
|
1082
|
+
### Document-Type Output Requirements
|
|
1083
|
+
|
|
1084
|
+
#### Tutorial Output Requirements
|
|
1085
|
+
- Include step-by-step code examples with expected output
|
|
1086
|
+
- Show common mistakes and how to fix them
|
|
1087
|
+
- Add prerequisite checks at the start
|
|
1088
|
+
|
|
1089
|
+
#### Reference Output Requirements
|
|
1090
|
+
- Include complete function signatures with all parameters and return types
|
|
1091
|
+
- Add usage examples for each public API
|
|
1092
|
+
- Document error codes and edge cases
|
|
1093
|
+
|
|
1094
|
+
#### Architecture Output Requirements
|
|
1095
|
+
- Include sequence diagrams for key interactions (Mermaid format)
|
|
1096
|
+
- Document error paths and failure modes
|
|
1097
|
+
- Show integration contracts between components
|
|
1098
|
+
|
|
1099
|
+
#### How-To / Guide Output Requirements
|
|
1100
|
+
- Include troubleshooting section for common issues
|
|
1101
|
+
- Add verification steps after each major action
|
|
1102
|
+
- Show expected vs actual output for validation
|
|
1103
|
+
|
|
1650
1104
|
Structured LLM prompt templates for generating high-quality documentation. Each produces strict JSON for consistent, parseable output.
|
|
1651
1105
|
|
|
1652
1106
|
### Tour Generation Prompt (2-Phase)
|
|
@@ -1680,28 +1134,40 @@ You are a developer onboarding guide. Given a ranked list of codebase modules wi
|
|
|
1680
1134
|
|
|
1681
1135
|
**Instructions:**
|
|
1682
1136
|
- Create 8-15 tour steps (adjust to codebase size)
|
|
1137
|
+
- Make step 1 a prerequisite check before deep navigation
|
|
1683
1138
|
- Start with entry points and high-level orchestration
|
|
1684
1139
|
- Progress to increasingly detailed/specialized modules
|
|
1685
1140
|
- Each step should teach ONE concept
|
|
1686
1141
|
- Group related files into single steps (max 3 files per step)
|
|
1687
1142
|
- End with cross-cutting concerns and extension points
|
|
1688
|
-
- Include
|
|
1143
|
+
- Include code snippets with expected output inside step descriptions when a step teaches executable behavior
|
|
1144
|
+
- Use notes to call out common mistakes and how to fix them
|
|
1689
1145
|
|
|
1690
|
-
**Respond ONLY with a JSON object
|
|
1146
|
+
**Respond ONLY with a JSON object matching** \`references/tour.schema.json\`**:**
|
|
1691
1147
|
{
|
|
1692
1148
|
"title": "Tour title",
|
|
1693
1149
|
"description": "One sentence overview",
|
|
1694
|
-
"
|
|
1150
|
+
"version": "1.0.0",
|
|
1151
|
+
"metadata": {
|
|
1152
|
+
"difficulty": "intermediate",
|
|
1153
|
+
"tags": ["onboarding", "tour"]
|
|
1154
|
+
},
|
|
1695
1155
|
"steps": [
|
|
1696
1156
|
{
|
|
1697
|
-
"
|
|
1698
|
-
"
|
|
1699
|
-
"
|
|
1700
|
-
"
|
|
1701
|
-
"
|
|
1702
|
-
"
|
|
1703
|
-
"
|
|
1704
|
-
"
|
|
1157
|
+
"title": "Start here — entry point",
|
|
1158
|
+
"description": "Markdown explanation with a prerequisite check, code example, and expected output.",
|
|
1159
|
+
"file": "src/index.ts",
|
|
1160
|
+
"line": 12,
|
|
1161
|
+
"endLine": 45,
|
|
1162
|
+
"codeSnippet": "const app = createApp();",
|
|
1163
|
+
"language": "ts",
|
|
1164
|
+
"highlights": [
|
|
1165
|
+
{ "line": 12, "label": "Entry point", "style": "info" }
|
|
1166
|
+
],
|
|
1167
|
+
"notes": [
|
|
1168
|
+
"Common mistake: bootstrapping the wrong entry file. Fix: start from the configured entry point.",
|
|
1169
|
+
"Expected output: the server or app shell initializes without runtime errors."
|
|
1170
|
+
]
|
|
1705
1171
|
}
|
|
1706
1172
|
]
|
|
1707
1173
|
}
|
|
@@ -1710,7 +1176,7 @@ You are a developer onboarding guide. Given a ranked list of codebase modules wi
|
|
|
1710
1176
|
### File Documentation Prompt
|
|
1711
1177
|
|
|
1712
1178
|
\`\`\`
|
|
1713
|
-
You are a technical writer
|
|
1179
|
+
You are a technical writer producing developer reference documentation for this source file.
|
|
1714
1180
|
|
|
1715
1181
|
**File:** {{FILE_PATH}}
|
|
1716
1182
|
**Content:**
|
|
@@ -1719,18 +1185,36 @@ You are a technical writer. Document this source file for developer reference.
|
|
|
1719
1185
|
**Module's role in architecture:** {{MODULE_ROLE}}
|
|
1720
1186
|
**Layer:** {{LAYER}}
|
|
1721
1187
|
|
|
1188
|
+
**Reference output requirements:**
|
|
1189
|
+
- Include complete function signatures with all parameters and return types
|
|
1190
|
+
- Add usage examples for each public API
|
|
1191
|
+
- Document error codes and edge cases
|
|
1192
|
+
|
|
1722
1193
|
**Respond ONLY with a JSON object:**
|
|
1723
1194
|
{
|
|
1724
1195
|
"title": "Module name — one-line purpose",
|
|
1725
1196
|
"overview": "2-3 sentence description of what this module does and why it exists",
|
|
1726
1197
|
"publicAPI": [
|
|
1727
|
-
{
|
|
1198
|
+
{
|
|
1199
|
+
"name": "functionName",
|
|
1200
|
+
"signature": "export function functionName(input: Input): Output",
|
|
1201
|
+
"parameters": [
|
|
1202
|
+
{ "name": "input", "type": "Input", "required": true, "description": "what this parameter controls" }
|
|
1203
|
+
],
|
|
1204
|
+
"returns": { "type": "Output", "description": "what comes back" },
|
|
1205
|
+
"description": "what it does",
|
|
1206
|
+
"example": "brief usage"
|
|
1207
|
+
}
|
|
1728
1208
|
],
|
|
1729
1209
|
"dependencies": [
|
|
1730
1210
|
{ "module": "import path", "purpose": "why this dependency" }
|
|
1731
1211
|
],
|
|
1732
1212
|
"patterns": ["Pattern names used (e.g., Factory, Observer, Middleware)"],
|
|
1733
1213
|
"gotchas": ["Non-obvious behaviors or edge cases"],
|
|
1214
|
+
"errorCodes": [
|
|
1215
|
+
{ "code": "ERR_EXAMPLE", "when": "when this failure happens", "resolution": "how to recover or debug" }
|
|
1216
|
+
],
|
|
1217
|
+
"edgeCases": ["Edge case 1", "Edge case 2"],
|
|
1734
1218
|
"relatedModules": ["paths to related files for cross-reference"]
|
|
1735
1219
|
}
|
|
1736
1220
|
\`\`\`
|
|
@@ -1738,7 +1222,7 @@ You are a technical writer. Document this source file for developer reference.
|
|
|
1738
1222
|
### Domain Documentation Prompt
|
|
1739
1223
|
|
|
1740
1224
|
\`\`\`
|
|
1741
|
-
You are a domain
|
|
1225
|
+
You are a domain and architecture analyst. Given files belonging to a business domain, document the domain model and the architecture that supports it.
|
|
1742
1226
|
|
|
1743
1227
|
**Domain:** {{DOMAIN_NAME}}
|
|
1744
1228
|
**Files in this domain:**
|
|
@@ -1750,6 +1234,11 @@ You are a domain-driven design analyst. Given files belonging to a business doma
|
|
|
1750
1234
|
**Cross-domain relationships:**
|
|
1751
1235
|
{{CROSS_DOMAIN_EDGES}}
|
|
1752
1236
|
|
|
1237
|
+
**Architecture output requirements:**
|
|
1238
|
+
- Include sequence diagrams for key interactions (Mermaid format)
|
|
1239
|
+
- Document error paths and failure modes
|
|
1240
|
+
- Show integration contracts between components
|
|
1241
|
+
|
|
1753
1242
|
**Respond ONLY with a JSON object:**
|
|
1754
1243
|
{
|
|
1755
1244
|
"domain": "Domain name",
|
|
@@ -1767,6 +1256,13 @@ You are a domain-driven design analyst. Given files belonging to a business doma
|
|
|
1767
1256
|
"flows": [
|
|
1768
1257
|
{ "name": "Flow name", "steps": ["Step 1 → file:fn", "Step 2 → file:fn"], "trigger": "What initiates this" }
|
|
1769
1258
|
],
|
|
1259
|
+
"sequenceDiagramMermaid": "sequenceDiagram\\n participant Client\\n participant Domain\\n participant Dependency\\n Client->>Domain: Trigger flow\\n Domain->>Dependency: Call contract\\n Dependency-->>Domain: Response",
|
|
1260
|
+
"integrationContracts": [
|
|
1261
|
+
{ "from": "Caller", "to": "Dependency", "contract": "payload/schema/api", "notes": "why this boundary exists" }
|
|
1262
|
+
],
|
|
1263
|
+
"failureModes": [
|
|
1264
|
+
{ "mode": "Dependency timeout", "effect": "Flow stalls", "recovery": "retry or fallback" }
|
|
1265
|
+
],
|
|
1770
1266
|
"crossDomainInteractions": [
|
|
1771
1267
|
{ "direction": "outgoing|incoming", "otherDomain": "Name", "mechanism": "API/event/import", "purpose": "Why" }
|
|
1772
1268
|
]
|
|
@@ -1775,7 +1271,7 @@ You are a domain-driven design analyst. Given files belonging to a business doma
|
|
|
1775
1271
|
|
|
1776
1272
|
## Documentation Generation Pipeline
|
|
1777
1273
|
|
|
1778
|
-
Orchestrate
|
|
1274
|
+
Orchestrate phased documentation generation with document-type-specific outputs and validation.
|
|
1779
1275
|
|
|
1780
1276
|
### Phase 1 — Inventory (deterministic)
|
|
1781
1277
|
\`\`\`
|
|
@@ -1864,89 +1360,377 @@ graph({ action: "find_nodes" }) # Full module graph
|
|
|
1864
1360
|
5. Verify all interactive HTML files open correctly and contain valid JSON data
|
|
1865
1361
|
\`\`\`
|
|
1866
1362
|
|
|
1867
|
-
### Output Structure
|
|
1868
|
-
\`\`\`
|
|
1869
|
-
docs/
|
|
1870
|
-
├── tours/
|
|
1871
|
-
│ ├── getting-started.md # Primary tour (Mermaid diagrams)
|
|
1872
|
-
│ ├── advanced-internals.md # Deep-dive tour
|
|
1873
|
-
│ └── interactive/
|
|
1874
|
-
│ ├── getting-started.html # Shipped tour-viewer.html + JSON data
|
|
1875
|
-
│ └── advanced-internals.html
|
|
1876
|
-
├── architecture/
|
|
1877
|
-
│ ├── c4-context.md
|
|
1878
|
-
│ ├── c4-containers.md
|
|
1879
|
-
│ ├── interactive/
|
|
1880
|
-
│ │ ├── overview.html # React Flow architecture
|
|
1881
|
-
│ │ └── per-service.html
|
|
1882
|
-
│ └── domains/
|
|
1883
|
-
│ ├── authentication.md
|
|
1884
|
-
│ └── billing.md
|
|
1885
|
-
├── reference/
|
|
1886
|
-
│ └── modules/ # Per-module API docs
|
|
1887
|
-
└── guides/
|
|
1888
|
-
└── contributing.md
|
|
1889
|
-
\`\`\`
|
|
1363
|
+
### Output Structure
|
|
1364
|
+
\`\`\`
|
|
1365
|
+
docs/
|
|
1366
|
+
├── tours/
|
|
1367
|
+
│ ├── getting-started.md # Primary tour (Mermaid diagrams)
|
|
1368
|
+
│ ├── advanced-internals.md # Deep-dive tour
|
|
1369
|
+
│ └── interactive/
|
|
1370
|
+
│ ├── getting-started.html # Shipped tour-viewer.html + JSON data
|
|
1371
|
+
│ └── advanced-internals.html
|
|
1372
|
+
├── architecture/
|
|
1373
|
+
│ ├── c4-context.md
|
|
1374
|
+
│ ├── c4-containers.md
|
|
1375
|
+
│ ├── interactive/
|
|
1376
|
+
│ │ ├── overview.html # React Flow architecture
|
|
1377
|
+
│ │ └── per-service.html
|
|
1378
|
+
│ └── domains/
|
|
1379
|
+
│ ├── authentication.md
|
|
1380
|
+
│ └── billing.md
|
|
1381
|
+
├── reference/
|
|
1382
|
+
│ └── modules/ # Per-module API docs
|
|
1383
|
+
└── guides/
|
|
1384
|
+
└── contributing.md
|
|
1385
|
+
\`\`\`
|
|
1386
|
+
|
|
1387
|
+
## Framework Context Injection
|
|
1388
|
+
|
|
1389
|
+
When generating documentation for a specific framework, inject framework-specific conventions into LLM prompts to improve generation quality:
|
|
1390
|
+
|
|
1391
|
+
### Detection
|
|
1392
|
+
\`\`\`
|
|
1393
|
+
# Auto-detect framework from project files:
|
|
1394
|
+
- package.json → "next", "react", "express", "nestjs", "@angular/core"
|
|
1395
|
+
- requirements.txt → "django", "flask", "fastapi"
|
|
1396
|
+
- go.mod → "gin", "fiber", "echo"
|
|
1397
|
+
- Cargo.toml → "actix-web", "axum", "rocket"
|
|
1398
|
+
\`\`\`
|
|
1399
|
+
|
|
1400
|
+
### Addendum Format
|
|
1401
|
+
\`\`\`markdown
|
|
1402
|
+
## {{FRAMEWORK}} Documentation Addendum
|
|
1403
|
+
(Injected into documentation prompts when {{FRAMEWORK}} is detected)
|
|
1404
|
+
|
|
1405
|
+
### Canonical Documentation Structure
|
|
1406
|
+
|
|
1407
|
+
| Path Pattern | Doc Type | Template |
|
|
1408
|
+
|---|---|---|
|
|
1409
|
+
| {{src_pattern}} | {{doc_type}} | {{which template to use}} |
|
|
1410
|
+
|
|
1411
|
+
### Tour Conventions
|
|
1412
|
+
|
|
1413
|
+
- Tour starts at: {{entry_point_pattern}}
|
|
1414
|
+
- Key learning progression: {{progression}}
|
|
1415
|
+
- Framework-specific concepts to teach: {{concepts}}
|
|
1416
|
+
|
|
1417
|
+
### Domain Conventions
|
|
1418
|
+
|
|
1419
|
+
- Where domains live: {{domain_path_pattern}}
|
|
1420
|
+
- How domains are bounded: {{boundary_mechanism}}
|
|
1421
|
+
\`\`\`
|
|
1422
|
+
|
|
1423
|
+
### Example: Next.js Addendum
|
|
1424
|
+
\`\`\`
|
|
1425
|
+
## Next.js Documentation Addendum
|
|
1426
|
+
|
|
1427
|
+
### Canonical Documentation Structure
|
|
1428
|
+
| Path Pattern | Doc Type | Template |
|
|
1429
|
+
|---|---|---|
|
|
1430
|
+
| app/layout.tsx | Architecture | Root layout, providers, theme |
|
|
1431
|
+
| app/**/page.tsx | Feature docs | Page-level feature documentation |
|
|
1432
|
+
| app/api/** | API Reference | Endpoint documentation |
|
|
1433
|
+
| lib/** | Reference | Utility/service documentation |
|
|
1434
|
+
| components/** | Component docs | Props, usage examples, variants |
|
|
1435
|
+
|
|
1436
|
+
### Tour Conventions
|
|
1437
|
+
- Tour starts at: app/layout.tsx (root) → app/page.tsx (home)
|
|
1438
|
+
- Key progression: Layout → Pages → API Routes → Lib → Components
|
|
1439
|
+
- Framework concepts: App Router, Server Components, Server Actions, Middleware
|
|
1440
|
+
|
|
1441
|
+
### Domain Conventions
|
|
1442
|
+
- Domains live in: app/(domain)/ or features/(domain)/
|
|
1443
|
+
- Bounded by: Route groups or feature folders
|
|
1444
|
+
\`\`\``},{file:`references/prd-template.md`,content:`# Living PRD Template
|
|
1445
|
+
|
|
1446
|
+
A Product Requirements Document (PRD) that evolves with the codebase. Each capability has a unique \`capability_id\` for cross-referencing.
|
|
1447
|
+
|
|
1448
|
+
## PRD Structure
|
|
1449
|
+
|
|
1450
|
+
### 1. Overview
|
|
1451
|
+
- **Product Name**: [name]
|
|
1452
|
+
- **Version**: [semantic version]
|
|
1453
|
+
- **Last Updated**: [ISO date]
|
|
1454
|
+
- **Status**: draft | review | approved | deprecated
|
|
1455
|
+
|
|
1456
|
+
### 2. Problem Statement
|
|
1457
|
+
What problem does this solve? Who has this problem? What's the impact of not solving it?
|
|
1458
|
+
|
|
1459
|
+
### 3. Goals & Non-Goals
|
|
1460
|
+
|
|
1461
|
+
| Goal | Measurable Target | Priority |
|
|
1462
|
+
|------|-------------------|----------|
|
|
1463
|
+
| [goal] | [metric] | P0/P1/P2 |
|
|
1464
|
+
|
|
1465
|
+
**Non-Goals:** Explicitly list what this does NOT aim to solve.
|
|
1466
|
+
|
|
1467
|
+
### 4. Capabilities
|
|
1468
|
+
|
|
1469
|
+
Each capability has a unique ID for tracing requirements → code → tests → docs.
|
|
1470
|
+
|
|
1471
|
+
| capability_id | Name | Description | Status |
|
|
1472
|
+
|---------------|------|-------------|--------|
|
|
1473
|
+
| CAP-001 | [name] | [description] | proposed/approved/implemented/verified |
|
|
1474
|
+
|
|
1475
|
+
#### Capability Detail Template
|
|
1476
|
+
|
|
1477
|
+
\`\`\`yaml
|
|
1478
|
+
capability_id: CAP-XXX
|
|
1479
|
+
name: [Descriptive Name]
|
|
1480
|
+
description: [What it does]
|
|
1481
|
+
acceptance_criteria:
|
|
1482
|
+
- [Testable criterion 1]
|
|
1483
|
+
- [Testable criterion 2]
|
|
1484
|
+
dependencies: [CAP-YYY, CAP-ZZZ]
|
|
1485
|
+
priority: P0 | P1 | P2
|
|
1486
|
+
status: proposed | approved | implemented | verified
|
|
1487
|
+
traceability:
|
|
1488
|
+
tests: [test file paths]
|
|
1489
|
+
docs: [doc file paths]
|
|
1490
|
+
code: [implementation file paths]
|
|
1491
|
+
\`\`\`
|
|
1492
|
+
|
|
1493
|
+
### 5. User Stories
|
|
1494
|
+
|
|
1495
|
+
\`\`\`
|
|
1496
|
+
As a [role], I want [capability] so that [benefit].
|
|
1497
|
+
Acceptance: [testable criteria]
|
|
1498
|
+
Links: CAP-XXX
|
|
1499
|
+
\`\`\`
|
|
1500
|
+
|
|
1501
|
+
### 6. Technical Constraints
|
|
1502
|
+
- Performance requirements
|
|
1503
|
+
- Security requirements
|
|
1504
|
+
- Compatibility requirements
|
|
1505
|
+
- Infrastructure constraints
|
|
1506
|
+
|
|
1507
|
+
### 7. Architecture Decisions
|
|
1508
|
+
Link to ADRs: \`docs/decisions/ADR-NNN-*.md\`
|
|
1509
|
+
|
|
1510
|
+
### 8. Milestones & Phases
|
|
1511
|
+
|
|
1512
|
+
| Phase | Capabilities | Target | Status |
|
|
1513
|
+
|-------|-------------|--------|--------|
|
|
1514
|
+
| MVP | CAP-001, CAP-002 | [date] | planned/active/complete |
|
|
1515
|
+
|
|
1516
|
+
### 9. Risk Register
|
|
1517
|
+
|
|
1518
|
+
| Risk | Impact | Likelihood | Mitigation | Owner |
|
|
1519
|
+
|------|--------|------------|------------|-------|
|
|
1520
|
+
| [risk] | H/M/L | H/M/L | [strategy] | [who] |
|
|
1521
|
+
|
|
1522
|
+
### 10. Appendix
|
|
1523
|
+
- Glossary of terms
|
|
1524
|
+
- Related documents
|
|
1525
|
+
- Change log
|
|
1526
|
+
|
|
1527
|
+
---
|
|
1528
|
+
|
|
1529
|
+
## PRD Index Schema (prd.index.json)
|
|
1530
|
+
|
|
1531
|
+
The PRD index tracks all PRDs and their capabilities for automated cross-referencing:
|
|
1532
|
+
|
|
1533
|
+
\`\`\`json
|
|
1534
|
+
{
|
|
1535
|
+
"prds": [
|
|
1536
|
+
{
|
|
1537
|
+
"id": "PRD-001",
|
|
1538
|
+
"title": "Feature Name",
|
|
1539
|
+
"path": "docs/prds/PRD-001-feature-name.md",
|
|
1540
|
+
"status": "approved",
|
|
1541
|
+
"capabilities": ["CAP-001", "CAP-002"],
|
|
1542
|
+
"lastUpdated": "2024-01-15"
|
|
1543
|
+
}
|
|
1544
|
+
],
|
|
1545
|
+
"capabilities": {
|
|
1546
|
+
"CAP-001": {
|
|
1547
|
+
"prd": "PRD-001",
|
|
1548
|
+
"status": "implemented",
|
|
1549
|
+
"tests": ["tests/cap-001.test.ts"],
|
|
1550
|
+
"code": ["src/features/cap-001/"]
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
\`\`\`
|
|
1555
|
+
|
|
1556
|
+
## When to Create/Update PRDs
|
|
1557
|
+
|
|
1558
|
+
| Trigger | Action |
|
|
1559
|
+
|---------|--------|
|
|
1560
|
+
| New feature request | Create new PRD with capability_ids |
|
|
1561
|
+
| Flow design step | Reference PRD, add capabilities |
|
|
1562
|
+
| Implementation complete | Update capability status → implemented |
|
|
1563
|
+
| Tests passing | Update capability status → verified |
|
|
1564
|
+
| Architecture decision | Link ADR to affected capabilities |
|
|
1565
|
+
`},{file:`references/architecture-blueprint.md`,content:`# Architecture Blueprint Reference
|
|
1566
|
+
|
|
1567
|
+
## Architecture Blueprint Generation
|
|
1568
|
+
|
|
1569
|
+
When bootstrapping \`docs/\` for the first time or refreshing architecture documentation, generate a comprehensive architecture blueprint. This replaces manual documentation with tool-driven analysis.
|
|
1570
|
+
|
|
1571
|
+
### Blueprint Workflow
|
|
1572
|
+
|
|
1573
|
+
\`\`\`
|
|
1574
|
+
Step 1: Detect & Analyze
|
|
1575
|
+
analyze({ aspect: "structure", path: "." }) → project layout, packages, layers
|
|
1576
|
+
analyze({ aspect: "patterns", path: "." }) → conventions, design patterns
|
|
1577
|
+
analyze({ aspect: "entry_points", path: "." }) → API surface, CLI entry points
|
|
1578
|
+
|
|
1579
|
+
Step 2: Map Dependencies
|
|
1580
|
+
analyze({ aspect: "dependencies", path: "." }) → import graph, cross-package edges
|
|
1581
|
+
graph({ action: 'find_nodes', name_pattern: '*' }) → module graph nodes
|
|
1582
|
+
graph({ action: 'neighbors', node_id: '...' }) → dependency directions
|
|
1583
|
+
|
|
1584
|
+
Step 3: Visualize
|
|
1585
|
+
analyze({ aspect: "diagram", path: "." }) → Mermaid architecture diagrams
|
|
1586
|
+
Delegate to c4-architecture skill → C4 context/container/component views
|
|
1587
|
+
|
|
1588
|
+
Step 4: Synthesize
|
|
1589
|
+
produce_knowledge({ path: "." }) → comprehensive analysis
|
|
1590
|
+
Combine outputs into docs/ structure
|
|
1591
|
+
\`\`\`
|
|
1592
|
+
|
|
1593
|
+
### Blueprint Sections
|
|
1594
|
+
|
|
1595
|
+
The architecture blueprint should cover these areas (adapted from the Architecture Blueprint Generator pattern):
|
|
1596
|
+
|
|
1597
|
+
#### 1. Architecture Detection & Analysis
|
|
1598
|
+
- **Auto-detect**: Project type, framework, architectural pattern (Clean Architecture, Microservices, Layered, etc.)
|
|
1599
|
+
- **Tools**: \`analyze({ aspect: "structure", ... })\` → folder organization, \`analyze({ aspect: "patterns", ... })\` → framework detection, \`analyze({ aspect: "dependencies", ... })\` → dependency flow
|
|
1600
|
+
- **Output**: \`docs/architecture/overview.md\` header section
|
|
1601
|
+
|
|
1602
|
+
#### 2. Architectural Overview
|
|
1603
|
+
- Guiding principles from code structure
|
|
1604
|
+
- Architectural boundaries and enforcement mechanisms
|
|
1605
|
+
- Hybrid patterns or adaptations
|
|
1606
|
+
- **Tools**: \`produce_knowledge\` + \`analyze({ aspect: "structure", ... })\`
|
|
1607
|
+
- **Output**: \`docs/architecture/overview.md\` main body
|
|
1608
|
+
|
|
1609
|
+
#### 3. Architecture Visualization
|
|
1610
|
+
- High-level subsystem diagram
|
|
1611
|
+
- Component interaction diagrams
|
|
1612
|
+
- Data flow diagrams
|
|
1613
|
+
- **Tools**: \`analyze({ aspect: "diagram", ... })\` + \`c4-architecture\` skill
|
|
1614
|
+
- **Output**: \`docs/architecture/overview.md\` diagrams + \`docs/architecture/diagrams/\`
|
|
1615
|
+
|
|
1616
|
+
#### 4. Core Architectural Components
|
|
1617
|
+
For each major component:
|
|
1618
|
+
- Purpose and responsibility
|
|
1619
|
+
- Internal structure
|
|
1620
|
+
- Key abstractions
|
|
1621
|
+
- Interaction patterns
|
|
1622
|
+
- **Tools**: \`analyze({ aspect: "symbols", path: "component/" })\` + \`compact({ path, query: "exports" })\`
|
|
1623
|
+
- **Output**: \`docs/architecture/components/{name}.md\`
|
|
1624
|
+
|
|
1625
|
+
#### 5. Layers & Dependencies
|
|
1626
|
+
- Layer structure as implemented
|
|
1627
|
+
- Dependency rules between layers
|
|
1628
|
+
- Abstraction mechanisms for separation
|
|
1629
|
+
- Circular dependencies or violations
|
|
1630
|
+
- **Tools**: \`analyze({ aspect: "dependencies", ... })\` + \`graph({ action: 'neighbors' })\`
|
|
1631
|
+
- **Output**: \`docs/architecture/overview.md\` layers section
|
|
1632
|
+
|
|
1633
|
+
#### 6. Cross-Cutting Concerns
|
|
1634
|
+
Document implementation patterns for:
|
|
1635
|
+
- Error handling & resilience
|
|
1636
|
+
- Logging & observability
|
|
1637
|
+
- Validation patterns
|
|
1638
|
+
- Configuration management
|
|
1639
|
+
- **Tools**: \`analyze({ aspect: "patterns", ... })\` + \`search({ query: "error handling" })\`
|
|
1640
|
+
- **Output**: \`docs/architecture/overview.md\` cross-cutting section
|
|
1641
|
+
|
|
1642
|
+
#### 7. Testing Architecture
|
|
1643
|
+
- Test framework and strategy
|
|
1644
|
+
- Test boundary patterns (unit, integration, e2e)
|
|
1645
|
+
- Test file conventions
|
|
1646
|
+
- **Tools**: \`analyze({ aspect: "patterns", ... })\` + \`search({ query: "test" })\`
|
|
1647
|
+
- **Output**: \`docs/guides/testing.md\`
|
|
1648
|
+
|
|
1649
|
+
#### 8. Extension & Evolution
|
|
1650
|
+
- How to add features while preserving architecture
|
|
1651
|
+
- Component creation patterns
|
|
1652
|
+
- Integration patterns for external systems
|
|
1653
|
+
- **Tools**: \`analyze({ aspect: "entry_points", ... })\` + \`analyze({ aspect: "patterns", ... })\`
|
|
1654
|
+
- **Output**: \`docs/guides/contributing.md\` or \`docs/architecture/overview.md\` extension section
|
|
1655
|
+
|
|
1656
|
+
## Skill Integration
|
|
1890
1657
|
|
|
1891
|
-
|
|
1658
|
+
### \`adr-skill\` Integration
|
|
1659
|
+
- All ADRs live in \`docs/decisions/\`
|
|
1660
|
+
- When the docs-sync step detects an architecture decision was made during the flow, delegate to \`adr-skill\`
|
|
1661
|
+
- After \`adr-skill\` creates/updates an ADR, update \`docs/decisions/index.md\`
|
|
1662
|
+
- Include the Source column linking to the flow artifact where the decision was designed.
|
|
1663
|
+
- Cross-reference ADRs from component docs where relevant
|
|
1892
1664
|
|
|
1893
|
-
|
|
1665
|
+
### \`c4-architecture\` Integration
|
|
1666
|
+
- Architecture diagrams live in \`docs/architecture/\`
|
|
1667
|
+
- When the docs-sync step detects structural changes (new packages, changed boundaries), delegate to \`c4-architecture\`
|
|
1668
|
+
- Use Mermaid format for docs files (not HTML) — markdown renders in GitHub
|
|
1669
|
+
- Reference diagrams from component docs
|
|
1894
1670
|
|
|
1895
|
-
###
|
|
1896
|
-
\`\`\`
|
|
1897
|
-
# Auto-detect framework from project files:
|
|
1898
|
-
- package.json → "next", "react", "express", "nestjs", "@angular/core"
|
|
1899
|
-
- requirements.txt → "django", "flask", "fastapi"
|
|
1900
|
-
- go.mod → "gin", "fiber", "echo"
|
|
1901
|
-
- Cargo.toml → "actix-web", "axum", "rocket"
|
|
1902
|
-
\`\`\`
|
|
1671
|
+
### Mermaid Syntax Rules
|
|
1903
1672
|
|
|
1904
|
-
|
|
1905
|
-
\`\`\`markdown
|
|
1906
|
-
## {{FRAMEWORK}} Documentation Addendum
|
|
1907
|
-
(Injected into documentation prompts when {{FRAMEWORK}} is detected)
|
|
1673
|
+
When generating Mermaid diagrams in documentation:
|
|
1908
1674
|
|
|
1909
|
-
|
|
1675
|
+
- **Quote node labels containing special characters** — Names with \`@\`, \`/\`, or other special characters must be wrapped in double quotes inside square brackets: \`subgraph Commons["@scope/package-name"]\`, \`NodeId["@org/lib"]\`
|
|
1676
|
+
- **Quote subgraph titles with special characters** — \`subgraph Title["@scope/name"]\` not \`subgraph @scope/name\`
|
|
1677
|
+
- Node IDs (aliases) must not contain special characters — use plain alphanumeric IDs and put the display name in \`["..."]\``},{file:`SKILL.md`,content:`---
|
|
1678
|
+
name: docs
|
|
1679
|
+
description: "Living documentation management — Diátaxis framework, docs/ convention, create/update rules, staleness detection, integration with adr-skill and c4-architecture."
|
|
1680
|
+
metadata:
|
|
1681
|
+
category: cross-cutting
|
|
1682
|
+
domain: general
|
|
1683
|
+
applicability: on-demand
|
|
1684
|
+
inputs: [code-changes, flow-artifacts, architecture]
|
|
1685
|
+
outputs: [documentation]
|
|
1686
|
+
relatedSkills: [adr-skill, c4-architecture]
|
|
1687
|
+
internal: true
|
|
1688
|
+
---
|
|
1910
1689
|
|
|
1911
|
-
|
|
1912
|
-
|---|---|---|
|
|
1913
|
-
| {{src_pattern}} | {{doc_type}} | {{which template to use}} |
|
|
1690
|
+
# Docs — Living Documentation Skill
|
|
1914
1691
|
|
|
1915
|
-
|
|
1692
|
+
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.
|
|
1916
1693
|
|
|
1917
|
-
|
|
1918
|
-
- Key learning progression: {{progression}}
|
|
1919
|
-
- Framework-specific concepts to teach: {{concepts}}
|
|
1694
|
+
## Principles
|
|
1920
1695
|
|
|
1921
|
-
|
|
1696
|
+
1. **Living, not legacy** — Documentation is updated as code changes, never as a separate "docs sprint"
|
|
1697
|
+
2. **One source of truth** — Never duplicate what's in code comments, READMEs, or inline JSDoc
|
|
1698
|
+
3. **Diátaxis framework** — Organize docs into four categories using the two-question compass:
|
|
1699
|
+
- **Q1**: Is the reader trying to **do** something (action) or **understand** something (cognition)?
|
|
1700
|
+
- **Q2**: Is the reader **learning** (study) or **working** (work)?
|
|
1701
|
+
- Action+Study → Tutorial · Action+Work → How-to · Cognition+Work → Reference · Cognition+Study → Explanation
|
|
1702
|
+
- See [references/diataxis-reference.md](references/diataxis-reference.md) for the full classification system
|
|
1703
|
+
4. **Minimal but complete** — Create docs only when they add value beyond what code communicates
|
|
1704
|
+
5. **Delegate to specialists** — Architecture diagrams → \`c4-architecture\` skill. Decision records → \`adr-skill\`
|
|
1922
1705
|
|
|
1923
|
-
|
|
1924
|
-
- How domains are bounded: {{boundary_mechanism}}
|
|
1925
|
-
\`\`\`
|
|
1706
|
+
## Documentation Modes
|
|
1926
1707
|
|
|
1927
|
-
|
|
1928
|
-
\`\`\`
|
|
1929
|
-
## Next.js Documentation Addendum
|
|
1708
|
+
This skill operates in two modes, often combined:
|
|
1930
1709
|
|
|
1931
|
-
###
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
| app/api/** | API Reference | Endpoint documentation |
|
|
1937
|
-
| lib/** | Reference | Utility/service documentation |
|
|
1938
|
-
| components/** | Component docs | Props, usage examples, variants |
|
|
1710
|
+
### Source-Only Mode
|
|
1711
|
+
Generate documentation from code analysis alone. Used when:
|
|
1712
|
+
- Bootstrapping \`docs/\` for the first time (\`produce_knowledge\`, \`analyze_*\` tools)
|
|
1713
|
+
- Running outside a flow context (manual documentation refresh)
|
|
1714
|
+
- Flow produced no artifacts (auto-skipped design step)
|
|
1939
1715
|
|
|
1940
|
-
###
|
|
1941
|
-
|
|
1942
|
-
- Key progression: Layout → Pages → API Routes → Lib → Components
|
|
1943
|
-
- Framework concepts: App Router, Server Components, Server Actions, Middleware
|
|
1716
|
+
### Flow-Aware Mode (Primary)
|
|
1717
|
+
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.
|
|
1944
1718
|
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1719
|
+
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*.
|
|
1720
|
+
|
|
1721
|
+
**Artifact reading sequence:**
|
|
1722
|
+
\`\`\`
|
|
1723
|
+
flow({ action: 'status' }) # Get artifactsPath
|
|
1724
|
+
find({ pattern: "*.md", path: "<artifactsPath>" }) # Discover all artifacts
|
|
1725
|
+
digest({ sources: [ # Compress into working context
|
|
1726
|
+
{ path: "<found-artifact-1>" },
|
|
1727
|
+
{ path: "<found-artifact-2>" },
|
|
1728
|
+
...
|
|
1729
|
+
]})
|
|
1948
1730
|
\`\`\`
|
|
1949
1731
|
|
|
1732
|
+
See [references/flow-artifacts-guide.md](references/flow-artifacts-guide.md) for the artifact catalog and artifact-to-documentation mapping.
|
|
1733
|
+
|
|
1950
1734
|
## Rules for the \`_docs-sync\` Epilogue Step
|
|
1951
1735
|
|
|
1952
1736
|
When this skill is loaded during the \`_docs-sync\` epilogue:
|
|
@@ -1987,9 +1771,9 @@ For each doc action identified in Step 1, determine the Diátaxis quadrant:
|
|
|
1987
1771
|
1. Ask: **Action or Cognition?** Is the reader doing something or understanding something?
|
|
1988
1772
|
2. Ask: **Study or Work?** Is the reader learning or applying?
|
|
1989
1773
|
3. Match the answer pair to a quadrant → pick the target directory
|
|
1990
|
-
4. If ambiguous → consult [references/diataxis-
|
|
1774
|
+
4. If ambiguous → consult [references/diataxis-reference.md](references/diataxis-reference.md) for edge cases
|
|
1991
1775
|
|
|
1992
|
-
Run the [quality checklist](references/diataxis-
|
|
1776
|
+
Run the [quality checklist](references/diataxis-reference.md) against any doc created or substantially modified.
|
|
1993
1777
|
|
|
1994
1778
|
### 2. Apply the Mapping
|
|
1995
1779
|
|
|
@@ -2043,6 +1827,183 @@ If docs were added/removed, update \`docs/README.md\` index.
|
|
|
2043
1827
|
|
|
2044
1828
|
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.
|
|
2045
1829
|
|
|
1830
|
+
## AI Kit Tools for Documentation
|
|
1831
|
+
|
|
1832
|
+
Use these existing AI Kit tools to generate documentation content — never write docs from scratch when a tool can provide the foundation:
|
|
1833
|
+
|
|
1834
|
+
| Documentation Task | AI Kit Tool | What It Provides |
|
|
1835
|
+
|---|---|---|
|
|
1836
|
+
| Project overview | \`produce_knowledge({ path: "." })\` | Comprehensive analysis: structure, patterns, dependencies → \`docs/README.md\` |
|
|
1837
|
+
| Architecture overview | \`analyze({ aspect: "structure", path: "." })\` | File tree, package layout, layer organization → \`docs/architecture/overview.md\` |
|
|
1838
|
+
| Architecture diagrams | \`analyze({ aspect: "diagram", path: "." })\` | Mermaid diagrams of component relationships → \`docs/architecture/\` |
|
|
1839
|
+
| Dependency map | \`analyze({ aspect: "dependencies", path: "." })\` | Import graph, cross-package edges → \`docs/architecture/overview.md\` dependencies section |
|
|
1840
|
+
| Component analysis | \`analyze({ aspect: "symbols", path: "src/component" })\` | Exports, classes, interfaces → \`docs/architecture/components/{name}.md\` |
|
|
1841
|
+
| Entry points / API surface | \`analyze({ aspect: "entry_points", path: "." })\` | CLI bins, route handlers, main exports → \`docs/reference/api.md\` |
|
|
1842
|
+
| Code patterns | \`analyze({ aspect: "patterns", path: "." })\` | Design patterns, conventions → \`docs/architecture/overview.md\` patterns section |
|
|
1843
|
+
| Impact analysis | \`blast_radius({ changed_files: [...] })\` | What's affected by changes → targeted doc updates |
|
|
1844
|
+
| Change detection | \`git_context({})\` | Recent changes, diff summary → determine which docs need updating |
|
|
1845
|
+
| Module graph | \`graph({ action: 'neighbors', node_id })\` | Who-imports-whom, cross-package dependencies → architecture diagrams |
|
|
1846
|
+
| Full audit | \`audit({ path: "." })\` | Structure + deps + patterns + health + dead symbols → comprehensive docs refresh |
|
|
1847
|
+
|
|
1848
|
+
### Tool-First Workflow
|
|
1849
|
+
|
|
1850
|
+
When creating documentation, always start with tool output, then enhance with human context:
|
|
1851
|
+
|
|
1852
|
+
\`\`\`
|
|
1853
|
+
1. Run the relevant analysis tool(s)
|
|
1854
|
+
2. Use the output as the doc's foundation
|
|
1855
|
+
3. Add: purpose/motivation (why, not just what)
|
|
1856
|
+
4. Add: decision context (link to ADRs)
|
|
1857
|
+
5. Add: cross-references to related docs
|
|
1858
|
+
6. Remove: implementation details visible in code
|
|
1859
|
+
\`\`\`
|
|
1860
|
+
|
|
1861
|
+
## \`docs/\` Convention
|
|
1862
|
+
|
|
1863
|
+
\`\`\`
|
|
1864
|
+
docs/
|
|
1865
|
+
├── README.md ← Project overview + docs index (always exists)
|
|
1866
|
+
├── architecture/
|
|
1867
|
+
│ ├── overview.md ← C4 context + container diagrams (c4-architecture skill)
|
|
1868
|
+
│ ├── stack.md ← Language, runtime, frameworks, all dependencies
|
|
1869
|
+
│ ├── structure.md ← Directory layout, entry points, key files
|
|
1870
|
+
│ ├── design.md ← Layers, patterns, data flow
|
|
1871
|
+
│ ├── conventions.md ← Naming, formatting, error handling, imports
|
|
1872
|
+
│ ├── integrations.md ← External APIs, databases, auth, monitoring
|
|
1873
|
+
│ ├── testing.md ← Frameworks, file organization, mocking strategy
|
|
1874
|
+
│ ├── concerns.md ← Tech debt, bugs, security risks, perf bottlenecks
|
|
1875
|
+
│ └── components/
|
|
1876
|
+
│ └── {component-name}.md ← Per-component technical docs
|
|
1877
|
+
├── decisions/ ← Architecture Decision Records (adr-skill)
|
|
1878
|
+
│ ├── index.md ← ADR log / table of contents
|
|
1879
|
+
│ └── NNN-{title}.md ← Individual ADRs
|
|
1880
|
+
├── guides/
|
|
1881
|
+
│ ├── tutorials/ ← Learning-oriented lessons (Diátaxis: Tutorial)
|
|
1882
|
+
│ │ └── {topic}.md
|
|
1883
|
+
│ └── {topic}.md ← How-to guides for common tasks (Diátaxis: How-To)
|
|
1884
|
+
└── reference/
|
|
1885
|
+
├── api.md ← API reference (endpoints, schemas, auth)
|
|
1886
|
+
└── configuration.md ← Configuration options and environment variables
|
|
1887
|
+
\`\`\`
|
|
1888
|
+
|
|
1889
|
+
### Directory Purposes
|
|
1890
|
+
|
|
1891
|
+
| Directory | Diátaxis Quadrant | What Goes Here | When to Create/Update |
|
|
1892
|
+
|-----------|-------------------|----------------|----------------------|
|
|
1893
|
+
| \`architecture/\` | Explanation + Reference | C4 diagrams, project knowledge (stack, structure, design, conventions, integrations, testing, concerns), component docs | Initial onboarding, new component, structural change, architecture decision |
|
|
1894
|
+
| \`decisions/\` | Explanation | ADRs — why decisions were made | Non-trivial technical decision (see adr-skill triggers) |
|
|
1895
|
+
| \`guides/\` | How-To | Step-by-step instructions for tasks | New workflow, complex setup, common operations |
|
|
1896
|
+
| \`guides/tutorials/\` | Tutorial | Learning-oriented guided lessons with concrete outcomes | New technology/feature adoption, onboarding new developers |
|
|
1897
|
+
| \`reference/\` | Reference | API docs, config options, data schemas | API change, new config option, schema modification |
|
|
1898
|
+
|
|
1899
|
+
## Change-to-Doc Mapping
|
|
1900
|
+
|
|
1901
|
+
Use this decision tree to determine what documentation action to take after a flow completes:
|
|
1902
|
+
|
|
1903
|
+
\`\`\`
|
|
1904
|
+
What changed?
|
|
1905
|
+
├── New component/module/package
|
|
1906
|
+
│ ├── Creates public API? → Create docs/architecture/components/{name}.md + update reference/api.md
|
|
1907
|
+
│ └── Internal only? → Update docs/architecture/overview.md (component list)
|
|
1908
|
+
├── API change (new endpoint, changed contract, new config)
|
|
1909
|
+
│ └── Update docs/reference/api.md or docs/reference/configuration.md
|
|
1910
|
+
├── Architecture/infrastructure decision
|
|
1911
|
+
│ └── Delegate to adr-skill → creates/updates docs/decisions/NNN-{title}.md
|
|
1912
|
+
├── Structural/architecture change
|
|
1913
|
+
│ └── Delegate to c4-architecture skill → updates docs/architecture/overview.md
|
|
1914
|
+
├── New developer workflow (build, deploy, test pattern)
|
|
1915
|
+
│ └── Create or update docs/guides/{topic}.md
|
|
1916
|
+
├── Bug fix
|
|
1917
|
+
│ ├── Reveals missing docs? → Create the missing doc
|
|
1918
|
+
│ └── Straightforward fix? → No docs update needed
|
|
1919
|
+
└── Dependency update / refactor / cleanup
|
|
1920
|
+
└── No docs update needed (unless public API changed)
|
|
1921
|
+
\`\`\`
|
|
1922
|
+
|
|
1923
|
+
### Classify Document Type
|
|
1924
|
+
|
|
1925
|
+
Route each document to the right framework based on its audience and purpose:
|
|
1926
|
+
|
|
1927
|
+
| Document Type | Primary Framework | Classification Method | Target Structure |
|
|
1928
|
+
|---|---|---|---|
|
|
1929
|
+
| End-user docs (tutorials, guides, references, explanations) | Diátaxis | Two-question compass: Action/Cognition × Study/Work | \`guides/\`, \`reference/\`, \`architecture/\` |
|
|
1930
|
+
| Architecture docs (C4 diagrams, component views, deployment) | arc42-lite | Context → Container → Component → Deployment views | \`architecture/\` |
|
|
1931
|
+
| API documentation (endpoints, schemas, contracts) | Contract-first | OpenAPI-inspired: paths, schemas, auth, errors | \`reference/api.md\` |
|
|
1932
|
+
| Operations docs (runbooks, playbooks, incident response) | Runbook format | Trigger → Diagnose → Fix → Verify → Prevent | \`guides/operations/\` |
|
|
1933
|
+
|
|
1934
|
+
**Decision flow:**
|
|
1935
|
+
1. Is it API documentation? → Contract-first (OpenAPI-inspired structure)
|
|
1936
|
+
2. Is it architecture/infrastructure? → arc42-lite views
|
|
1937
|
+
3. Is it operational/on-call? → Runbook format
|
|
1938
|
+
4. Everything else → Diátaxis two-question compass
|
|
1939
|
+
|
|
1940
|
+
For Diátaxis edge cases, consult [references/diataxis-reference.md](references/diataxis-reference.md).
|
|
1941
|
+
|
|
1942
|
+
## Templates
|
|
1943
|
+
|
|
1944
|
+
Document templates for each type are in [references/doc-templates.md](references/doc-templates.md).
|
|
1945
|
+
|
|
1946
|
+
Key templates: Component Doc, Tutorial, Guide, Decision Index, Reference. Each includes depth-appropriate prompts (sequence diagrams, edge cases, error paths).
|
|
1947
|
+
|
|
1948
|
+
## Skill Integration
|
|
1949
|
+
|
|
1950
|
+
Integration patterns with \`adr-skill\`, \`c4-architecture\`, and Mermaid syntax rules are in [references/architecture-blueprint.md](references/architecture-blueprint.md).
|
|
1951
|
+
|
|
1952
|
+
## Project Knowledge
|
|
1953
|
+
|
|
1954
|
+
Project knowledge acquisition workflow, templates, and gotchas are in [references/project-knowledge-reference.md](references/project-knowledge-reference.md).
|
|
1955
|
+
|
|
1956
|
+
## Architecture Documentation
|
|
1957
|
+
|
|
1958
|
+
Architecture blueprint generation instructions are in [references/architecture-blueprint.md](references/architecture-blueprint.md).
|
|
1959
|
+
|
|
1960
|
+
Pairs with the \`c4-architecture\` skill for interactive diagram generation.
|
|
1961
|
+
|
|
1962
|
+
## Living PRD Generation
|
|
1963
|
+
|
|
1964
|
+
Product Requirements Documents (PRDs) serve as the single source of truth for what a feature does and why. They use \`capability_id\` keys (e.g., \`CAP-001\`) for end-to-end traceability: requirements -> code -> tests -> docs.
|
|
1965
|
+
|
|
1966
|
+
### When to Create/Update PRDs
|
|
1967
|
+
|
|
1968
|
+
| Trigger | Action |
|
|
1969
|
+
|---------|--------|
|
|
1970
|
+
| New feature or epic | Create PRD from [references/prd-template.md](references/prd-template.md) |
|
|
1971
|
+
| Flow design step | Reference existing PRD, add new capabilities |
|
|
1972
|
+
| Implementation complete | Update capability status -> \`implemented\` |
|
|
1973
|
+
| Tests passing | Update capability status -> \`verified\` |
|
|
1974
|
+
| Architecture decision (ADR) | Link ADR to affected capabilities |
|
|
1975
|
+
|
|
1976
|
+
### PRD Generation Workflow
|
|
1977
|
+
|
|
1978
|
+
1. **Create** - Use the 10-section template from \`references/prd-template.md\`
|
|
1979
|
+
2. **Assign capability_ids** - Each discrete capability gets a unique \`CAP-XXX\` ID
|
|
1980
|
+
3. **Cross-reference** - Link capabilities to code files, test files, and doc files in the traceability section
|
|
1981
|
+
4. **Maintain index** - Update \`docs/prds/prd.index.json\` (schema in the reference) for automated cross-referencing
|
|
1982
|
+
5. **Evolve** - PRDs are living documents. Update status fields as implementation progresses through proposed -> approved -> implemented -> verified
|
|
1983
|
+
|
|
1984
|
+
### Output Location
|
|
1985
|
+
|
|
1986
|
+
PRDs go in \`docs/prds/PRD-NNN-descriptive-name.md\`. The index lives at \`docs/prds/prd.index.json\`.
|
|
1987
|
+
|
|
1988
|
+
## Tour Generation & Interactive Visualization
|
|
1989
|
+
|
|
1990
|
+
Tour generation, domain-specific docs, and interactive visualization instructions are in [references/tour-generation.md](references/tour-generation.md).
|
|
1991
|
+
|
|
1992
|
+
Key points:
|
|
1993
|
+
- Tour JSON schema: see [references/tour.schema.json](references/tour.schema.json)
|
|
1994
|
+
- Interactive viewer: copy shipped \`assets/tour-viewer.html\`, inject tour JSON data
|
|
1995
|
+
- Domain docs: framework-specific, API, and library documentation patterns
|
|
1996
|
+
|
|
1997
|
+
## Generation Pipeline
|
|
1998
|
+
|
|
1999
|
+
Full generation prompts, multi-phase pipeline, and framework context instructions are in [references/generation-pipeline.md](references/generation-pipeline.md).
|
|
2000
|
+
|
|
2001
|
+
Quick reference:
|
|
2002
|
+
1. **Analyze** — scan existing docs, identify gaps
|
|
2003
|
+
2. **Plan** — determine doc type, framework, structure
|
|
2004
|
+
3. **Generate** — use depth-appropriate prompts (NOT generic "write clearly")
|
|
2005
|
+
4. **Validate** — check Diátaxis compliance, completeness, accuracy
|
|
2006
|
+
|
|
2046
2007
|
## Writing Style
|
|
2047
2008
|
|
|
2048
2009
|
Follow these rules when generating documentation content. Adapted from *The Elements of Agent Style* (CC BY 4.0, Yue Zhao) and classic writing authorities.
|
|
@@ -2102,10 +2063,10 @@ All links in generated docs must be correct relative to the file that contains t
|
|
|
2102
2063
|
- ❌ **Reference with Narrative** — opinions in API tables ("I recommend...") → strip opinions to Explanation doc
|
|
2103
2064
|
- ❌ **Explanation with Procedures** — numbered steps in a conceptual doc → move procedures to How-To
|
|
2104
2065
|
- ❌ **Mixed-Mode Document** — one doc serving multiple quadrants → split into separate documents per quadrant
|
|
2105
|
-
- See [references/diataxis-
|
|
2066
|
+
- See [references/diataxis-reference.md](references/diataxis-reference.md) for detection signals, counterexamples, and blur zones
|
|
2106
2067
|
|
|
2107
2068
|
### Project Knowledge
|
|
2108
|
-
- See [references/project-knowledge-
|
|
2069
|
+
- See [references/project-knowledge-reference.md](references/project-knowledge-reference.md) for environment gotchas and anti-pattern table
|
|
2109
2070
|
|
|
2110
2071
|
---
|
|
2111
2072
|
|