[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7C41VPSA825DNPNSE75E7CP":3,"skill-same:01M7C41VPSA825DNPNSE75E7CP":79},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":41,"commitSha":42,"skillDirectory":43,"forksCount":13,"repositoryHtmlUrl":44,"repositoryHomepageUrl":6,"ownerHtmlUrl":45,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":46,"install":47,"resources":60},"01M7C41VPSA825DNPNSE75E7CP","code-wiki",null,"Generate wiki docs + Mermaid diagrams for any codebase.","fengwhang\u002Fmercury","fengwhang","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F325040254?v=4","01M7C3K54Y41KVGPHEMKEP9X70","01M7C3K55NTZ4B36YP2JY1NMJ0",0,"MIT","https:\u002F\u002Fgithub.com\u002Ffengwhang\u002Fmercury\u002Fblob\u002Fmain\u002Fhermes\u002Foptional-skills\u002Fsoftware-development\u002Fcode-wiki\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: code-wiki\ndescription: \"Generate wiki docs + Mermaid diagrams for any codebase.\"\nversion: 0.1.0\nauthor: Teknium (teknium1), Hermes Agent\nlicense: MIT\nplatforms: [linux, macos, windows]\nmetadata:\n  mercury:\n    tags: [Documentation, Mermaid, Architecture, Diagrams, Wiki, Code-Analysis]\n    related_skills: [codebase-inspection, github]\n---\n\n# Code Wiki Skill\n\nGenerate 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 Mercury tools (`terminal`, `read_file`, `search_files`, `write_file`); no Docker, no external services, no extra dependencies.\n\nThis skill produces **reference documentation** (what\u002Fhow). It does not produce strategic narrative (why — that's a different skill).\n\n## When to Use\n\n- User says \"document this codebase\", \"generate a wiki\", \"make architecture diagrams\"\n- Onboarding to an unfamiliar repo and wants a structured reference\n- User points at a GitHub URL and asks for documentation\n- Need a stable artifact (markdown + Mermaid) that renders on GitHub\n\nDo NOT use this for:\n- Single-file or single-function documentation — just answer directly\n- API reference for one specific endpoint — use `read_file` and answer inline\n- Strategic \"why does this exist\" narrative — different skill, different purpose\n- Codebases the user is actively developing in this session — just answer questions as they come\n\n## Prerequisites\n\n- No env vars required.\n- `git` on PATH for repo SHA tracking and remote clones.\n- Optional: `pygount` for language-breakdown stats (see the `codebase-inspection` skill).\n\n## How to Run\n\nInvoke through the `terminal` tool from the target repo's root, then use `read_file` \u002F `search_files` \u002F `write_file` to produce the wiki. Default output location is `$HERMES_HOME\u002Fwikis\u002F\u003Crepo-name>\u002F`. Only write into the repo (`docs\u002Fwiki\u002F`) when the user explicitly requests it.\n\n## Quick Reference\n\n| Step | Action |\n|---|---|\n| 1 | Resolve target — local cwd, given path, or `git clone --depth 50 \u003Curl>` to a temp dir |\n| 2 | Scan structure — `ls`, `find -maxdepth 3`, manifest files, README |\n| 3 | Pick 8–10 modules to document |\n| 4 | Write `README.md` (overview + module map) |\n| 5 | Write `architecture.md` with Mermaid flowchart |\n| 6 | Write per-module docs in `modules\u002F` |\n| 7 | Write `diagrams\u002Fclass-diagram.md` (Mermaid classDiagram) |\n| 8 | Write `diagrams\u002Fsequences.md` (Mermaid sequenceDiagram, 2–4 workflows) |\n| 9 | Write `getting-started.md` |\n| 10 | Write `api.md` if applicable, else skip |\n| 11 | Write `.codewiki-state.json` |\n| 12 | Report paths to user |\n\n## Procedure\n\n### 1. Resolve the target\n\nFor a GitHub URL:\n\n```bash\nWIKI_TMP=$(mktemp -d)\ngit clone --depth 50 \u003Curl> \"$WIKI_TMP\u002Frepo\"\ncd \"$WIKI_TMP\u002Frepo\"\nREPO_SHA=$(git rev-parse HEAD)\nREPO_NAME=$(basename \u003Curl> .git)\n```\n\nFor a local path (or cwd if none given):\n\n```bash\ncd \u003Cpath>\nREPO_SHA=$(git rev-parse HEAD 2>\u002Fdev\u002Fnull || echo \"uncommitted\")\nREPO_NAME=$(basename \"$PWD\")\n```\n\nThen set the output dir:\n\n```bash\nOUTPUT_DIR=\"$HERMES_HOME\u002Fwikis\u002F$REPO_NAME\"\nmkdir -p \"$OUTPUT_DIR\u002Fmodules\" \"$OUTPUT_DIR\u002Fdiagrams\"\n```\n\n### 2. Scan repo structure\n\nUse the `terminal` tool for the shell work, `read_file` for manifests:\n\n```bash\n# Shallow tree first\nls -la\n\n# Deeper tree, noise filtered\nfind . -type d \\\n  -not -path '*\u002F\\.*' \\\n  -not -path '*\u002Fnode_modules*' \\\n  -not -path '*\u002Fvenv*' \\\n  -not -path '*\u002F__pycache__*' \\\n  -not -path '*\u002Fdist*' \\\n  -not -path '*\u002Fbuild*' \\\n  -not -path '*\u002Ftarget*' \\\n  -maxdepth 3 | sort\n\n# Language breakdown (skip if pygount unavailable)\npygount --format=summary \\\n  --folders-to-skip=\".git,node_modules,venv,.venv,__pycache__,.cache,dist,build,target\" \\\n  . 2>\u002Fdev\u002Fnull || true\n```\n\nThen `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.\n\n### 3. Pick modules to document\n\nCap initial pass at **8–10 modules**. Heuristics by language:\n\n- Python: top-level packages (dirs with `__init__.py`), plus subsystem dirs\n- JS\u002FTS: `src\u002F\u003Csubdir>`, top-level workspace dirs\n- Rust: each crate in a workspace, or top-level `src\u002F\u003Cmodule>` dirs\n- Go: each top-level package directory\n- Mixed\u002Funfamiliar: top-level directories that contain source code (not config, not tests)\n\nFor very large repos, prioritize by:\n1. Imported-from count (a module imported by many is core)\n2. LOC (bigger modules usually warrant their own doc)\n3. Mentions in README \u002F top-level docs\n\nState the module list to the user before generating per-module docs on big repos — gives them a chance to redirect.\n\n### 4. Write `README.md`\n\n`read_file` the actual project README plus the top 2–3 entry-point files. Then `write_file`:\n\n````markdown\n# \u003CProject Name>\n\n\u003COne paragraph: what it is and what it's for. Self-contained — don't assume the\nreader has the source README.>\n\n## Key Concepts\n\n- **\u003CConcept 1>** — \u003Cone line>\n- **\u003CConcept 2>** — \u003Cone line>\n\n## Entry Points\n\n- [`path\u002Fto\u002Fmain.py`](\u003Clink>) — \u003Cwhat runs when you start it>\n- [`path\u002Fto\u002Fcli.py`](\u003Clink>) — \u003CCLI surface>\n\n## High-Level Architecture\n\n\u003C2-3 sentences. Detail goes in architecture.md.>\n\nSee [architecture.md](architecture.md).\n\n## Module Map\n\n| Module | Purpose |\n|---|---|\n| [`\u003Cmodule>`](modules\u002F\u003Cmodule>.md) | \u003Cone-line purpose> |\n\n## Getting Started\n\nSee [getting-started.md](getting-started.md).\n````\n\nFor link targets in local mode use relative paths. For cloned repos use `https:\u002F\u002Fgithub.com\u002F\u003Cowner>\u002F\u003Crepo>\u002Fblob\u002F\u003Csha>\u002F\u003Cpath>` so links survive future commits.\n\n### 5. Write `architecture.md`\n\n````markdown\n# Architecture\n\n\u003C2-3 paragraphs: shape of the system. What talks to what. Where data enters,\nwhere it exits, where state lives.>\n\n## Components\n\n- **\u003CComponent>** — \u003C1-2 sentences>. See [`modules\u002F\u003Cmodule>.md`](modules\u002F\u003Cmodule>.md).\n\n## System Diagram\n\n```mermaid\nflowchart TD\n    User([User]) --> Entry[Entry Point]\n    Entry --> Core[Core Engine]\n    Core --> StorageA[(Database)]\n    Core --> ExternalAPI{{External API}}\n```\n\n## Data Flow\n\n1. **\u003CStep>** — [`\u003Cfile>`](\u003Clink>)\n2. **\u003CStep>** — [`\u003Cfile>`](\u003Clink>)\n\n## Key Design Decisions\n\n- \u003CAnything load-bearing the reader should know>\n````\n\n**Mermaid shape semantics:**\n- `[]` = component\n- `[()]` = database \u002F storage\n- `{{}}` = external service\n- `(())` = entry point or terminal\n- `-->` = sync call, `-.->` = async\u002Fevent\n\nCap at ~20 nodes per diagram. Split into sub-diagrams if larger.\n\n### 6. Write per-module docs in `modules\u002F`\n\nFor each selected module, inspect its layout with `ls`, identify 3–5 most important files (by size, by being named `core.py` \u002F `main.py` \u002F `__init__.py`, by being imported a lot), then `read_file` those files (use `offset` \u002F `limit` to read only what you need; prefer `search_files` for specific symbols).\n\n````markdown\n# Module: `\u003Cmodule>`\n\n\u003C1-2 sentence purpose.>\n\n## Responsibilities\n\n- \u003Cbullet>\n- \u003Cbullet>\n\n## Key Files\n\n- [`\u003Cmodule>\u002F\u003Cfile>`](\u003Clink>) — \u003Cwhat it does>\n\n## Public API\n\n\u003CFunctions\u002Fclasses\u002Fconstants other code uses. Group related items. Show\nsignatures, not full implementations.>\n\n## Internal Structure\n\n\u003CHow the module is organized internally. State management.>\n\n## Dependencies\n\n- **Used by:** \u003Cother modules>\n- **Uses:** \u003Cother modules + external libs>\n\n## Notable Patterns \u002F Gotchas\n\n- \u003CAnything non-obvious>\n````\n\n### 7. Write `diagrams\u002Fclass-diagram.md`\n\nPick the 5–10 most important classes\u002Ftypes. `read_file` them, then write:\n\n````markdown\n# Class Diagram\n\n## Core Types\n\n```mermaid\nclassDiagram\n    class Agent {\n        +string name\n        +list~Tool~ tools\n        +chat(message) string\n    }\n    class Tool {\n        \u003C\u003Cinterface>>\n        +name string\n        +execute(args) any\n    }\n    Agent --> Tool : uses\n    Tool \u003C|-- TerminalTool\n    Tool \u003C|-- WebTool\n```\n\n## Notes\n\n\u003CAnything the diagram can't express — lifecycle, threading, etc.>\n````\n\nFor languages without classes (Go, C, Rust): use the diagram for struct relationships, or skip class-diagram.md and explain it in prose in architecture.md. Don't force-fit.\n\n### 8. Write `diagrams\u002Fsequences.md`\n\nPick 2–4 of the most important workflows. Trace each call path through the code (read entry point, follow function calls), then:\n\n````markdown\n# Sequence Diagrams\n\n## Workflow: \u003CName>\n\n\u003C1 sentence describing what this does and when it runs.>\n\n```mermaid\nsequenceDiagram\n    participant User\n    participant CLI\n    participant Agent\n    participant LLM\n    User->>CLI: types message\n    CLI->>Agent: chat(message)\n    Agent->>LLM: API call\n    LLM-->>Agent: response + tool_calls\n    Agent->>Agent: execute tools\n    Agent-->>CLI: final response\n```\n\n### Walkthrough\n\n1. **User input** — [`cli.py:HermesCLI.run_session`](\u003Clink>)\n2. **Message dispatch** — [`run_agent.py:AIAgent.chat`](\u003Clink>)\n````\n\nDon't invent participants. Every box must correspond to a real component the reader can find in the code.\n\n### 9. Write `getting-started.md`\n\n````markdown\n# Getting Started\n\n## Prerequisites\n\n\u003CFrom manifest files + README. Be specific — versions if pinned.>\n\n## Installation\n\n```bash\n\u003Cexact commands>\n```\n\n## First Run\n\n```bash\n\u003Cminimum command to see the system do something useful>\n```\n\n## Common Workflows\n\n### \u003CWorkflow 1>\n\u003Ccommands>\n\n## Configuration\n\n- `\u003Cconfig-file>` — \u003Cwhat it controls>\n- Env var `\u003CVAR>` — \u003Cwhat it controls>\n\n## Where to Go Next\n\n- Architecture: [architecture.md](architecture.md)\n- Module reference: [README.md#module-map](README.md#module-map)\n````\n\n### 10. Write `api.md` (skip if not applicable)\n\nOnly write this if the project is a library or API server. If it is:\n\n- Find the public API surface (`__init__.py` exports, OpenAPI specs, route handlers, exported types)\n- Document each public entry with signature, parameters, return type, one-line description\n- Group by category\n\n### 11. Write the state file\n\n```bash\ncat > \"$OUTPUT_DIR\u002F.codewiki-state.json\" \u003C\u003CEOF\n{\n  \"repo_name\": \"$REPO_NAME\",\n  \"source_path\": \"$PWD\",\n  \"source_sha\": \"$REPO_SHA\",\n  \"generated_at\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\",\n  \"generator\": \"mercury code-wiki skill v0.1.0\",\n  \"modules_documented\": []\n}\nEOF\n```\n\n### 12. Report to user\n\nState exactly what was generated and where:\n\n```\nGenerated wiki at $HERMES_HOME\u002Fwikis\u002F\u003Crepo-name>\u002F:\n  README.md                   project overview, module map\n  architecture.md             system architecture + flowchart\n  getting-started.md          setup, first run, workflows\n  modules\u002F\u003CN files>           per-module deep-dives\n  diagrams\u002Farchitecture.md    Mermaid flowchart\n  diagrams\u002Fclass-diagram.md   Mermaid class diagram\n  diagrams\u002Fsequences.md       Mermaid sequence diagrams\n```\n\nIf you cloned to a temp dir, remind the user it can be removed (`rm -rf \"$WIKI_TMP\"`) after they've reviewed the wiki.\n\n## Scope Control\n\nGenerating a full wiki for a 500K-LOC monorepo is wildly token-expensive. Default to bounded scope:\n\n- Initial scan: max depth 3 directories\n- Per-module docs: cap at 10 modules unless user expands scope\n- Per-file reads: prefer `search_files` for symbols + `read_file` with `offset`\u002F`limit` over full reads\n- Skip vendored code (`vendor\u002F`, `third_party\u002F`, generated code, `_pb2.py`, `.min.js`)\n\nIf the user says \"do the whole thing exhaustively\", believe them — but ballpark the cost first: \"this repo has ~340 source files, comprehensive coverage will be expensive — confirm?\"\n\n## Re-Run \u002F Update\n\nIf `.codewiki-state.json` already exists at the target path:\n\n- Read it for previous SHA and module list\n- If source SHA matches: ask user if they want to regenerate or skip\n- If SHA differs: offer to regenerate only modules with changed files (`git diff --name-only \u003Cold-sha> HEAD`)\n\nFull incremental-regeneration is a future enhancement — for now, regenerating the whole thing is acceptable.\n\n## Pitfalls\n\n- **Fabricating components.** Every diagram node and claimed function call must be in the source. `read_file` before writing. The single biggest failure mode for auto-generated docs is plausible-sounding fabrication.\n- **Generic AI prose.** \"This module is responsible for...\" is content-free. Say what the module actually does in domain-specific terms.\n- **Restating code as prose.** A module doc that says \"the `process` function processes things by calling `process_item` on each item\" is worse than just linking to the function.\n- **Mermaid > 50 nodes.** They don't render legibly. Split them.\n- **Documenting tests, generated code, or vendored deps as if they were product code.** Skip them.\n- **In-repo output without asking.** Default is `$HERMES_HOME\u002Fwikis\u002F`. Only write into the repo when the user explicitly requests it.\n- **Mermaid special chars need quotes:** `A[\"Tool \u002F Agent\"]` not `A[Tool \u002F Agent]`. `\u003Cbr>` for line breaks inside a node.\n- **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 ` ```mermaid ` doesn't close the outer. (This SKILL.md does it.)\n- **classDiagram generics** render as `~T~` (e.g. `List~Tool~`), not `\u003CT>`.\n- **GitHub Mermaid theme is fixed** — don't include `%%{init: ...}%%` blocks; they're stripped on render.\n\n## Verification\n\nAfter writing, verify:\n\n1. **Mermaid blocks balance** — opens equal closes per file:\n   ```bash\n   for f in \"$OUTPUT_DIR\"\u002Fdiagrams\u002F*.md \"$OUTPUT_DIR\"\u002Farchitecture.md; do\n     opens=$(grep -c '^```mermaid' \"$f\")\n     total=$(grep -c '^```' \"$f\")\n     echo \"$f: $opens mermaid blocks, $total total fences (expect total = opens*2)\"\n   done\n   ```\n2. **All expected files exist** —\n   ```bash\n   ls \"$OUTPUT_DIR\"\u002F{README.md,architecture.md,getting-started.md,.codewiki-state.json} \\\n      \"$OUTPUT_DIR\"\u002Fmodules\u002F \"$OUTPUT_DIR\"\u002Fdiagrams\u002F\n   ```\n3. **Module count matches what you intended** — `ls \"$OUTPUT_DIR\u002Fmodules\" | wc -l` should equal the number of modules you committed to in Step 3.\n4. **No fabricated paths** — sanity-check 2–3 source links resolve to real files.\n","# Code Wiki Skill\n\nGenerate 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 Mercury tools (`terminal`, `read_file`, `search_files`, `write_file`); no Docker, no external services, no extra dependencies.\n\nThis skill produces **reference documentation** (what\u002Fhow). It does not produce strategic narrative (why — that's a different skill).\n\n## When to Use\n\n- User says \"document this codebase\", \"generate a wiki\", \"make architecture diagrams\"\n- Onboarding to an unfamiliar repo and wants a structured reference\n- User points at a GitHub URL and asks for documentation\n- Need a stable artifact (markdown + Mermaid) that renders on GitHub\n\nDo NOT use this for:\n- Single-file or single-function documentation — just answer directly\n- API reference for one specific endpoint — use `read_file` and answer inline\n- Strategic \"why does this exist\" narrative — different skill, different purpose\n- Codebases the user is actively developing in this session — just answer questions as they come\n\n## Prerequisites\n\n- No env vars required.\n- `git` on PATH for repo SHA tracking and remote clones.\n- Optional: `pygount` for language-breakdown stats (see the `codebase-inspection` skill).\n\n## How to Run\n\nInvoke through the `terminal` tool from the target repo's root, then use `read_file` \u002F `search_files` \u002F `write_file` to produce the wiki. Default output location is `$HERMES_HOME\u002Fwikis\u002F\u003Crepo-name>\u002F`. Only write into the repo (`docs\u002Fwiki\u002F`) when the user explicitly requests it.\n\n## Quick Reference\n\n| Step | Action |\n|---|---|\n| 1 | Resolve target — local cwd, given path, or `git clone --depth 50 \u003Curl>` to a temp dir |\n| 2 | Scan structure — `ls`, `find -maxdepth 3`, manifest files, README |\n| 3 | Pick 8–10 modules to document |\n| 4 | Write `README.md` (overview + module map) |\n| 5 | Write `architecture.md` with Mermaid flowchart |\n| 6 | Write per-module docs in `modules\u002F` |\n| 7 | Write `diagrams\u002Fclass-diagram.md` (Mermaid classDiagram) |\n| 8 | Write `diagrams\u002Fsequences.md` (Mermaid sequenceDiagram, 2–4 workflows) |\n| 9 | Write `getting-started.md` |\n| 10 | Write `api.md` if applicable, else skip |\n| 11 | Write `.codewiki-state.json` |\n| 12 | Report paths to user |\n\n## Procedure\n\n### 1. Resolve the target\n\nFor a GitHub URL:\n\n```bash\nWIKI_TMP=$(mktemp -d)\ngit clone --depth 50 \u003Curl> \"$WIKI_TMP\u002Frepo\"\ncd \"$WIKI_TMP\u002Frepo\"\nREPO_SHA=$(git rev-parse HEAD)\nREPO_NAME=$(basename \u003Curl> .git)\n```\n\nFor a local path (or cwd if none given):\n\n```bash\ncd \u003Cpath>\nREPO_SHA=$(git rev-parse HEAD 2>\u002Fdev\u002Fnull || echo \"uncommitted\")\nREPO_NAME=$(basename \"$PWD\")\n```\n\nThen set the output dir:\n\n```bash\nOUTPUT_DIR=\"$HERMES_HOME\u002Fwikis\u002F$REPO_NAME\"\nmkdir -p \"$OUTPUT_DIR\u002Fmodules\" \"$OUTPUT_DIR\u002Fdiagrams\"\n```\n\n### 2. Scan repo structure\n\nUse the `terminal` tool for the shell work, `read_file` for manifests:\n\n```bash\n# Shallow tree first\nls -la\n\n# Deeper tree, noise filtered\nfind . -type d \\\n  -not -path '*\u002F\\.*' \\\n  -not -path '*\u002Fnode_modules*' \\\n  -not -path '*\u002Fvenv*' \\\n  -not -path '*\u002F__pycache__*' \\\n  -not -path '*\u002Fdist*' \\\n  -not -path '*\u002Fbuild*' \\\n  -not -path '*\u002Ftarget*' \\\n  -maxdepth 3 | sort\n\n# Language breakdown (skip if pygount unavailable)\npygount --format=summary \\\n  --folders-to-skip=\".git,node_modules,venv,.venv,__pycache__,.cache,dist,build,target\" \\\n  . 2>\u002Fdev\u002Fnull || true\n```\n\nThen `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.\n\n### 3. Pick modules to document\n\nCap initial pass at **8–10 modules**. Heuristics by language:\n\n- Python: top-level packages (dirs with `__init__.py`), plus subsystem dirs\n- JS\u002FTS: `src\u002F\u003Csubdir>`, top-level workspace dirs\n- Rust: each crate in a workspace, or top-level `src\u002F\u003Cmodule>` dirs\n- Go: each top-level package directory\n- Mixed\u002Funfamiliar: top-level directories that contain source code (not config, not tests)\n\nFor very large repos, prioritize by:\n1. Imported-from count (a module imported by many is core)\n2. LOC (bigger modules usually warrant their own doc)\n3. Mentions in README \u002F top-level docs\n\nState the module list to the user before generating per-module docs on big repos — gives them a chance to redirect.\n\n### 4. Write `README.md`\n\n`read_file` the actual project README plus the top 2–3 entry-point files. Then `write_file`:\n\n````markdown\n# \u003CProject Name>\n\n\u003COne paragraph: what it is and what it's for. Self-contained — don't assume the\nreader has the source README.>\n\n## Key Concepts\n\n- **\u003CConcept 1>** — \u003Cone line>\n- **\u003CConcept 2>** — \u003Cone line>\n\n## Entry Points\n\n- [`path\u002Fto\u002Fmain.py`](\u003Clink>) — \u003Cwhat runs when you start it>\n- [`path\u002Fto\u002Fcli.py`](\u003Clink>) — \u003CCLI surface>\n\n## High-Level Architecture\n\n\u003C2-3 sentences. Detail goes in architecture.md.>\n\nSee [architecture.md](architecture.md).\n\n## Module Map\n\n| Module | Purpose |\n|---|---|\n| [`\u003Cmodule>`](modules\u002F\u003Cmodule>.md) | \u003Cone-line purpose> |\n\n## Getting Started\n\nSee [getting-started.md](getting-started.md).\n````\n\nFor link targets in local mode use relative paths. For cloned repos use `https:\u002F\u002Fgithub.com\u002F\u003Cowner>\u002F\u003Crepo>\u002Fblob\u002F\u003Csha>\u002F\u003Cpath>` so links survive future commits.\n\n### 5. Write `architecture.md`\n\n````markdown\n# Architecture\n\n\u003C2-3 paragraphs: shape of the system. What talks to what. Where data enters,\nwhere it exits, where state lives.>\n\n## Components\n\n- **\u003CComponent>** — \u003C1-2 sentences>. See [`modules\u002F\u003Cmodule>.md`](modules\u002F\u003Cmodule>.md).\n\n## System Diagram\n\n```mermaid\nflowchart TD\n    User([User]) --> Entry[Entry Point]\n    Entry --> Core[Core Engine]\n    Core --> StorageA[(Database)]\n    Core --> ExternalAPI{{External API}}\n```\n\n## Data Flow\n\n1. **\u003CStep>** — [`\u003Cfile>`](\u003Clink>)\n2. **\u003CStep>** — [`\u003Cfile>`](\u003Clink>)\n\n## Key Design Decisions\n\n- \u003CAnything load-bearing the reader should know>\n````\n\n**Mermaid shape semantics:**\n- `[]` = component\n- `[()]` = database \u002F storage\n- `{{}}` = external service\n- `(())` = entry point or terminal\n- `-->` = sync call, `-.->` = async\u002Fevent\n\nCap at ~20 nodes per diagram. Split into sub-diagrams if larger.\n\n### 6. Write per-module docs in `modules\u002F`\n\nFor each selected module, inspect its layout with `ls`, identify 3–5 most important files (by size, by being named `core.py` \u002F `main.py` \u002F `__init__.py`, by being imported a lot), then `read_file` those files (use `offset` \u002F `limit` to read only what you need; prefer `search_files` for specific symbols).\n\n````markdown\n# Module: `\u003Cmodule>`\n\n\u003C1-2 sentence purpose.>\n\n## Responsibilities\n\n- \u003Cbullet>\n- \u003Cbullet>\n\n## Key Files\n\n- [`\u003Cmodule>\u002F\u003Cfile>`](\u003Clink>) — \u003Cwhat it does>\n\n## Public API\n\n\u003CFunctions\u002Fclasses\u002Fconstants other code uses. Group related items. Show\nsignatures, not full implementations.>\n\n## Internal Structure\n\n\u003CHow the module is organized internally. State management.>\n\n## Dependencies\n\n- **Used by:** \u003Cother modules>\n- **Uses:** \u003Cother modules + external libs>\n\n## Notable Patterns \u002F Gotchas\n\n- \u003CAnything non-obvious>\n````\n\n### 7. Write `diagrams\u002Fclass-diagram.md`\n\nPick the 5–10 most important classes\u002Ftypes. `read_file` them, then write:\n\n````markdown\n# Class Diagram\n\n## Core Types\n\n```mermaid\nclassDiagram\n    class Agent {\n        +string name\n        +list~Tool~ tools\n        +chat(message) string\n    }\n    class Tool {\n        \u003C\u003Cinterface>>\n        +name string\n        +execute(args) any\n    }\n    Agent --> Tool : uses\n    Tool \u003C|-- TerminalTool\n    Tool \u003C|-- WebTool\n```\n\n## Notes\n\n\u003CAnything the diagram can't express — lifecycle, threading, etc.>\n````\n\nFor languages without classes (Go, C, Rust): use the diagram for struct relationships, or skip class-diagram.md and explain it in prose in architecture.md. Don't force-fit.\n\n### 8. Write `diagrams\u002Fsequences.md`\n\nPick 2–4 of the most important workflows. Trace each call path through the code (read entry point, follow function calls), then:\n\n````markdown\n# Sequence Diagrams\n\n## Workflow: \u003CName>\n\n\u003C1 sentence describing what this does and when it runs.>\n\n```mermaid\nsequenceDiagram\n    participant User\n    participant CLI\n    participant Agent\n    participant LLM\n    User->>CLI: types message\n    CLI->>Agent: chat(message)\n    Agent->>LLM: API call\n    LLM-->>Agent: response + tool_calls\n    Agent->>Agent: execute tools\n    Agent-->>CLI: final response\n```\n\n### Walkthrough\n\n1. **User input** — [`cli.py:HermesCLI.run_session`](\u003Clink>)\n2. **Message dispatch** — [`run_agent.py:AIAgent.chat`](\u003Clink>)\n````\n\nDon't invent participants. Every box must correspond to a real component the reader can find in the code.\n\n### 9. Write `getting-started.md`\n\n````markdown\n# Getting Started\n\n## Prerequisites\n\n\u003CFrom manifest files + README. Be specific — versions if pinned.>\n\n## Installation\n\n```bash\n\u003Cexact commands>\n```\n\n## First Run\n\n```bash\n\u003Cminimum command to see the system do something useful>\n```\n\n## Common Workflows\n\n### \u003CWorkflow 1>\n\u003Ccommands>\n\n## Configuration\n\n- `\u003Cconfig-file>` — \u003Cwhat it controls>\n- Env var `\u003CVAR>` — \u003Cwhat it controls>\n\n## Where to Go Next\n\n- Architecture: [architecture.md](architecture.md)\n- Module reference: [README.md#module-map](README.md#module-map)\n````\n\n### 10. Write `api.md` (skip if not applicable)\n\nOnly write this if the project is a library or API server. If it is:\n\n- Find the public API surface (`__init__.py` exports, OpenAPI specs, route handlers, exported types)\n- Document each public entry with signature, parameters, return type, one-line description\n- Group by category\n\n### 11. Write the state file\n\n```bash\ncat > \"$OUTPUT_DIR\u002F.codewiki-state.json\" \u003C\u003CEOF\n{\n  \"repo_name\": \"$REPO_NAME\",\n  \"source_path\": \"$PWD\",\n  \"source_sha\": \"$REPO_SHA\",\n  \"generated_at\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\",\n  \"generator\": \"mercury code-wiki skill v0.1.0\",\n  \"modules_documented\": []\n}\nEOF\n```\n\n### 12. Report to user\n\nState exactly what was generated and where:\n\n```\nGenerated wiki at $HERMES_HOME\u002Fwikis\u002F\u003Crepo-name>\u002F:\n  README.md                   project overview, module map\n  architecture.md             system architecture + flowchart\n  getting-started.md          setup, first run, workflows\n  modules\u002F\u003CN files>           per-module deep-dives\n  diagrams\u002Farchitecture.md    Mermaid flowchart\n  diagrams\u002Fclass-diagram.md   Mermaid class diagram\n  diagrams\u002Fsequences.md       Mermaid sequence diagrams\n```\n\nIf you cloned to a temp dir, remind the user it can be removed (`rm -rf \"$WIKI_TMP\"`) after they've reviewed the wiki.\n\n## Scope Control\n\nGenerating a full wiki for a 500K-LOC monorepo is wildly token-expensive. Default to bounded scope:\n\n- Initial scan: max depth 3 directories\n- Per-module docs: cap at 10 modules unless user expands scope\n- Per-file reads: prefer `search_files` for symbols + `read_file` with `offset`\u002F`limit` over full reads\n- Skip vendored code (`vendor\u002F`, `third_party\u002F`, generated code, `_pb2.py`, `.min.js`)\n\nIf the user says \"do the whole thing exhaustively\", believe them — but ballpark the cost first: \"this repo has ~340 source files, comprehensive coverage will be expensive — confirm?\"\n\n## Re-Run \u002F Update\n\nIf `.codewiki-state.json` already exists at the target path:\n\n- Read it for previous SHA and module list\n- If source SHA matches: ask user if they want to regenerate or skip\n- If SHA differs: offer to regenerate only modules with changed files (`git diff --name-only \u003Cold-sha> HEAD`)\n\nFull incremental-regeneration is a future enhancement — for now, regenerating the whole thing is acceptable.\n\n## Pitfalls\n\n- **Fabricating components.** Every diagram node and claimed function call must be in the source. `read_file` before writing. The single biggest failure mode for auto-generated docs is plausible-sounding fabrication.\n- **Generic AI prose.** \"This module is responsible for...\" is content-free. Say what the module actually does in domain-specific terms.\n- **Restating code as prose.** A module doc that says \"the `process` function processes things by calling `process_item` on each item\" is worse than just linking to the function.\n- **Mermaid > 50 nodes.** They don't render legibly. Split them.\n- **Documenting tests, generated code, or vendored deps as if they were product code.** Skip them.\n- **In-repo output without asking.** Default is `$HERMES_HOME\u002Fwikis\u002F`. Only write into the repo when the user explicitly requests it.\n- **Mermaid special chars need quotes:** `A[\"Tool \u002F Agent\"]` not `A[Tool \u002F Agent]`. `\u003Cbr>` for line breaks inside a node.\n- **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 ` ```mermaid ` doesn't close the outer. (This SKILL.md does it.)\n- **classDiagram generics** render as `~T~` (e.g. `List~Tool~`), not `\u003CT>`.\n- **GitHub Mermaid theme is fixed** — don't include `%%{init: ...}%%` blocks; they're stripped on render.\n\n## Verification\n\nAfter writing, verify:\n\n1. **Mermaid blocks balance** — opens equal closes per file:\n   ```bash\n   for f in \"$OUTPUT_DIR\"\u002Fdiagrams\u002F*.md \"$OUTPUT_DIR\"\u002Farchitecture.md; do\n     opens=$(grep -c '^```mermaid' \"$f\")\n     total=$(grep -c '^```' \"$f\")\n     echo \"$f: $opens mermaid blocks, $total total fences (expect total = opens*2)\"\n   done\n   ```\n2. **All expected files exist** —\n   ```bash\n   ls \"$OUTPUT_DIR\"\u002F{README.md,architecture.md,getting-started.md,.codewiki-state.json} \\\n      \"$OUTPUT_DIR\"\u002Fmodules\u002F \"$OUTPUT_DIR\"\u002Fdiagrams\u002F\n   ```\n3. **Module count matches what you intended** — `ls \"$OUTPUT_DIR\u002Fmodules\" | wc -l` should equal the number of modules you committed to in Step 3.\n4. **No fabricated paths** — sanity-check 2–3 source links resolve to real files.\n",{"name":5,"author":23,"license":14,"version":24,"metadata":25,"platforms":37,"description":7},"Teknium (teknium1), Hermes Agent","0.1.0",{"mercury":26},{"tags":27,"related_skills":34},[28,29,30,31,32,33],"Documentation","Mermaid","Architecture","Diagrams","Wiki","Code-Analysis",[35,36],"codebase-inspection","github",[38,39,40],"linux","macos","windows","main","94a12cab2ce32e2020d179b5d579d0cbcbd0f206","hermes\u002Foptional-skills\u002Fsoftware-development\u002Fcode-wiki","https:\u002F\u002Fgithub.com\u002Ffengwhang\u002Fmercury","https:\u002F\u002Fgithub.com\u002Ffengwhang","2026-10-09 08:26:42",{"source":8,"skillName":5,"commands":48,"prompt":58,"zipAvailable":59},[49,52,55],{"tool":50,"command":51},"npx","npx skills add fengwhang\u002Fmercury --skill code-wiki",{"tool":53,"command":54},"bunx","bunx skills add fengwhang\u002Fmercury --skill code-wiki",{"tool":56,"command":57},"pnpm","pnpm dlx skills add fengwhang\u002Fmercury --skill code-wiki","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Ffengwhang\u002Fmercury\u002Fblob\u002Fmain\u002Fhermes\u002Foptional-skills\u002Fsoftware-development\u002Fcode-wiki\u002FSKILL.md",true,[61,67,71,75],{"path":62,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":65,"sourceHtmlUrl":66},"templates\u002Farchitecture.md","REFERENCE","参考文档",654,"https:\u002F\u002Fgithub.com\u002Ffengwhang\u002Fmercury\u002Fblob\u002Fmain\u002Fhermes\u002Foptional-skills\u002Fsoftware-development\u002Fcode-wiki\u002Ftemplates\u002Farchitecture.md",{"path":68,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":69,"sourceHtmlUrl":70},"templates\u002Fgetting-started.md",658,"https:\u002F\u002Fgithub.com\u002Ffengwhang\u002Fmercury\u002Fblob\u002Fmain\u002Fhermes\u002Foptional-skills\u002Fsoftware-development\u002Fcode-wiki\u002Ftemplates\u002Fgetting-started.md",{"path":72,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":73,"sourceHtmlUrl":74},"templates\u002Fmodule.md",634,"https:\u002F\u002Fgithub.com\u002Ffengwhang\u002Fmercury\u002Fblob\u002Fmain\u002Fhermes\u002Foptional-skills\u002Fsoftware-development\u002Fcode-wiki\u002Ftemplates\u002Fmodule.md",{"path":76,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":77,"sourceHtmlUrl":78},"templates\u002FREADME.md",667,"https:\u002F\u002Fgithub.com\u002Ffengwhang\u002Fmercury\u002Fblob\u002Fmain\u002Fhermes\u002Foptional-skills\u002Fsoftware-development\u002Fcode-wiki\u002Ftemplates\u002FREADME.md",[80,87,94,101,107,114],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":18},"01M7C4BTY3ND38CN200ZCTH6NV","greet","A greeting skill for testing","https:\u002F\u002Fgithub.com\u002Ffengwhang\u002Fmercury\u002Fblob\u002Fmain\u002Fomp\u002Fpackages\u002Fcoding-agent\u002Ftest\u002Fmarketplace\u002Ffixtures\u002Fvalid-marketplace\u002Fplugins\u002Fhello-plugin\u002Fskills\u002Fgreet\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":18},"01M7C4BSNZTPW8JR5NGCQXGSEZ","valid-skill","A valid skill for testing purposes.","https:\u002F\u002Fgithub.com\u002Ffengwhang\u002Fmercury\u002Fblob\u002Fmain\u002Fomp\u002Fpackages\u002Fcoding-agent\u002Ftest\u002Ffixtures\u002Fskills\u002Fvalid-skill\u002FSKILL.md",[],[],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":18},"01M7C4BRA7J8C06KSVW100F1W1","unknown-field","A skill with an unknown frontmatter field.","https:\u002F\u002Fgithub.com\u002Ffengwhang\u002Fmercury\u002Fblob\u002Fmain\u002Fomp\u002Fpackages\u002Fcoding-agent\u002Ftest\u002Ffixtures\u002Fskills\u002Funknown-field\u002FSKILL.md",[],[],{"skillNo":102,"name":103,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":18},"01M7C4BNB04KQGCJ835JE8AR13","no-frontmatter","https:\u002F\u002Fgithub.com\u002Ffengwhang\u002Fmercury\u002Fblob\u002Fmain\u002Fomp\u002Fpackages\u002Fcoding-agent\u002Ftest\u002Ffixtures\u002Fskills\u002Fno-frontmatter\u002FSKILL.md",[],[],{"skillNo":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":111,"categories":112,"keywords":113,"publishedAt":18},"01M7C4BM38TZFYT1AJ6SKHPZZ2","child-skill","A nested skill in a subdirectory.","https:\u002F\u002Fgithub.com\u002Ffengwhang\u002Fmercury\u002Fblob\u002Fmain\u002Fomp\u002Fpackages\u002Fcoding-agent\u002Ftest\u002Ffixtures\u002Fskills\u002Fnested\u002Fchild-skill\u002FSKILL.md",[],[],{"skillNo":115,"name":116,"nameZh":6,"description":117,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":118,"categories":119,"keywords":120,"publishedAt":18},"01M7C4BJDN7RFFCM28CGX15Q97","different-name","A skill with a name that doesn't match the directory.","https:\u002F\u002Fgithub.com\u002Ffengwhang\u002Fmercury\u002Fblob\u002Fmain\u002Fomp\u002Fpackages\u002Fcoding-agent\u002Ftest\u002Ffixtures\u002Fskills\u002Fname-mismatch\u002FSKILL.md",[],[]]