← 返回 Skills 市场
samzong

CodeWiki Generator

作者 samzong · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
245
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install codewiki-generator
功能描述
Generate a deep, code-first project wiki and VitePress documentation site (DeepWiki-style) for a repository. Use when asked to create a complete wiki/manual...
使用说明 (SKILL.md)

Codewiki Generator

Overview

Generate a DeepWiki-style, code-first documentation site for a given repository. The output will reside in the codewiki/ directory, including a VitePress configuration and an auto-generated sidebar. The documentation must reflect the project's current state and prioritize explaining the system's design rationale over merely describing its functionality.

Workflow

0) Confirm Language Preference

Ask the user: "What language should the documentation be written in? (e.g., English, 中文, 日本語, etc.)" IF the user specifies a language THEN store the provided language and apply it to all generated prose content. ELSE IF the user does not specify a language THEN default to English.

1) Inspect the Codebase First (Code > Docs)

  • Scan source files, configuration files, build/test pipelines, entry points, and architectural directories.
  • Treat existing documentation (e.g., README, docs/) as secondary hints.
  • Prioritize code evidence as the ultimate source of truth.
  • Identify and report any discrepancies between documentation and code.

2) Analyze Codebase → Structured Metadata

Execute the analyzer script to scan the codebase and generate structured metadata. \x3Cskill-root> refers to the directory containing this SKILL.md.

python3 \x3Cskill-root>/scripts/codewiki_analyze.py \
  --repo-root \x3Crepo-root> \
  --out-dir codewiki \
  --force

This command generates the following outputs:

  • codewiki/.meta/ directory containing deps.json, entrypoints.json, evidence.json, doc_plan.json, and symbols.json (if ctags is available).
  • codewiki/quality-report.md detailing coverage and pages with low confidence.
  • VitePress configuration scaffolding, without placeholder .md files.

Note: This step does not generate placeholder .md files. The LLM is responsible for writing documentation content directly in Step 4. Note: Images referenced in existing Markdown files are copied into codewiki/assets/.

3) Dynamically Determine the Documentation Set

  • Include all minimally required pages.
  • Add conditional modules only when corresponding code evidence exists.
  • Split or merge pages based on project size and complexity.
  • Adhere to the guidelines specified in references/structure-and-heuristics.md.
  • Use lowercase directory and file names for all generated documentation.

4) Write the Documentation (Code-first, Visual-first)

Read codewiki/.meta/doc_plan.json and process each planned page:

  • IF a page has no supporting evidence OR low relevance to the codebase THEN skip that page.
  • ELSE create an .md file only for pages containing actual content.

Writing guidelines:

  • Use the language determined in Step 0 for all prose content.
  • Retain original formatting for code snippets, file paths, and technical terms.
  • Start every page with a low-contrast # Related Code block (fenced text block), not a heading.
  • Utilize Mermaid for diagrams (context, class, sequence, component, dataflow).
  • Adhere to Mermaid-safe syntax: use simple node IDs, avoid /, (), and : in labels, and prefer node[plain label].
  • Explain the rationale behind design choices, trade-offs, and constraints.
  • Provide informed opinions: highlight strengths, technical debt, or "code smells."
  • Link concepts to specific file paths, classes, or entry points.
  • Reuse existing images/diagrams IF they are accurate.
  • Maintain Markdown lint-friendly practices: consistent headings, no trailing spaces, and proper list formatting.

Refer to references/doc-templates.md for detailed, evidence-linked page templates.

5) Refresh Sidebar and Run the Site

After documentation generation, update the sidebar to reflect the actual files:

python3 \x3Cskill-root>/scripts/codewiki_bootstrap.py \
  --repo-root \x3Crepo-root> \
  --out-dir codewiki \
  --refresh-sidebar

Install documentation dependencies (Mermaid support is enabled by default):

npm --prefix codewiki install

Launch the documentation site:

npm --prefix codewiki run docs:dev

Alternative launch command (without prior npm install):

npx -p vitepress -p vitepress-plugin-mermaid -p mermaid vitepress dev codewiki

6) Offer Optional Workflows

After the site is operational, inform the user about available options:

"Documentation site is ready! You can now:

  • Option A: Deploy to Cloudflare Pages — publish the site to a live URL
  • Option B: Add multi-language support (i18n) — translate docs to another language

Let me know if you'd like to proceed with any of these."

Optional Workflows

These workflows are available for execution after the core documentation generation process is complete.

Option A) Deploy to Cloudflare Pages

Deploy the documentation site to Cloudflare Pages using the wrangler CLI.

Trigger: The user requests to deploy, publish, or host the documentation.

See: references/deploy-cloudflare.md for comprehensive instructions (including wrangler installation, login verification, build process, deployment, and updating index.md with the live URL).

Option B) Add Multi-language Support (i18n)

Translate existing documentation into a second language and configure the VitePress language switcher.

Trigger: The user requests translation, multi-language, or internationalization (i18n) support.

See: references/i18n-setup.md for comprehensive instructions (including directory structure, VitePress locales configuration, and translation guidelines).

Quality Bar (Non-negotiable)

  • Visual First: Prioritize diagrams over extensive text blocks.
  • Insightful: Explain design intent beyond mere mechanics.
  • Opinionated: Highlight architectural strengths and identified risks.
  • Linked: Reference concrete files/classes for all key concepts.
  • Code-first: The codebase is the authoritative source; documentation serves as a complementary explanation.

Resources

scripts/

  • codewiki_analyze.py: Scans the codebase and generates .meta/*.json metadata files.
  • codewiki_bootstrap.py: Scaffolds the codewiki/ directory, copies referenced images, and generates the sidebar.

references/

  • structure-and-heuristics.md: Contains rules for module selection and signal identification.
  • doc-templates.md: Provides comprehensive, evidence-linked templates for all page types.
  • deploy-cloudflare.md: Details the workflow for deploying to Cloudflare Pages.
  • i18n-setup.md: Outlines the configuration process for multi-language support.

assets/

  • vitepress/: Contains minimal VitePress configuration and a landing page template.
安全使用建议
Before running this skill: - Know that it expects python3 and npm/npx (and optionally ctags, go/cargo/swift if you want richer metadata); the package metadata did not declare these binaries — ensure they are available. - Inspect scripts/scripts/codewiki_analyze.py and scripts/codewiki_bootstrap.py yourself (they are bundled) to confirm their behavior; they only read the repo and write the codewiki/ output, but you should verify no surprising commands are executed in your environment. - Be aware npm install and npx will fetch code from the npm registry to build/serve the site; run those steps in a trusted or isolated environment if you are concerned about supply-chain risk. - Deploying to Cloudflare Pages (optional) requires installing wrangler and authenticating with Cloudflare — do not provide credentials unless you intend to publish. - Avoid running this on repositories containing sensitive secrets unless you are comfortable the generated outputs (codewiki/assets/* and codewiki/.meta/*) will be stored where you expect; consider running in a sandboxed container or VM for initial runs.
功能分析
Type: OpenClaw Skill Name: codewiki-generator Version: 1.0.0 The codewiki-generator skill is a legitimate tool designed to analyze a codebase and generate a structured VitePress documentation site. It uses Python scripts (codewiki_analyze.py and codewiki_bootstrap.py) to extract project metadata such as dependencies, entrypoints, and symbols (via ctags) and scaffolds a documentation directory with Mermaid diagrams and evidence-linked templates. While the skill includes high-privilege capabilities such as executing build tools (go, cargo, npm) and instructions for deploying to Cloudflare Pages via the wrangler CLI, these actions are clearly aligned with the stated purpose and are triggered by user requests. The code follows security best practices, such as using safe subprocess execution and path resolution to prevent injection or traversal vulnerabilities.
能力评估
Purpose & Capability
The skill's stated purpose (generate a code-first VitePress site) matches the included scripts and instructions: the analyzer scans repo files and the bootstrap produces VitePress scaffolding. However the registry metadata lists no required binaries while the runtime instructions and included scripts clearly expect python3 and npm/npx (and optionally tools like ctags, go/cargo/swift) — that metadata omission is an inconsistency but not malicious.
Instruction Scope
SKILL.md explicitly instructs scanning the repository, copying referenced images, generating metadata under codewiki/.meta, creating Markdown pages, and running VitePress. All file reads/writes are limited to the target repo and the generated codewiki output and are coherent with the documented purpose.
Install Mechanism
There is no install spec (lower risk), but the workflow requires running local commands that will fetch packages: `npm --prefix codewiki install` and the alternative `npx -p ...` command will download packages from npm at runtime. Fetching remote packages is expected for building the site but is a moderate risk vector (supply-chain).
Credentials
The skill declares no environment variables or credentials, which aligns with the core doc-generation use. Optional workflows (Cloudflare Pages deployment) will require `wrangler` and Cloudflare credentials, but those are only invoked when the user explicitly requests deployment. No unexpected credential reading is present in the scripts.
Persistence & Privilege
The skill is not always-enabled and does not request elevated platform privileges. It writes files only under the specified out-dir (codewiki) and copies referenced assets; it does not modify other skills or system-wide agent configs.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install codewiki-generator
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /codewiki-generator 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
codewiki-generator 1.0.0 – Initial Release - Generate a code-first, DeepWiki-style VitePress documentation site for any repository. - Scans source code as the primary truth, auto-generating structured Markdown, diagrams (with Mermaid), and navigation based on code evidence. - Produces a detailed metadata set (`.meta/`) and a customizable documentation plan, skipping non-relevant pages. - Provides optional workflows for Cloudflare Pages deployment and multi-language (i18n) support. - Enforces quality: visual-first, insightful, opinionated, and strongly linked to code structure.
元数据
Slug codewiki-generator
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

CodeWiki Generator 是什么?

Generate a deep, code-first project wiki and VitePress documentation site (DeepWiki-style) for a repository. Use when asked to create a complete wiki/manual... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 245 次。

如何安装 CodeWiki Generator?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install codewiki-generator」即可一键安装,无需额外配置。

CodeWiki Generator 是免费的吗?

是的,CodeWiki Generator 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

CodeWiki Generator 支持哪些平台?

CodeWiki Generator 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 CodeWiki Generator?

由 samzong(@samzong)开发并维护,当前版本 v1.0.0。

💬 留言讨论