codewiki-wiki-generator
Skill1.8k starsChanged 18 days agoMITView on GitHub
Generate Wiki documentation for code repositories using CodeWiki MCP tools. Use this skill when the user asks to generate a Wiki, code documentation, repository documentation, or analyze codebase structure. Requires CodeWiki MCP server to be configured.
- Installs packages
Trending
Quiet since May.thin dataabout the whole repository
Who's talking about FSoft-AI4Code/CodeWiki
- @tom-doerr.bsky.social“https://github.com/FSoft-AI4Code/CodeWiki/”Bluesky · Nov 22, 2025 · 1 likes
- xlibraries/agent-hub“Agent Hub — Phase 7 — Code Intelligence + Autonomous Engineering”GitHub · May 24, 2026
- xlibraries/agent-hub“Agent Hub — Phase 5 — Research + RAG Systems”GitHub · May 24, 2026
- pietgk/vivief“combine vivief concepts brainstorm”GitHub · Jan 15, 2026
The biggest 4 of 4 mentions linking to the repository that our crawl found. Each line is their own headline.
The file
Show its rules and text
We split this skill into the rules it gives an agent
25 rules. About 0 are common, 6 are distinctive, and 19 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
19
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 27
Before starting, confirm the CodeWiki MCP server is available.
- Very specific: line 29
If tools are unavailable, prompt the user to install and configure CodeWiki:
- Very specific: line 58
Read {workspace_dir}/component_index.json — Complete component list
- Very specific: line 59
Read {workspace_dir}/leaf_nodes.json — Leaf node ID list
- Very specific: line 68
Get clustering rules: Call get_prompt with {"prompt_type": "cluster"}
- Distinctive: line 70
Read additional repository files if needed: Use your file reading tools directly to read source files within the repository
- Very specific: line 76
Save module tree: Call save_module_tree:
- Very specific: line 94
Read processing_order.json to get the processing order.
- Very specific: line 99
Read source code: read_code_components → all component IDs in this module, then read files under sources/
- Distinctive: line 101
Write documentation including: module introduction and core functionality, architecture diagram (at least 1 Mermaid diagram), component …
- Very specific: line 104
If Mermaid validation fails, fix the syntax and retry with edit_doc_file (command: "str_replace").
- Very specific: line 108
Read all child modules' generated .md files directly using your file reading tools
- Distinctive: line 116
Read all generated module documentation using your file reading tools
- Distinctive: line 117
Write a repository-level overview including: project introduction, end-to-end architecture diagram (Mermaid), reference links to each …
- Very specific: line 122
Call close_session → {"session_id": "<session_id>"} to release memory and clean up workspace files.
- Very specific: line 126
When documentation has already been generated for a repository (metadata.json and module_tree.json exist under output_dir), the …
- Very specific: line 134
Call analyze_repo and check the returned changes field or read the changes.json file
- Very specific: line 135
If no_changes: true, inform the user that documentation is up-to-date, no action needed
- Very specific: line 136
If no_changes: false, only update modules listed in affected_modules:
- Very specific: line 137
Use read_code_components to read new source code for changed components (written to workspace files, then read)
- Very specific: line 138
Use edit_doc_file (str_replace) to partially modify the corresponding documentation instead of rewriting the entire document
- Distinctive: line 159
Language: Write in English by default (unless the user specifies another language)
- Distinctive: line 168
Use simple alphanumeric node IDs and quote flowchart labels, keeping the shape:
- Very specific: line 180
Do not use interactive syntax such as click.
- Very specific: line 190
Component ID format: Always use the original IDs from component_index.json (e.g., src/main.py::MyClass), preserving the :: separator
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CodeWiki Documentation Generator
You are a code documentation generation expert. Use CodeWiki's MCP tools to generate comprehensive Wiki documentation for code repositories. All 8 tools require no LLM configuration — you provide all the intelligence and reasoning, CodeWiki provides the toolchain.
Core Mechanism: File Side-Channel
CodeWiki MCP uses a file side-channel architecture: large data payloads (component index, source code, processing order) are written to disk files, and MCP returns only file paths and concise summaries. You need to use your own file reading capabilities to read workspace files for complete data.
The workspace directory is located at {repo_path}/.codewiki/sessions/{session_id}/, containing:
component_index.json— Complete component index (each entry includes id/type/file)leaf_nodes.json— Complete list of leaf node IDslanguages.json— Language statisticssummary.json— Analysis summarychanges.json— Incremental change information (optional)processing_order.json— Documentation generation ordersources/— Component source files (one.srcfile per component)
Prerequisites
Before starting, confirm the CodeWiki MCP server is available. The MCP tool list should include the following 8 tools: analyze_repo, read_code_components, write_doc_file, edit_doc_file, save_module_tree, get_processing_order, get_prompt, close_session.
If tools are unavailable, prompt the user to install and configure CodeWiki:
git clone https://github.com/FSoft-AI4Code/CodeWiki.git
cd CodeWiki && pip install -e .Then add to MCP configuration:
{"mcpServers":{"codewiki":{"command":"codewiki","args":["mcp"]}}}Five-Phase Workflow
Execute strictly in the following order. All tool calls after Phase 1 require the session_id returned by analyze_repo.
Phase 1: Analyze Repository
Call analyze_repo:
{ "repo_path": "<absolute repo path>", "output_dir": "<repo path>/repowiki" }Returns: session_id, workspace_dir (workspace root path), stats (component/leaf counts, language statistics), files (paths to each data file), changes (incremental change information).
You must read workspace files next for complete data:
- Read
{workspace_dir}/component_index.json— Complete component list - Read
{workspace_dir}/leaf_nodes.json— Leaf node ID list - Review
statsto understand repository scale and plan clustering strategy
Remember the session_id — every subsequent step requires it.
Phase 2: Module Clustering
This is the phase that requires the most comprehension. You need to group components into logical modules.
- Get clustering rules: Call
get_promptwith{"prompt_type": "cluster"} - Read source code: Call
read_code_componentswith component ID lists; source code is written to the workspacesources/directory, then read these.srcfiles directly to understand each component's functionality and relationships. You can pass any number of component IDs per batch (no limit, no truncation) - Read additional repository files if needed: Use your file reading tools directly to read source files within the repository
- Group by the following principles:
- Functional cohesion: closely related components go into the same module
- File proximity: components in the same file/directory tend to belong to the same module
- Scale control: typically 3-8 top-level modules, each with 5-30 components
- Component IDs must be preserved exactly (including
::separators)
- Save module tree: Call
save_module_tree:
{
"session_id": "<session_id>",
"module_tree": {
"ModuleName": {
"components": ["file.py::ClassA", "file.py::func_b"],
"children": {}
}
}
}The return result includes the processing_order_file path — read this file to get the leaf-first documentation generation order.
Phase 3: Per-Module Documentation Generation
Read processing_order.json to get the processing order. Process leaf modules first, then parent modules.
For each leaf module (is_leaf=true):
- Get system prompt:
get_prompt→{"prompt_type": "system_leaf", "variables": {"module_name": "<module name>", "module_path": <path from processing_order.json>}} - Read source code:
read_code_components→ all component IDs in this module, then read files undersources/ - For additional context, use your file reading tools directly to read relevant source files in the repository
- Write documentation including: module introduction and core functionality, architecture diagram (at least 1 Mermaid diagram), component responsibility descriptions, cross-references to other modules' pages (paths relative to this page, see below)
- Save:
write_doc_file→{"session_id": "...", "filename": "<doc_path from processing_order.json>", "content": "..."}
If Mermaid validation fails, fix the syntax and retry with edit_doc_file (command: "str_replace").
For each parent module (is_leaf=false):
- Read all child modules' generated
.mdfiles directly using your file reading tools - Get overview prompt:
get_prompt→{"prompt_type": "overview_module", "variables": {"module_name": "<module name>"}} - Synthesize child module documentation into a parent module overview
- Save with
write_doc_fileat the module'sdoc_path
Phase 4: Generate Repository Overview
- Get prompt:
get_prompt→{"prompt_type": "overview_repo", "variables": {"repo_name": "<repo name>"}} - Read all generated module documentation using your file reading tools
- Write a repository-level overview including: project introduction, end-to-end architecture diagram (Mermaid), reference links to each module's documentation
- Save:
write_doc_file→filename: "overview.md"
Phase 5: Cleanup
Call close_session → {"session_id": "<session_id>"} to release memory and clean up workspace files.
Incremental Update Mode
When documentation has already been generated for a repository (metadata.json and module_tree.json exist under output_dir), the analyze_repo return result includes a changes field, with complete data written to the changes.json file (the changed_files list is no longer truncated).
Change detection strategy: Prefers git diff (comparing commit SHA + checking for uncommitted workspace changes); falls back to comparing file modification times for non-git repositories.
Note:
metadata.jsonis written only whenclose_sessionis called. Sessions that end withoutclose_sessionleave no baseline, so the nextanalyze_repofalls back to full analysis. Always callclose_sessionat the end of the workflow.
Incremental update workflow:
- Call
analyze_repoand check the returnedchangesfield or read thechanges.jsonfile - If
no_changes: true, inform the user that documentation is up-to-date, no action needed - If
no_changes: false, only update modules listed inaffected_modules:- Use
read_code_componentsto read new source code for changed components (written to workspace files, then read) - Use
edit_doc_file(str_replace) to partially modify the corresponding documentation instead of rewriting the entire document
- Use
- For parent modules in
cascade_modules, read updated child documents and refresh the overview accordingly - Finally update
overview.md
The granularity of incremental updates is module-level — if any component in a module changes, that module's documentation needs updating.
Tool Quick Reference
| Tool | Purpose | Data Flow |
analyze_repo | Analyze repository, build dependency graph | Writes files to workspace, returns paths + stats |
read_code_components | Get component source code | Each component written to sources/*.src, returns paths |
write_doc_file | Create .md documents (auto Mermaid validation) | Writes file directly |
edit_doc_file | Edit documents: str_replace / insert / undo | Modifies file directly |
save_module_tree | Save module clustering results | Writes module_tree.json + processing_order.json |
get_processing_order | Get leaf-first processing order | Writes processing_order.json, returns path |
get_prompt | Get prompt templates | Returns inline (small data) |
close_session | Close session and release resources | Cleans up workspace files |
Documentation Quality Standards
- Language: Write in English by default (unless the user specifies another language)
- Mermaid diagrams: At least 1 architecture diagram per module, prefer
graph TDorgraph LR - Page layout: Pages mirror the module tree. A module's page sits next to the folder holding its children (
auth.md,auth/login.md,auth/login/tokens.md);overview.mdstays at the root. Each entry ofprocessing_order.jsongives itsdoc_path - Cross-references: Link with paths relative to the linking page, e.g. from
auth/login.mdtobilling.mdwrite[Billing](../billing.md), and fromauth.mdtoauth/login.mdwrite[Login](auth/login.md). Links are re-checked and repaired when the session closes - Code examples: Show signatures and brief usage for key functions/classes
- Length: Leaf module docs 200-500 lines, parent module overviews 100-300 lines, repository overview 80-200 lines
Mermaid Syntax Guidelines
- Use simple alphanumeric node IDs and quote flowchart labels, keeping the shape:
- BAD:
C{msg.error()?}→ GOOD:C{"msg.error()?"} - BAD:
D[config[key]]→ GOOD:D["config[key]"]
- BAD:
- In sequence messages, function calls,
(){}[], commas and--are ordinary text:A->>B: call process(data), config[key], {value} -- result - A literal sequence-message semicolon must be encoded as
#59;. Backticks do not escape it:- BAD:
A->>B: first; second→ GOOD:A->>B: first#59; second
- BAD:
- Double dashes are valid inside node labels, pipe-delimited edge labels and sequence messages.
Quote inline flowchart edge text containing
--:- BAD:
A -- start -- stop --> B→ GOOD:A -- "start -- stop" --> B - Also valid:
A -->|start -- stop| B. Do not rewrite valid--text or command-line flags.
- BAD:
- Subgraph syntax:
subgraph title ... end. - Do not use interactive syntax such as
click. - Fix confirmed syntax errors using the returned diagnostics. Validation unavailable is a warning, not a request to rewrite a diagram. If a tool repairs a label, use its reported saved replacement in subsequent edits.
Error Handling
- Mermaid validation failure: The tool returns validation error details; fix the syntax and retry with
edit_doc_file+str_replace - Session expired (2-hour timeout): Re-call
analyze_repoto create a new session - Large repositories:
analyze_repomay take ~30 seconds; useinclude_patterns/exclude_patternsto narrow the analysis scope. There are no longer any component count or source code length truncation limits - Component ID format: Always use the original IDs from
component_index.json(e.g.,src/main.py::MyClass), preserving the::separator
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

