Wiki Generation
Generate structured technical documentation from codebases. Three integrated capabilities: architecture mapping (plan the wiki), page writing (produce the content), and onboarding generation (new-contributor guides).
When to Use
- User asks to "create a wiki", "document this repo", "generate docs"
- User wants onboarding documentation for new team members
- User needs a documentation plan or structure for an existing codebase
- User wants comprehensive technical deep-dives with source citations
When NOT to Use
- Writing a single API reference (use
api-documentation)
- Fixing existing documentation (use
doc-hygiene)
- Creating diagrams only (use
markdown-mermaid)
Capability 1: Architecture Mapping
Generate a hierarchical documentation structure by analyzing the codebase.
Procedure
- Scan the repository file tree, README, and build files
- Detect project type, languages, frameworks, architectural patterns
- Identify layers — presentation, business logic, data access, infrastructure
- Generate catalogue — hierarchical structure with section titles, scope, and source file references
Output: Documentation Catalogue
## Documentation Structure
### Getting Started
- Overview (README + architecture summary)
- Setup (build files, env requirements)
- Quick Reference (key commands, endpoints)
### Architecture
- System Overview (layer diagram, component map)
- [Component A] (per major module)
- [Component B]
- Data Flow (how data moves through the system)
### Onboarding
- Principal-Level Guide (architectural deep-dive)
- Zero-to-Hero Guide (contributor walkthrough)
Constraints
- Max nesting depth: 4 levels
- Max 8 children per section
- Small repos (≤10 files): Getting Started only, skip Deep Dive
- Every section must reference specific source files
- Derive all titles from actual repository content — never use generic placeholders
Capability 2: Page Writing
Generate rich technical documentation pages with source citations and diagrams.
Depth Requirements (Non-Negotiable)
- Trace actual code paths — do not guess from file names; read the implementation
- Every claim needs a source — file path + function/class name
- Distinguish fact from inference — if you read the code, say so; if inferring, mark it
- First principles — explain WHY something exists before WHAT it does
- No hand-waving — don't say "this likely handles..." — read the code or say "Unknown"
Page Structure
# [Component/Feature Name]
## Overview
Why this exists. What problem it solves. (1-2 paragraphs)
## Architecture
Mermaid diagram showing component relationships.
## Key Abstractions
The load-bearing interfaces and types.
## Data Flow
How data moves through this component (sequence diagram).
## Implementation Details
Non-obvious behaviors, algorithms, edge cases.
(Cite: `path/to/file.ts:functionName`)
## Error Handling
What can go wrong and how the system responds.
## References
- Source files cited in this page
- Related documentation
Rules
- Minimum 2 Mermaid diagrams per page (architecture + flow)
- Minimum 5 different source files cited per page
- If evidence is missing: mark as
(Unknown — verify in path/to/check)
- Use Markdown tables for APIs, configs, and component summaries
Capability 3: Onboarding Generation
Generate two complementary onboarding documents for any codebase.
Guide A: Principal-Level (Senior Engineers)
Audience: Staff+ engineers who need the "why" behind decisions.
Required sections:
- System Philosophy — design principles, invariants, key choices
- Architecture Overview — component map with Mermaid diagram
- Key Abstractions — load-bearing interfaces everything depends on
- Decision Log — major architectural decisions with context and trade-offs
- Dependency Rationale — why each major dependency was chosen
- Data Flow — how data moves (traced from code, not guessed)
- Failure Modes — what breaks, how errors propagate, recovery patterns
- Performance Characteristics — bottlenecks, hot paths, scaling limits
- Security Model — auth, trust boundaries, data sensitivity
- Testing Strategy — what's tested, what isn't, testing philosophy
- Known Technical Debt — honest assessment of shortcuts and risks
Guide B: Zero-to-Hero (New Contributors)
Audience: New contributors who need step-by-step practical guidance.
Required sections:
- What This Project Does — 2-3 sentence elevator pitch
- Prerequisites — tools, versions, accounts needed
- Environment Setup — step-by-step with exact commands and expected output
- Project Structure — annotated directory tree (what lives where and why)
- Your First Task — end-to-end walkthrough of adding a simple feature
- Development Workflow — branch strategy, commit conventions, PR process
- Running Tests — how to run, what to test, how to add a test
- Debugging Guide — common issues and how to diagnose them
- Code Patterns — "If you want to add X, follow this pattern" templates
- Common Pitfalls — mistakes every new contributor makes
- Glossary — terms used in the codebase that aren't obvious
- Quick Reference Card — cheat sheet of most-used commands and patterns
Rules for Both Guides
- Every claim backed by
(file_path:line_number) citation
- All code examples in the detected primary language
- Every setup command must be copy-pasteable with expected output
- Include Mermaid diagrams for architecture and workflow
Language Detection
Scan repository for build files to determine primary language:
| Build File |
Language |
package.json / tsconfig.json |
TypeScript/JavaScript |
*.csproj / *.sln |
C# / .NET |
Cargo.toml |
Rust |
pyproject.toml / setup.py |
Python |
go.mod |
Go |
pom.xml / build.gradle |
Java |
Use the primary language for all code examples. When explaining complex patterns, optionally include a comparison in a familiar language.
Error Handling
| Scenario |
Action |
| Repository has no README |
Generate catalogue from file structure alone |
| Language detection fails |
Default to most common language by file count |
| Repo has fewer than 3 files |
Produce minimal single-section documentation |
| Build/setup commands unclear |
Mark with "verify" annotations |
| Cited file paths cannot be verified |
Mark as (Unknown — verify in path/to/check) |
| Insufficient source files (<5) |
Cite what's available and note the gap |
Example Workflow
User: "Create wiki documentation for this project"
- Architecture Mapping → scan repo, produce documentation catalogue
- User confirms structure (or adjusts)
- Page Writing → generate each section with citations and diagrams
- Onboarding → produce Principal-Level and Zero-to-Hero guides
Output: Complete documentation set grounded in actual source code, not assumptions.
1---2name: wiki-generation3description: Generate structured documentation from codebases — architecture mapping, page writing, and onboarding guides. Use when asked to create a wiki, document a repo, generate onboarding docs, map architecture for documentation, or produce a documentation plan from source code.4---5
6# Wiki Generation
7
8Generate structured technical documentation from codebases. Three integrated capabilities: architecture mapping (plan the wiki), page writing (produce the content), and onboarding generation (new-contributor guides).
9
10## When to Use
11
12- User asks to "create a wiki", "document this repo", "generate docs"
13- User wants onboarding documentation for new team members
14- User needs a documentation plan or structure for an existing codebase
15- User wants comprehensive technical deep-dives with source citations
16
17## When NOT to Use
18
19- Writing a single API reference (use `api-documentation`)
20- Fixing existing documentation (use `doc-hygiene`)
21- Creating diagrams only (use `markdown-mermaid`)
22
23---
24
25## Capability 1: Architecture Mapping
26
27Generate a hierarchical documentation structure by analyzing the codebase.
28
29### Procedure
30
311. **Scan** the repository file tree, README, and build files
322. **Detect** project type, languages, frameworks, architectural patterns
333. **Identify layers** — presentation, business logic, data access, infrastructure
344. **Generate catalogue** — hierarchical structure with section titles, scope, and source file references
35
36### Output: Documentation Catalogue
37
38```markdown
39## Documentation Structure
40
41### Getting Started
42- Overview (README + architecture summary)
43- Setup (build files, env requirements)
44- Quick Reference (key commands, endpoints)
45
46### Architecture
47- System Overview (layer diagram, component map)
48- [Component A] (per major module)
49- [Component B]
50- Data Flow (how data moves through the system)
51
52### Onboarding
53- Principal-Level Guide (architectural deep-dive)
54- Zero-to-Hero Guide (contributor walkthrough)
55```
56
57### Constraints
58
59- Max nesting depth: 4 levels
60- Max 8 children per section
61- Small repos (≤10 files): Getting Started only, skip Deep Dive
62- Every section must reference specific source files
63- Derive all titles from actual repository content — never use generic placeholders
64
65---
66
67## Capability 2: Page Writing
68
69Generate rich technical documentation pages with source citations and diagrams.
70
71### Depth Requirements (Non-Negotiable)
72
731. **Trace actual code paths** — do not guess from file names; read the implementation
742. **Every claim needs a source** — file path + function/class name
753. **Distinguish fact from inference** — if you read the code, say so; if inferring, mark it
764. **First principles** — explain WHY something exists before WHAT it does
775. **No hand-waving** — don't say "this likely handles..." — read the code or say "Unknown"
78
79### Page Structure
80
81```markdown
82# [Component/Feature Name]
83
84## Overview
85Why this exists. What problem it solves. (1-2 paragraphs)
86
87## Architecture
88Mermaid diagram showing component relationships.
89
90## Key Abstractions
91The load-bearing interfaces and types.
92
93## Data Flow
94How data moves through this component (sequence diagram).
95
96## Implementation Details
97Non-obvious behaviors, algorithms, edge cases.
98(Cite: `path/to/file.ts:functionName`)
99
100## Error Handling
101What can go wrong and how the system responds.
102
103## References
104- Source files cited in this page
105- Related documentation
106```
107
108### Rules
109
110- Minimum 2 Mermaid diagrams per page (architecture + flow)
111- Minimum 5 different source files cited per page
112- If evidence is missing: mark as `(Unknown — verify in path/to/check)`
113- Use Markdown tables for APIs, configs, and component summaries
114
115---
116
117## Capability 3: Onboarding Generation
118
119Generate two complementary onboarding documents for any codebase.
120
121### Guide A: Principal-Level (Senior Engineers)
122
123**Audience**: Staff+ engineers who need the "why" behind decisions.
124
125Required sections:
126
1271. **System Philosophy** — design principles, invariants, key choices
1282. **Architecture Overview** — component map with Mermaid diagram
1293. **Key Abstractions** — load-bearing interfaces everything depends on
1304. **Decision Log** — major architectural decisions with context and trade-offs
1315. **Dependency Rationale** — why each major dependency was chosen
1326. **Data Flow** — how data moves (traced from code, not guessed)
1337. **Failure Modes** — what breaks, how errors propagate, recovery patterns
1348. **Performance Characteristics** — bottlenecks, hot paths, scaling limits
1359. **Security Model** — auth, trust boundaries, data sensitivity
13610. **Testing Strategy** — what's tested, what isn't, testing philosophy
13711. **Known Technical Debt** — honest assessment of shortcuts and risks
138
139### Guide B: Zero-to-Hero (New Contributors)
140
141**Audience**: New contributors who need step-by-step practical guidance.
142
143Required sections:
144
1451. **What This Project Does** — 2-3 sentence elevator pitch
1462. **Prerequisites** — tools, versions, accounts needed
1473. **Environment Setup** — step-by-step with exact commands and expected output
1484. **Project Structure** — annotated directory tree (what lives where and why)
1495. **Your First Task** — end-to-end walkthrough of adding a simple feature
1506. **Development Workflow** — branch strategy, commit conventions, PR process
1517. **Running Tests** — how to run, what to test, how to add a test
1528. **Debugging Guide** — common issues and how to diagnose them
1539. **Code Patterns** — "If you want to add X, follow this pattern" templates
15410. **Common Pitfalls** — mistakes every new contributor makes
15511. **Glossary** — terms used in the codebase that aren't obvious
15612. **Quick Reference Card** — cheat sheet of most-used commands and patterns
157
158### Rules for Both Guides
159
160- Every claim backed by `(file_path:line_number)` citation
161- All code examples in the detected primary language
162- Every setup command must be copy-pasteable with expected output
163- Include Mermaid diagrams for architecture and workflow
164
165---
166
167## Language Detection
168
169Scan repository for build files to determine primary language:
170
171| Build File | Language |
172| ---------- | -------- |
173| `package.json` / `tsconfig.json` | TypeScript/JavaScript |
174| `*.csproj` / `*.sln` | C# / .NET |
175| `Cargo.toml` | Rust |
176| `pyproject.toml` / `setup.py` | Python |
177| `go.mod` | Go |
178| `pom.xml` / `build.gradle` | Java |
179
180Use the primary language for all code examples. When explaining complex patterns, optionally include a comparison in a familiar language.
181
182---
183
184## Error Handling
185
186| Scenario | Action |
187| -------- | ------ |
188| Repository has no README | Generate catalogue from file structure alone |
189| Language detection fails | Default to most common language by file count |
190| Repo has fewer than 3 files | Produce minimal single-section documentation |
191| Build/setup commands unclear | Mark with "verify" annotations |
192| Cited file paths cannot be verified | Mark as `(Unknown — verify in path/to/check)` |
193| Insufficient source files (<5) | Cite what's available and note the gap |
194
195---
196
197## Example Workflow
198
199**User**: "Create wiki documentation for this project"
200
2011. **Architecture Mapping** → scan repo, produce documentation catalogue
2022. **User confirms** structure (or adjusts)
2033. **Page Writing** → generate each section with citations and diagrams
2044. **Onboarding** → produce Principal-Level and Zero-to-Hero guides
205
206**Output**: Complete documentation set grounded in actual source code, not assumptions.