Code Wiki
Generate a full wiki for any codebase: overview, architecture, per-module deep-dives, and Mermaid diagrams. Works on local repos, private repos, and any language.
When to Use
- User says "document this codebase" or "generate a wiki"
- Onboarding to an unfamiliar repo
- Need architecture diagrams
- Creating reference documentation
Procedure
Phase 1: Scan Structure
- Run
lsandfind -maxdepth 3to understand layout - Read README and manifest files
- Identify 8-10 key modules to document
Phase 2: Write Overview
- Write
README.mdwith overview and module map - Write
architecture.mdwith system diagram - Create
diagrams/folder for Mermaid files
Phase 3: Document Modules
For each module:
- Identify 3-5 most important files
- Read and understand the code
- Write module doc with responsibilities, key files, public API
Phase 4: Generate Diagrams
- Class diagram for key types
- Sequence diagrams for main workflows
- Keep diagrams under 20 nodes each
Phase 5: Finalize
- Write
getting-started.md - Write
api.mdif applicable - Save state to
.codewiki-state.json
Output Structure
wiki/
├── README.md
├── architecture.md
├── getting-started.md
├── api.md
├── modules/
│ ├── module-a.md
│ └── module-b.md
└── diagrams/
├── class-diagram.md
└── sequences.md
Pitfalls
- Fabricating components that do not exist in the code
- Generic AI prose without specific details
- Diagrams with more than 50 nodes
- Documenting tests or generated code as product code
Verification
- All referenced files exist
- Diagrams render correctly
- Module docs match actual code
- No fabricated functions or classes
How to use?
1. Download
Go to the AGENT KD SKILL gallery and find this skill card. Click Download to save the SKILL.md file.
2. Install
Copy the downloaded SKILL.md into your agent's skills directory:
| Agent | Path |
|---|---|
| Hermes | ~/.hermes/skills/hermes/code-wiki/SKILL.md |
| opencode | ~/.config/opencode/skills/code-wiki/SKILL.md |
| Claude Code | ~/.claude/skills/code-wiki/SKILL.md |
3. Use
Restart your agent session. The skill will auto-load when documentation is needed.
4. Verify
Ask your agent to document a codebase. If it generates structured wiki with diagrams, you're all set.