agentleFS
FSoft-AI4CodeFSoft-AI4Code/CodeWiki/skills/codewiki-wiki-generator/SKILL.md

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

Dec 2025: 0 mentionsJan 2026: 1 mentionFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 2 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 0 mentionsSep 2026: 0 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the FSoft-AI4Code/CodeWiki repository that our weekly crawl found: only 4 in all, so this is a hint, not a trend. There is no adoption data for this file yet.

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
  1. Very specific:

    Before starting, confirm the CodeWiki MCP server is available.

    line 27
  2. Very specific:

    If tools are unavailable, prompt the user to install and configure CodeWiki:

    line 29
  3. Very specific:

    Read {workspace_dir}/component_index.json — Complete component list

    line 58
  4. Very specific:

    Read {workspace_dir}/leaf_nodes.json — Leaf node ID list

    line 59
  5. Very specific:

    Get clustering rules: Call get_prompt with {"prompt_type": "cluster"}

    line 68
  6. Distinctive:

    Read additional repository files if needed: Use your file reading tools directly to read source files within the repository

    line 70
  7. Very specific:

    Save module tree: Call save_module_tree:

    line 76
  8. Very specific:

    Read processing_order.json to get the processing order.

    line 94
  9. Very specific:

    Read source code: read_code_components → all component IDs in this module, then read files under sources/

    line 99
  10. Distinctive:

    Write documentation including: module introduction and core functionality, architecture diagram (at least 1 Mermaid diagram), component …

    line 101
  11. Very specific:

    If Mermaid validation fails, fix the syntax and retry with edit_doc_file (command: "str_replace").

    line 104
  12. Very specific:

    Read all child modules' generated .md files directly using your file reading tools

    line 108
  13. Distinctive:

    Read all generated module documentation using your file reading tools

    line 116
  14. Distinctive:

    Write a repository-level overview including: project introduction, end-to-end architecture diagram (Mermaid), reference links to each …

    line 117
  15. Very specific:

    Call close_session → {"session_id": "<session_id>"} to release memory and clean up workspace files.

    line 122
  16. Very specific:

    When documentation has already been generated for a repository (metadata.json and module_tree.json exist under output_dir), the …

    line 126
  17. Very specific:

    Call analyze_repo and check the returned changes field or read the changes.json file

    line 134
  18. Very specific:

    If no_changes: true, inform the user that documentation is up-to-date, no action needed

    line 135
  19. Very specific:

    If no_changes: false, only update modules listed in affected_modules:

    line 136
  20. Very specific:

    Use read_code_components to read new source code for changed components (written to workspace files, then read)

    line 137
  21. Very specific:

    Use edit_doc_file (str_replace) to partially modify the corresponding documentation instead of rewriting the entire document

    line 138
  22. Distinctive:

    Language: Write in English by default (unless the user specifies another language)

    line 159
  23. Distinctive:

    Use simple alphanumeric node IDs and quote flowchart labels, keeping the shape:

    line 168
  24. Very specific:

    Do not use interactive syntax such as click.

    line 180
  25. Very specific:

    Component ID format: Always use the original IDs from component_index.json (e.g., src/main.py::MyClass), preserving the :: separator

    line 190

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 IDs
  • languages.json — Language statistics
  • summary.json — Analysis summary
  • changes.json — Incremental change information (optional)
  • processing_order.json — Documentation generation order
  • sources/ — Component source files (one .src file 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:

  1. Read {workspace_dir}/component_index.json — Complete component list
  2. Read {workspace_dir}/leaf_nodes.json — Leaf node ID list
  3. Review stats to 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.

  1. Get clustering rules: Call get_prompt with {"prompt_type": "cluster"}
  2. Read source code: Call read_code_components with component ID lists; source code is written to the workspace sources/ directory, then read these .src files directly to understand each component's functionality and relationships. You can pass any number of component IDs per batch (no limit, no truncation)
  3. Read additional repository files if needed: Use your file reading tools directly to read source files within the repository
  4. 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)
  5. 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):

  1. Get system prompt: get_prompt → {"prompt_type": "system_leaf", "variables": {"module_name": "<module name>", "module_path": <path from processing_order.json>}}
  2. Read source code: read_code_components → all component IDs in this module, then read files under sources/
  3. For additional context, use your file reading tools directly to read relevant source files in the repository
  4. 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)
  5. 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):

  1. Read all child modules' generated .md files directly using your file reading tools
  2. Get overview prompt: get_prompt → {"prompt_type": "overview_module", "variables": {"module_name": "<module name>"}}
  3. Synthesize child module documentation into a parent module overview
  4. Save with write_doc_file at the module's doc_path

Phase 4: Generate Repository Overview

  1. Get prompt: get_prompt → {"prompt_type": "overview_repo", "variables": {"repo_name": "<repo name>"}}
  2. Read all generated module documentation using your file reading tools
  3. Write a repository-level overview including: project introduction, end-to-end architecture diagram (Mermaid), reference links to each module's documentation
  4. 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.json is written only when close_session is called. Sessions that end without close_session leave no baseline, so the next analyze_repo falls back to full analysis. Always call close_session at the end of the workflow.

Incremental update workflow:

  1. Call analyze_repo and check the returned changes field or read the changes.json file
  2. If no_changes: true, inform the user that documentation is up-to-date, no action needed
  3. If no_changes: false, only update modules listed in affected_modules:
    • Use read_code_components to 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
  4. For parent modules in cascade_modules, read updated child documents and refresh the overview accordingly
  5. 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

ToolPurposeData Flow
analyze_repoAnalyze repository, build dependency graphWrites files to workspace, returns paths + stats
read_code_componentsGet component source codeEach component written to sources/*.src, returns paths
write_doc_fileCreate .md documents (auto Mermaid validation)Writes file directly
edit_doc_fileEdit documents: str_replace / insert / undoModifies file directly
save_module_treeSave module clustering resultsWrites module_tree.json + processing_order.json
get_processing_orderGet leaf-first processing orderWrites processing_order.json, returns path
get_promptGet prompt templatesReturns inline (small data)
close_sessionClose session and release resourcesCleans 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 TD or graph 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.md stays at the root. Each entry of processing_order.json gives its doc_path
  • Cross-references: Link with paths relative to the linking page, e.g. from auth/login.md to billing.md write [Billing](../billing.md), and from auth.md to auth/login.md write [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]"]
  • 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
  • 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.
  • 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_repo to create a new session
  • Large repositories: analyze_repo may take ~30 seconds; use include_patterns/exclude_patterns to 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

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.