Commands, package names, and image names on this page come from the open-source project that Mibyan Desktop is built on, and can differ from the Mibyan Desktop installer. For the supported Mibyan install and update path, see Install and update.
Skill metadata
Reference: full SKILL.md
The following is the complete skill definition that Mibyan loads when this skill is triggered. This is what the agent sees as instructions when the skill is active.
Code Wiki Skill
Generate a full wiki for any codebase — overview, architecture, per-module deep-dives, Mermaid class and sequence diagrams. Inspired by Google CodeWiki, but works on local repos, private repos, and any language. Uses only existing Mibyan tools (terminal, read_file, search_files, write_file); no Docker, no external services, no extra dependencies.
This skill produces reference documentation (what/how). It does not produce strategic narrative (why — that’s a different skill).
When to Use
- User says “document this codebase”, “generate a wiki”, “make architecture diagrams”
- Onboarding to an unfamiliar repo and wants a structured reference
- User points at a GitHub URL and asks for documentation
- Need a stable artifact (markdown + Mermaid) that renders on GitHub
- Single-file or single-function documentation — just answer directly
- API reference for one specific endpoint — use
read_fileand answer inline - Strategic “why does this exist” narrative — different skill, different purpose
- Codebases the user is actively developing in this session — just answer questions as they come
Prerequisites
- No env vars required.
giton PATH for repo SHA tracking and remote clones.- Optional:
pygountfor language-breakdown stats (see thecodebase-inspectionskill).
How to Run
Invoke through theterminal tool from the target repo’s root, then use read_file / search_files / write_file to produce the wiki. Default output location is ~/.mibyan/wikis/<repo-name>/. Only write into the repo (docs/wiki/) when the user explicitly requests it.
Quick Reference
Procedure
1. Resolve the target
For a GitHub URL:2. Scan repo structure
Use theterminal tool for the shell work, read_file for manifests:
read_file the relevant manifests (package.json, pyproject.toml, setup.py, Cargo.toml, go.mod, pom.xml, build.gradle) and the project README. Use search_files target='files' to find them rather than guessing names.
3. Pick modules to document
Cap initial pass at 8–10 modules. Heuristics by language:- Python: top-level packages (dirs with
__init__.py), plus subsystem dirs - JS/TS:
src/<subdir>, top-level workspace dirs - Rust: each crate in a workspace, or top-level
src/<module>dirs - Go: each top-level package directory
- Mixed/unfamiliar: top-level directories that contain source code (not config, not tests)
- Imported-from count (a module imported by many is core)
- LOC (bigger modules usually warrant their own doc)
- Mentions in README / top-level docs
4. Write README.md
read_file the actual project README plus the top 2–3 entry-point files. Then write_file:
https://github.com/<owner>/<repo>/blob/<sha>/<path> so links survive future commits.
5. Write architecture.md
[]= component[()]= database / storage{{}}= external service(())= entry point or terminal-->= sync call,-.->= async/event
6. Write per-module docs in modules/
For each selected module, inspect its layout with ls, identify 3–5 most important files (by size, by being named core.py / main.py / __init__.py, by being imported a lot), then read_file those files (use offset / limit to read only what you need; prefer search_files for specific symbols).
7. Write diagrams/class-diagram.md
Pick the 5–10 most important classes/types. read_file them, then write:
8. Write diagrams/sequences.md
Pick 2–4 of the most important workflows. Trace each call path through the code (read entry point, follow function calls), then:
9. Write getting-started.md
10. Write api.md (skip if not applicable)
Only write this if the project is a library or API server. If it is:
- Find the public API surface (
__init__.pyexports, OpenAPI specs, route handlers, exported types) - Document each public entry with signature, parameters, return type, one-line description
- Group by category
11. Write the state file
12. Report to user
State exactly what was generated and where:rm -rf "$WIKI_TMP") after they’ve reviewed the wiki.
Scope Control
Generating a full wiki for a 500K-LOC monorepo is wildly token-expensive. Default to bounded scope:- Initial scan: max depth 3 directories
- Per-module docs: cap at 10 modules unless user expands scope
- Per-file reads: prefer
search_filesfor symbols +read_filewithoffset/limitover full reads - Skip vendored code (
vendor/,third_party/, generated code,_pb2.py,.min.js)
Re-Run / Update
If.codewiki-state.json already exists at the target path:
- Read it for previous SHA and module list
- If source SHA matches: ask user if they want to regenerate or skip
- If SHA differs: offer to regenerate only modules with changed files (
git diff --name-only <old-sha> HEAD)
Pitfalls
- Fabricating components. Every diagram node and claimed function call must be in the source.
read_filebefore writing. The single biggest failure mode for auto-generated docs is plausible-sounding fabrication. - Generic AI prose. “This module is responsible for…” is content-free. Say what the module actually does in domain-specific terms.
- Restating code as prose. A module doc that says “the
processfunction processes things by callingprocess_itemon each item” is worse than just linking to the function. - Mermaid > 50 nodes. They don’t render legibly. Split them.
- Documenting tests, generated code, or vendored deps as if they were product code. Skip them.
- In-repo output without asking. Default is
~/.mibyan/wikis/. Only write into the repo when the user explicitly requests it. - Mermaid special chars need quotes:
A["Tool / Agent"]notA[Tool / Agent].<br>for line breaks inside a node. - Nested code fences in SKILL.md. When writing a markdown example that contains a Mermaid block, use 4-backtick outer fences so the 3-backtick inner
```mermaiddoesn’t close the outer. (This SKILL.md does it.) - classDiagram generics render as
~T~(e.g.List~Tool~), not<T>. - GitHub Mermaid theme is fixed — don’t include
%%{init: ...}%%blocks; they’re stripped on render.
Verification
After writing, verify:- Mermaid blocks balance — opens equal closes per file:
- All expected files exist —
- Module count matches what you intended —
ls "$OUTPUT_DIR/modules" | wc -lshould equal the number of modules you committed to in Step 3. - No fabricated paths — sanity-check 2–3 source links resolve to real files.

