@brainfish-ai/devdoc 0.1.39 → 0.1.41

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,74 +1,140 @@
1
1
  ---
2
2
  name: bootstrap-docs
3
- description: Analyze repository and generate documentation with user-driven preferences and comprehensive code memory.
3
+ description: Expert-level documentation bootstrap using Diátaxis framework and audience-driven planning.
4
4
  ---
5
5
 
6
6
  ## Instructions
7
7
 
8
- When bootstrapping documentation from a repository:
8
+ When bootstrapping documentation from a repository, follow the **Documentation Planning Pyramid** approach used by documentation experts:
9
+
10
+ ```
11
+ ┌─────────────────────────────────────────────────────────────────────┐
12
+ │ DOCUMENTATION PLANNING PYRAMID │
13
+ ├─────────────────────────────────────────────────────────────────────┤
14
+ │ ┌─────────────┐ │
15
+ │ │ STRATEGY │ ← WHY (Step 1-2) │
16
+ │ │ Overview & │ │
17
+ │ │ Audience │ │
18
+ │ └──────┬──────┘ │
19
+ │ │ │
20
+ │ ┌───────────┴───────────┐ │
21
+ │ │ INFORMATION │ ← WHAT (Step 3-4) │
22
+ │ │ ARCHITECTURE │ │
23
+ │ └───────────┬───────────┘ │
24
+ │ │ │
25
+ │ ┌────────┴────────┐ │
26
+ │ │ APPROVAL │ ← CONFIRM (Step 5) │
27
+ │ │ User confirms │ │
28
+ │ │ IA structure │ │
29
+ │ └────────┬────────┘ │
30
+ │ │ │
31
+ │ ┌──────────────────┴──────────────────┐ │
32
+ │ │ CONTENT │ ← HOW (Step 6-8) │
33
+ │ │ Pages using Diátaxis Types │ │
34
+ │ └─────────────────────────────────────┘ │
35
+ └─────────────────────────────────────────────────────────────────────┘
36
+ ```
37
+
38
+ ---
39
+
40
+ ## Phase 1: Strategy (WHY)
41
+
42
+ ### Step 1: Project Overview (Quick Scan)
43
+
44
+ **Get a quick understanding of the project using git:**
9
45
 
10
- ### Step 1: Check Existing Context & Codebase
46
+ ```bash
47
+ # List all tracked files
48
+ git ls-files
49
+
50
+ # Get folder structure (top-level)
51
+ git ls-files | cut -d'/' -f1 | sort -u
11
52
 
12
- **First, detect if there's a codebase to scan:**
53
+ # Check for key files
54
+ git ls-files | grep -E "(README|package\.json|openapi|swagger|schema\.graphql)"
13
55
  ```
14
- Look for:
15
- - package.json, pyproject.toml, Cargo.toml, go.mod
16
- - src/, lib/, app/ directories
17
- - Any source code files
56
+
57
+ **Generate a brief project summary (<100 words):**
58
+
59
+ ```
60
+ 📁 PROJECT OVERVIEW
61
+
62
+ Name: [from package.json or README]
63
+ Type: [API/Library/CLI/Web App]
64
+ Language: [TypeScript/Python/Go/etc.]
65
+ Framework: [Next.js/Express/FastAPI/etc.]
66
+
67
+ Structure:
68
+ ├── src/ → Source code
69
+ ├── lib/ → Library code
70
+ ├── api/ → API routes
71
+ ├── docs/ → Documentation (if exists)
72
+ └── tests/ → Test files
73
+
74
+ Key Files:
75
+ • README.md → Project description
76
+ • package.json → Dependencies
77
+ • openapi.json → API spec (if exists)
78
+
79
+ Summary: [One sentence describing what this project does]
18
80
  ```
19
81
 
20
82
  **If NO codebase found:**
21
83
  - Tell user: "No codebase detected. Creating docs-only project."
22
- - Skip code-graph generation entirely
23
- - Proceed to Step 2 for preferences, then Step 6 for structure
84
+ - Skip to Step 2
24
85
 
25
- **If codebase exists, check git state:**
26
- ```bash
27
- git rev-parse HEAD # Current commit hash
28
- git rev-parse --abbrev-ref HEAD # Current branch
29
- ```
86
+ **If `.devdoc/context.json` exists:** Read and use existing preferences.
30
87
 
31
- **If `.devdoc/code-graph.json` exists:**
32
- 1. Read `git.commitHash` from the file
33
- 2. Compare to current HEAD:
34
- - **Same commit** → "Code graph up to date (commit: {short_hash})"
35
- - Skip to Step 6 (Plan Documentation)
36
- - **Different commit** → Changes detected
37
- - Run: `git diff {old_hash}..HEAD --name-only`
38
- - Tell user: "{N} files changed since last scan"
39
- - Ask: "1. Full rescan 2. Incremental (changed files only) 3. Skip"
88
+ ### Step 2: Define Documentation Goals & Audience
40
89
 
41
- **If `.devdoc/context.json` exists and is populated:**
42
- - Read the context file
43
- - Tell user: "Found existing product context."
44
- - If code-graph needs refresh → Go to Step 4
45
- - If code-graph is current → Skip to Step 6
90
+ **Ask the user strategic questions before any scanning:**
46
91
 
47
- **If neither exists:**
48
- - Proceed to Step 2 (Ask User Preferences)
92
+ #### Question 1: Documentation Purpose (WHY)
93
+ ```
94
+ What is the primary goal of this documentation?
49
95
 
50
- ### Step 2: Ask User Preferences First
96
+ 1. **Enable team productivity** - Help internal developers work faster
97
+ 2. **Onboard new developers** - Get new team members up to speed
98
+ 3. **Support API consumers** - Help external devs integrate your API
99
+ 4. **Guide product users** - Help end users accomplish tasks
100
+ 5. **Inform stakeholders** - Communicate architecture and decisions
101
+ ```
51
102
 
52
- **Don't scan yet - ask the user what they want:**
103
+ #### Question 2: Primary Audience (WHO)
104
+ ```
105
+ Who is your PRIMARY audience? (Choose one)
53
106
 
54
- #### Question 1: Documentation Type
107
+ 1. **Internal Developer** - Engineers on your team
108
+ → Needs: Code flow, architecture, debugging, contribution guides
109
+
110
+ 2. **External Developer** - API consumers, SDK users
111
+ → Needs: Quick start, authentication, code examples, reference
112
+
113
+ 3. **Product User** - End users of your product
114
+ → Needs: Tutorials, feature guides, troubleshooting
115
+
116
+ 4. **Content Author** - Technical writers, doc contributors
117
+ → Needs: MDX syntax, structure guidelines, publishing workflow
118
+
119
+ 5. **Product Manager/Stakeholder** - Non-technical team members
120
+ → Needs: Feature overview, roadmap, IA map
121
+ ```
122
+
123
+ #### Question 3: Documentation Domain
55
124
  ```
56
125
  What type of documentation are you creating?
57
126
 
58
127
  1. **API Docs** - REST/GraphQL API reference for developers
128
+ → Voice: Professional, code-focused
129
+
59
130
  2. **Product Docs** - Feature guides and tutorials for end users
131
+ → Voice: Friendly, approachable
132
+
60
133
  3. **Internal Docs** - Team setup, architecture, contribution guides
134
+ → Voice: Technical, direct
61
135
  ```
62
136
 
63
- #### Question 2: Codebase Connection (if codebase detected)
64
- ```
65
- I detected a codebase. Would you like me to:
66
-
67
- 1. **Scan codebase** - Build code-graph for accurate docs (recommended)
68
- 2. **Skip scanning** - I'll write docs without code analysis
69
- ```
70
-
71
- #### Question 3: API Type (if API Docs selected)
137
+ #### Question 4: API Type (if API Docs selected)
72
138
  ```
73
139
  What type of API do you have?
74
140
 
@@ -78,18 +144,16 @@ What type of API do you have?
78
144
  4. **Manual** - I'll document the API manually (no spec file)
79
145
  ```
80
146
 
81
- #### Question 3: Target Audience
82
- ```
83
- Who is your primary audience?
84
- (e.g., "Backend developers integrating our payment API", "Internal engineering team")
85
- ```
86
-
87
- #### Question 4: Code Examples Language
147
+ #### Question 5: Code Examples Language
88
148
  ```
89
149
  What language should code examples use?
90
150
  (e.g., TypeScript, Python, curl, Go)
91
151
  ```
92
152
 
153
+ ---
154
+
155
+ ## Phase 2: Information Architecture (WHAT)
156
+
93
157
  ### Step 3: Locate & Import API Specs (if applicable)
94
158
 
95
159
  **Only if user selected OpenAPI or GraphQL:**
@@ -112,310 +176,384 @@ Do you have a GraphQL schema? Please provide the path, or I can search for:
112
176
  2. Validate the spec
113
177
  3. Extract metadata (endpoints, types, auth)
114
178
 
115
- ### Step 4: Build Code Graph (Optional)
179
+ ### Step 4: Plan Content Using Diátaxis Framework
116
180
 
117
- **Skip this step if:**
118
- - No codebase detected
119
- - User chose "Skip scanning" in Question 2
120
- - User is creating docs-only project
181
+ **Classify each planned page by content type:**
121
182
 
122
- **If scanning, comprehensively analyze the codebase and build `.devdoc/code-graph.json`:**
183
+ | Type | Purpose | When to Use | Example Pages |
184
+ |------|---------|-------------|---------------|
185
+ | **Tutorial** | Learning-oriented | First-time experience, guided learning | "Build Your First..." |
186
+ | **How-To Guide** | Task-oriented | Accomplish specific goals | "Add Custom Domain", "Configure Theme" |
187
+ | **Reference** | Information-oriented | Look up facts, specifications | Component props, CLI flags, Config schema |
188
+ | **Explanation** | Understanding-oriented | Deeper comprehension | "How MDX Processing Works", Architecture |
123
189
 
124
- #### 4a. Project Metadata
125
- ```
126
- Scan and extract:
127
- ├── README.md → Product name, description, features
128
- ├── package.json → Language, framework, dependencies
129
- ├── LICENSE → License type
130
- └── .env.example → Required environment variables
131
- ```
190
+ **Map documentation structure based on domain:**
132
191
 
133
- #### 4b. Source Code Structure
192
+ #### For API Docs:
134
193
  ```
135
- Map all directories:
136
- ├── src/
137
- ├── api/ API routes, controllers
138
- ├── models/ Data models, schemas
139
- ├── services/ → Business logic
140
- │ ├── utils/ Helper functions
141
- │ └── types/ Type definitions
142
- ├── tests/ → Test files (for code examples)
143
- └── examples/ Example usage
194
+ docs/
195
+ ├── index.mdx # [Explanation] Overview, value prop
196
+ ├── quickstart.mdx # [Tutorial] 5-min getting started
197
+ ├── authentication.mdx # [How-To] Auth setup
198
+ ├── guides/
199
+ │ ├── overview.mdx # [Explanation] Core concepts
200
+ │ └── {use-cases}.mdx # [How-To] Common use cases
201
+ ├── api-reference/
202
+ │ ├── openapi.json # Imported spec
203
+ │ ├── introduction.mdx # [Explanation] API overview
204
+ │ └── errors.mdx # [Reference] Error codes
205
+ └── sdks/ # [Reference] SDK docs
144
206
  ```
145
207
 
146
- #### 4c. Deep Code Analysis
208
+ #### For Product Docs:
147
209
  ```
148
- For each module, extract:
149
- - All public functions with FULL signatures
150
- - Class definitions with methods
151
- - Interface/type definitions
152
- - Exported constants
153
- - Error types and codes
154
- - Configuration options
210
+ docs/
211
+ ├── index.mdx # [Explanation] Product overview
212
+ ├── getting-started/
213
+ │ ├── quickstart.mdx # [Tutorial] First experience
214
+ │ └── key-concepts.mdx # [Explanation] Core concepts
215
+ ├── features/
216
+ │ └── {feature}.mdx # [How-To] Feature guides
217
+ ├── tutorials/
218
+ │ └── {tutorial}.mdx # [Tutorial] Step-by-step learning
219
+ └── troubleshooting/ # [How-To] Problem solving
155
220
  ```
156
221
 
157
- #### 4d. Create Code Graph File
222
+ #### For Internal Docs:
223
+ ```
224
+ docs/
225
+ ├── index.mdx # [Explanation] Project overview
226
+ ├── getting-started/
227
+ │ ├── setup.mdx # [How-To] Environment setup
228
+ │ └── prerequisites.mdx # [Reference] Requirements
229
+ ├── architecture/
230
+ │ ├── overview.mdx # [Explanation] System design
231
+ │ ├── data-flow.mdx # [Explanation] How data flows
232
+ │ └── decisions/ # [Explanation] ADRs
233
+ ├── development/
234
+ │ ├── workflow.mdx # [How-To] Dev workflow
235
+ │ └── debugging.mdx # [How-To] Debugging guide
236
+ └── contributing.mdx # [How-To] Contribution guide
237
+ ```
238
+
239
+ ### Step 5: Present IA for Approval (REQUIRED)
240
+
241
+ **IMPORTANT: Always get user approval before generating documentation.**
242
+
243
+ Present the **complete Information Architecture** to the user, covering:
244
+ 1. **Navigation Structure** - Tabs, groups, and page ordering (what users see in sidebar)
245
+ 2. **File Structure** - Actual files to be created
246
+ 3. **Content Summary** - Diátaxis content type breakdown
247
+
248
+ ```
249
+ 📋 PROPOSED DOCUMENTATION ARCHITECTURE
250
+
251
+ Based on your preferences:
252
+ - Goal: [selected goal]
253
+ - Audience: [primary audience]
254
+ - Domain: [api/product/internal]
255
+
256
+ ═══════════════════════════════════════════════════════════════
257
+ NAVIGATION STRUCTURE
258
+ (How documentation appears in the sidebar)
259
+ ═══════════════════════════════════════════════════════════════
260
+
261
+ 📑 TAB: Guides
262
+ ├── 📁 Getting Started
263
+ │ ├── Introduction # index.mdx [explanation]
264
+ │ ├── Quickstart # quickstart.mdx [tutorial]
265
+ │ └── Authentication # authentication.mdx [how-to]
266
+
267
+ ├── 📁 Core Concepts
268
+ │ ├── Overview # guides/overview.mdx [explanation]
269
+ │ ├── Working with Resources # guides/resources.mdx [how-to]
270
+ │ └── Error Handling # guides/errors.mdx [how-to]
271
+
272
+ └── 📁 SDKs
273
+ └── TypeScript SDK # sdks/typescript.mdx [reference]
274
+
275
+ 📑 TAB: API Reference (OpenAPI)
276
+ └── [Auto-generated from openapi.json]
277
+ ├── Introduction # api-reference/introduction.mdx [explanation]
278
+ ├── Authentication # (from spec)
279
+ ├── Endpoints # (from spec)
280
+ └── Error Codes # api-reference/errors.mdx [reference]
281
+
282
+ ═══════════════════════════════════════════════════════════════
283
+ FILE STRUCTURE
284
+ (Actual files to be created in docs/)
285
+ ═══════════════════════════════════════════════════════════════
158
286
 
159
- Save to `.devdoc/code-graph.json`:
160
- ```json
161
- {
162
- "$schema": "https://devdoc.sh/schemas/code-graph.json",
163
- "version": "1.0",
164
- "generatedAt": "2026-01-24T10:00:00Z",
165
-
166
- "git": {
167
- "commitHash": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0",
168
- "commitShort": "a1b2c3d",
169
- "branch": "main",
170
- "commitMessage": "feat: add user authentication",
171
- "commitDate": "2026-01-24T09:30:00Z",
172
- "isDirty": false
173
- },
174
-
175
- "project": {
176
- "name": "Project Name",
177
- "description": "From README",
178
- "language": "TypeScript",
179
- "framework": "Express",
180
- "rootDir": "src/"
181
- },
182
-
183
- "structure": {
184
- "sourceDir": "src/",
185
- "testsDir": "tests/",
186
- "examplesDir": "examples/",
187
- "docsDir": "docs/"
188
- },
189
-
190
- "modules": [
191
- {
192
- "name": "auth",
193
- "path": "src/auth/",
194
- "description": "Authentication and authorization",
195
- "files": ["index.ts", "jwt.ts", "middleware.ts"],
196
- "exports": [
197
- {
198
- "name": "login",
199
- "type": "function",
200
- "signature": "login(email: string, password: string): Promise<AuthToken>",
201
- "description": "Authenticate user and return JWT",
202
- "params": [
203
- { "name": "email", "type": "string", "description": "User email" },
204
- { "name": "password", "type": "string", "description": "User password" }
205
- ],
206
- "returns": { "type": "Promise<AuthToken>", "description": "JWT token" },
207
- "async": true
208
- },
209
- {
210
- "name": "verifyToken",
211
- "type": "function",
212
- "signature": "verifyToken(token: string): Promise<User>",
213
- "async": true
214
- }
215
- ],
216
- "dependencies": ["users", "config"],
217
- "docPriority": "high"
218
- }
219
- ],
220
-
221
- "types": [
222
- {
223
- "name": "User",
224
- "path": "src/types/user.ts",
225
- "kind": "interface",
226
- "definition": "interface User { id: string; email: string; name: string; }",
227
- "properties": [
228
- { "name": "id", "type": "string" },
229
- { "name": "email", "type": "string" },
230
- { "name": "name", "type": "string" }
231
- ]
232
- },
233
- {
234
- "name": "AuthToken",
235
- "path": "src/types/auth.ts",
236
- "kind": "interface",
237
- "definition": "interface AuthToken { token: string; expiresAt: Date; }"
238
- }
239
- ],
240
-
241
- "api": {
242
- "type": "REST",
243
- "baseUrl": "/api/v1",
244
- "specPath": "api-reference/openapi.json",
245
- "authentication": {
246
- "type": "bearer",
247
- "headerName": "Authorization",
248
- "description": "JWT token required"
249
- },
250
- "endpoints": [
251
- {
252
- "method": "POST",
253
- "path": "/auth/login",
254
- "handler": "src/routes/auth.ts:login",
255
- "description": "User login",
256
- "auth": "none"
257
- },
258
- {
259
- "method": "GET",
260
- "path": "/users/:id",
261
- "handler": "src/routes/users.ts:getUser",
262
- "auth": "required",
263
- "responseType": "User"
264
- }
265
- ]
266
- },
267
-
268
- "examples": [
269
- {
270
- "path": "examples/basic-auth.ts",
271
- "description": "Basic authentication flow",
272
- "tags": ["auth", "login"],
273
- "runnable": true
274
- }
275
- ],
287
+ docs/
288
+ ├── index.mdx # Introduction
289
+ ├── quickstart.mdx # Quickstart guide
290
+ ├── authentication.mdx # Auth setup
291
+ ├── guides/
292
+ │ ├── overview.mdx # Core concepts
293
+ │ ├── resources.mdx # Working with resources
294
+ │ └── errors.mdx # Error handling
295
+ ├── api-reference/
296
+ │ ├── openapi.json # Imported spec
297
+ │ ├── introduction.mdx # API overview
298
+ │ └── errors.mdx # Error codes reference
299
+ └── sdks/
300
+ └── typescript.mdx # TypeScript SDK
301
+
302
+ ═══════════════════════════════════════════════════════════════
303
+ CONTENT SUMMARY
304
+ ═══════════════════════════════════════════════════════════════
305
+
306
+ By Diátaxis Content Type:
307
+ 📚 Tutorials: 1 page
308
+ └── quickstart.mdx
276
309
 
277
- "config": {
278
- "envVars": [
279
- { "name": "JWT_SECRET", "description": "Secret for JWT signing", "required": true },
280
- { "name": "DATABASE_URL", "description": "Database connection string", "required": true }
281
- ]
282
- },
310
+ 📝 How-To Guides: 4 pages
311
+ ├── authentication.mdx
312
+ ├── guides/resources.mdx
313
+ └── guides/errors.mdx
283
314
 
284
- "errors": [
285
- { "name": "AuthenticationError", "code": "AUTH_FAILED", "message": "Invalid credentials" },
286
- { "name": "NotFoundError", "code": "NOT_FOUND", "message": "Resource not found" }
287
- ],
315
+ 📖 Reference: 2 pages
316
+ ├── api-reference/errors.mdx
317
+ └── sdks/typescript.mdx
288
318
 
289
- "dependencies": {
290
- "express": "^4.18.0",
291
- "jsonwebtoken": "^9.0.0"
292
- }
293
- }
319
+ 💡 Explanations: 3 pages
320
+ ├── index.mdx (overview)
321
+ ├── guides/overview.mdx
322
+ └── api-reference/introduction.mdx
323
+
324
+ Total: 10 pages to generate
325
+
326
+ ═══════════════════════════════════════════════════════════════
327
+ GAPS ANALYSIS
328
+ ═══════════════════════════════════════════════════════════════
329
+
330
+ Potential missing documentation:
331
+ ⚠️ No troubleshooting guide
332
+ ⚠️ No changelog/release notes
333
+ ⚠️ No migration guide
334
+
335
+ ───────────────────────────────────────────────────────────────
336
+
337
+ Does this architecture look complete?
338
+
339
+ 1. ✅ **Approve** - Generate documentation with this structure
340
+ 2. ✏️ **Modify** - I want to add/remove/change pages or navigation
341
+ 3. ➕ **Add suggested** - Add the suggested missing docs
342
+ 4. ❌ **Restart** - Let's reconsider the goals and audience
294
343
  ```
295
344
 
296
- ### Step 5: Create Context File
345
+ **If user chooses "Modify":**
346
+ - Ask what they want to change:
347
+ - Add/remove pages?
348
+ - Change navigation grouping?
349
+ - Rename tabs or groups?
350
+ - Reorder pages?
351
+ - Update the proposed structure
352
+ - Present again for approval
353
+
354
+ **If user chooses "Add suggested":**
355
+ - Add the suggested missing documentation to the plan
356
+ - Present updated structure for final approval
357
+
358
+ **If user chooses "Restart":**
359
+ - Go back to Step 2 (Define Documentation Goals & Audience)
360
+
361
+ **If user chooses "Approve":**
362
+ - Proceed to Step 6 (Create Context File)
363
+
364
+ **What the IA approval covers:**
365
+
366
+ | Aspect | What's Shown |
367
+ |--------|--------------|
368
+ | **Navigation** | Tabs, groups, page ordering (sidebar view) |
369
+ | **Files** | Actual file paths and folder structure |
370
+ | **Content Types** | Diátaxis classification per page |
371
+ | **Gaps** | Suggested missing documentation |
372
+ | **Scope** | Total page count and effort estimate |
373
+
374
+ **Why this step matters:**
375
+ - Clarifies exactly what will be created
376
+ - Shows how users will navigate the docs
377
+ - Identifies missing documentation before writing
378
+ - Allows user to adjust navigation structure
379
+ - Prevents wasted effort on unwanted content
380
+ - Ensures alignment on scope and priorities
381
+
382
+ ### Step 6: Create Context File (After Approval)
297
383
 
298
384
  Save to `.devdoc/context.json`:
299
385
  ```json
300
386
  {
301
387
  "$schema": "https://devdoc.sh/schemas/context.json",
302
388
  "version": "1.0",
303
- "lastUpdated": "2026-01-24T10:00:00Z",
304
- "git": {
305
- "commitHash": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0",
306
- "commitShort": "a1b2c3d",
307
- "branch": "main"
389
+ "lastUpdated": "2026-01-25T10:00:00Z",
390
+
391
+ "strategy": {
392
+ "goal": "Support API consumers",
393
+ "audience": {
394
+ "primary": "External Developer",
395
+ "needs": ["Quick start", "Authentication", "Code examples", "Reference"]
396
+ }
308
397
  },
398
+
309
399
  "preferences": {
310
400
  "docType": "api",
311
401
  "apiType": "openapi",
312
- "audience": "Backend developers",
313
402
  "codeLanguage": "TypeScript"
314
403
  },
404
+
315
405
  "product": {
316
406
  "name": "Product Name",
317
407
  "description": "From README",
318
408
  "type": "api"
319
409
  },
410
+
320
411
  "api": {
321
412
  "style": "REST",
322
413
  "specPath": "api-reference/openapi.json",
323
414
  "baseUrl": "https://api.example.com"
324
415
  },
416
+
325
417
  "documentation": {
326
418
  "voice": "professional",
327
419
  "codeExamples": {
328
420
  "primaryLanguage": "TypeScript"
329
421
  }
422
+ },
423
+
424
+ "contentPlan": {
425
+ "approved": true,
426
+ "approvedAt": "2026-01-25T10:00:00Z",
427
+ "pages": [
428
+ { "path": "index.mdx", "type": "explanation", "priority": "high", "status": "planned" },
429
+ { "path": "quickstart.mdx", "type": "tutorial", "priority": "high", "status": "planned" },
430
+ { "path": "authentication.mdx", "type": "how-to", "priority": "high", "status": "planned" },
431
+ { "path": "guides/overview.mdx", "type": "explanation", "priority": "medium", "status": "planned" },
432
+ { "path": "api-reference/errors.mdx", "type": "reference", "priority": "medium", "status": "planned" }
433
+ ]
330
434
  }
331
435
  }
332
436
  ```
333
437
 
334
- **Tell user:**
335
- ```
336
- ✅ Context saved!
438
+ ### Step 7: Generate Documentation
337
439
 
338
- - Doc Type: API Documentation
339
- - API: REST (45 endpoints)
340
- - Audience: Backend developers
341
- - Code examples: TypeScript
440
+ **Only proceed after user has approved the IA structure in Step 5.**
342
441
 
343
- Memory map created with 12 modules scanned.
344
- Ready to generate documentation.
345
- ```
442
+ **Use project overview and Diátaxis principles:**
346
443
 
347
- ### Step 6: Plan Documentation Structure
444
+ #### Writing Guidelines (Expert Standards)
348
445
 
349
- Based on user preferences, plan the structure:
446
+ 1. **Use Second Person** - "You can configure..." not "Users can configure..."
447
+ 2. **Active Voice** - "Run the command" not "The command should be run"
448
+ 3. **Task-Oriented Headings** - "How to add a custom domain" not "Custom domains"
449
+ 4. **Include Examples** - Every concept needs a code example
450
+ 5. **Progressive Disclosure** - Basic → Advanced ordering
350
451
 
351
- #### For API Docs:
352
- ```
353
- docs/
354
- ├── index.mdx # Overview, value prop
355
- ├── quickstart.mdx # 5-min getting started
356
- ├── authentication.mdx # Auth setup
357
- ├── guides/
358
- │ ├── overview.mdx # Core concepts
359
- │ └── {use-cases}.mdx # Common use cases
360
- ├── api-reference/
361
- │ ├── openapi.json # Imported spec
362
- │ ├── introduction.mdx
363
- │ └── errors.mdx
364
- └── sdks/ # If SDKs exist
365
- ```
452
+ #### Page Structure by Content Type
366
453
 
367
- #### For Product Docs:
368
- ```
369
- docs/
370
- ├── index.mdx
371
- ├── getting-started/
372
- │ ├── quickstart.mdx
373
- │ └── key-concepts.mdx
374
- ├── features/
375
- │ └── {feature}.mdx
376
- ├── tutorials/
377
- └── troubleshooting/
378
- ```
454
+ **Tutorial Template:**
455
+ ```mdx
456
+ ---
457
+ title: Build [Something] with [Technology]
458
+ description: A complete tutorial to [achieve outcome] from scratch
459
+ contentType: tutorial
460
+ ---
379
461
 
380
- #### For Internal Docs:
381
- ```
382
- docs/
383
- ├── index.mdx
384
- ├── getting-started/
385
- │ ├── setup.mdx
386
- │ └── prerequisites.mdx
387
- ├── architecture/
388
- ├── development/
389
- └── contributing.mdx
390
- ```
462
+ ## What You'll Build
391
463
 
392
- ### Step 7: Generate Documentation
464
+ [End result description + estimated time]
465
+
466
+ ## Prerequisites
467
+
468
+ <Note>Before you begin, ensure you have: [requirements]</Note>
393
469
 
394
- **Use the code graph to write accurate docs:**
470
+ ## Steps
395
471
 
396
- 1. **Read `.devdoc/code-graph.json`** before writing each page
397
- 2. **Reference exact function signatures** from the graph
398
- 3. **Extract real code examples** from the examples array
399
- 4. **Use correct types** from the types array
400
- 5. **Match voice to audience** (technical for API, friendly for product)
472
+ <Steps>
473
+ <Step title="Step 1">Content</Step>
474
+ <Step title="Step 2">Content</Step>
475
+ </Steps>
401
476
 
402
- **For each page:**
477
+ ## Next Steps
478
+
479
+ [Links to related content]
403
480
  ```
404
- 1. Read code-graph.json to find relevant modules
405
- 2. Use exact signatures from exports array
406
- 3. Reference types from types array
407
- 4. Extract examples from examples array or source
408
- 5. Document errors from errors array
409
- 6. Add TODO markers for sections needing review
481
+
482
+ **How-To Guide Template:**
483
+ ```mdx
484
+ ---
485
+ title: How to [Achieve Specific Goal]
486
+ description: Learn how to [specific outcome]
487
+ contentType: how-to
488
+ ---
489
+
490
+ ## Overview
491
+
492
+ [2-3 sentences: What, Who, Why]
493
+
494
+ ## Prerequisites (if applicable)
495
+
496
+ ## Steps
497
+
498
+ <Steps>
499
+ <Step title="[Action verb] [object]">Content</Step>
500
+ </Steps>
501
+
502
+ ## Example
503
+
504
+ [Complete working example]
505
+
506
+ ## Next Steps
410
507
  ```
411
508
 
412
- **Example - Writing auth docs:**
509
+ **Reference Template:**
510
+ ```mdx
511
+ ---
512
+ title: [Component/API/Config] Reference
513
+ description: Complete reference for [topic]
514
+ contentType: reference
515
+ ---
516
+
517
+ ## Overview
518
+
519
+ [Brief description]
520
+
521
+ ## Properties/Parameters
522
+
523
+ | Property | Type | Description | Default |
524
+ |----------|------|-------------|---------|
525
+ | ... | ... | ... | ... |
526
+
527
+ ## Examples
528
+
529
+ ## Related
530
+
531
+ [Links to related references]
413
532
  ```
414
- 1. Find "auth" module in code-graph.json
415
- 2. Get login() signature: "login(email: string, password: string): Promise<AuthToken>"
416
- 3. Get AuthToken type definition
417
- 4. Find auth example in examples array
418
- 5. Write docs with EXACT signatures and types
533
+
534
+ **Explanation Template:**
535
+ ```mdx
536
+ ---
537
+ title: Understanding [Concept]
538
+ description: Deep dive into [topic] and how it works
539
+ contentType: explanation
540
+ ---
541
+
542
+ ## Overview
543
+
544
+ [Why this matters]
545
+
546
+ ## How It Works
547
+
548
+ [Conceptual explanation with diagrams]
549
+
550
+ ## Key Concepts
551
+
552
+ ## When to Use
553
+
554
+ ## Related
555
+
556
+ [Links to tutorials and how-tos that apply this concept]
419
557
  ```
420
558
 
421
559
  ### Step 8: Update docs.json
@@ -431,7 +569,18 @@ Configure navigation based on doc type:
431
569
  "tabs": [
432
570
  {
433
571
  "tab": "Guides",
434
- "groups": [...]
572
+ "groups": [
573
+ {
574
+ "group": "Getting Started",
575
+ "icon": "rocket-launch",
576
+ "pages": ["index", "quickstart", "authentication"]
577
+ },
578
+ {
579
+ "group": "Guides",
580
+ "icon": "book-open",
581
+ "pages": ["guides/overview"]
582
+ }
583
+ ]
435
584
  },
436
585
  {
437
586
  "tab": "API Reference",
@@ -443,39 +592,26 @@ Configure navigation based on doc type:
443
592
  }
444
593
  ```
445
594
 
446
- **API Docs with GraphQL:**
447
- ```json
448
- {
449
- "navigation": {
450
- "tabs": [
451
- { "tab": "Guides", "groups": [...] },
452
- {
453
- "tab": "GraphQL API",
454
- "type": "graphql",
455
- "schema": "api-reference/schema.graphql",
456
- "endpoint": "https://api.example.com/graphql"
457
- }
458
- ]
459
- }
460
- }
461
- ```
462
-
463
595
  ### Step 9: Summary
464
596
 
465
597
  ```
466
598
  ✅ Documentation Generated!
467
599
 
468
- Files created:
469
- - docs.json (navigation configured)
470
- - index.mdx
471
- - quickstart.mdx
472
- - authentication.mdx
473
- - guides/overview.mdx
474
- - api-reference/openapi.json (imported)
600
+ Strategy:
601
+ - Goal: [selected goal]
602
+ - Audience: [primary audience]
603
+ - Domain: [api/product/internal]
475
604
 
476
- Code graph files:
477
- - .devdoc/context.json (user preferences)
478
- - .devdoc/code-graph.json (complete code analysis)
605
+ Content Plan (Diátaxis):
606
+ - Tutorials: X pages
607
+ - How-To Guides: X pages
608
+ - Reference: X pages
609
+ - Explanations: X pages
610
+
611
+ Files created:
612
+ - docs.json (navigation)
613
+ - .devdoc/context.json (strategy & preferences)
614
+ - [list of mdx files with content types]
479
615
 
480
616
  Next steps:
481
617
  1. Run `devdoc dev` to preview
@@ -489,17 +625,22 @@ Next steps:
489
625
 
490
626
  | Principle | Description |
491
627
  |-----------|-------------|
492
- | Ask first | Get user preferences before scanning |
493
- | Build code graph | Scan entire codebase, extract all signatures |
494
- | Store the graph | Save to code-graph.json for updates |
495
- | Use real code | Reference exact signatures, never fabricate |
496
- | Mark unknowns | Add TODO for sections needing review |
497
-
498
- ## Code Graph Usage
499
-
500
- The code-graph.json enables:
501
- - **Accurate docs** - Use exact function signatures
502
- - **Complete coverage** - Know all exports to document
503
- - **Easy updates** - Re-scan to refresh the graph
504
- - **No hallucination** - Only document what exists
505
- - **Type accuracy** - Reference real type definitions
628
+ | **Project overview first** | Quick scan using git to understand structure |
629
+ | **Strategy first** | Define goals and audience before structure |
630
+ | **Audience-driven** | Match content to user needs |
631
+ | **Diátaxis types** | Classify every page by content type |
632
+ | **IA approval required** | Always get user approval before generating content |
633
+ | **Expert writing** | Second person, active voice, task-oriented |
634
+ | **Mark unknowns** | Add TODO for sections needing review |
635
+
636
+ ## Quality Checklist
637
+
638
+ Before completing, verify:
639
+
640
+ - [ ] Title is clear and specific
641
+ - [ ] Introduction explains the "why"
642
+ - [ ] Content type matches page purpose
643
+ - [ ] Code examples are complete and tested
644
+ - [ ] Links to related docs included
645
+ - [ ] Follows writing guidelines (2nd person, active voice)
646
+ - [ ] Progressive disclosure (basic → advanced)