← 返回 Skills 市场
wangjipeng977

Code To Mindmap

作者 王继鹏 · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ✓ 安全检测通过
152
总下载
1
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install code-to-mindmap
功能描述
Use when (1) user pastes source code and wants to visualize it as a mind map, node graph, or tree diagram. (2) user says "show this as a mindmap", "draw the...
使用说明 (SKILL.md)

Code to Mindmap

Use when (1) user pastes source code and wants to visualize it as a mind map, node graph, or tree diagram. (2) user says "show this as a mindmap", "draw the architecture", "make a flowchart of this code", or "visualize the structure". (3) user wants to understand an unfamiliar codebase by seeing its structure visually.

Core Position

This skill solves the specific problem of: code structure is hard to grasp from raw text — a visual map reveals relationships, hierarchy, and architecture at a glance.

This skill IS NOT:

  • A code documentation tool — it produces visual diagrams, not written docs
  • A UML class diagram tool — use PlantUML for detailed class relationships
  • A code formatter — it does not change source code

This skill IS activated ONLY when: source code + visualization intent are both present.

Modes

/code-to-mindmap

Default mode. Parses source code and outputs a Mermaid-compatible mindmap or graph.

When to use: User provides code and wants a visual structure diagram.

/code-to-mindmap/hierarchy

Outputs a tree showing file/folder hierarchy without analyzing imports.

When to use: User wants to see project structure, not code relationships.

Execution Steps

Step 1 — Parse the Code Structure

  1. Receive source code (single file, snippet, or multi-file content)
  2. Detect language and framework:
    • Python: parse def, class, import, async def
    • JavaScript/TypeScript: parse function, const, class, import, export
    • Go: parse func, type, struct, package
    • General: detect class definitions, function definitions, module-level declarations
  3. Identify:
    • Entry points (main, app, index)
    • Class/struct names and their methods
    • Top-level functions
    • Cross-file dependencies (import/require statements)
  4. Build a hierarchical tree: modules → classes → methods → nested logic

Step 2 — Select Diagram Type

Code Shape Diagram Type
Single file, class-heavy Mindmap (center = class, branches = methods)
Multi-file, import dependencies Graph (nodes = files, edges = imports)
Hierarchical directory Tree / flowchart
State machine or flow State diagram
Call graph (who calls whom) Flowchart / directed graph

Step 3 — Generate Diagram

Output as Mermaid mindmap or graph LR format:

mindmap
  root((Code))
    ClassName
      method_one
      method_two
        nested_helper
    another_class
      handler

For large codebases (>20 nodes), summarize: show top-level structure only, note that deeper nodes exist.

Step 4 — Validate

  • All detected classes/functions appear as nodes
  • Root/entry point is clearly marked as the center
  • No fabricated nodes (only from actual code)
  • Mermaid syntax is valid and renderable

Mandatory Rules

Do not

  • Do not make up method names, class names, or relationships not in the code
  • Do not render >30 nodes in a single diagram (split into sub-diagrams)
  • Do not replace source code comments with diagram comments
  • Do not activate for pseudo-code or algorithm descriptions without actual code

Do

  • Use the language's actual syntax to detect structure
  • Label nodes with function signatures for disambiguation (e.g., calculate_sum(nums: list) -> int)
  • Mark external library calls differently from project-internal calls
  • Preserve the root entry point as the diagram center

Quality Bar

A good output:

  • Every class and function in the provided code appears as a labeled node
  • Relationships (calls, imports, inheritance) are represented as edges
  • The diagram is valid Mermaid and renders correctly
  • Entry points are visually distinct (center or top)

A bad output:

  • Adds classes or methods not in the source code
  • Renders >30 nodes making the diagram unreadable
  • Misrepresents call direction (A calls B shown as B calls A)
  • Output is not valid Mermaid syntax

Good vs. Bad Examples

Scenario Bad Output Good Output
Single Python class All methods listed flat with no hierarchy Center = class name, methods as child nodes
Multi-file project One giant diagram with 50 nodes Multiple sub-diagrams per module
Imported standard library Treated as internal dependencies Marked differently (dashed border)
Anonymous/lambda functions Omitted Listed as "anonymous / lambda"

References

  • references/ — Mermaid mindmap syntax guide, language-specific parsing patterns, code architecture patterns
  • scripts/render.py — Render Mermaid diagram to PNG/SVG
安全使用建议
Treat this review as incomplete: the artifacts should be re-scanned once metadata.json and the artifact directory are readable.
能力评估
Purpose & Capability
The requested metadata.json and artifact directory could not be read due a sandbox command failure, so purpose and capability coherence could not be verified from artifacts.
Instruction Scope
No SKILL.md or artifact instructions were available for review, so no evidence-backed scope concern can be reported.
Install Mechanism
Install metadata or package contents were not accessible, so no artifact-backed install mechanism concern can be reported.
Credentials
Environment access requirements could not be compared against the skill purpose because artifacts were inaccessible.
Persistence & Privilege
No artifact evidence of persistence, privilege use, credentials, or sensitive data handling was available to assess.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install code-to-mindmap
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /code-to-mindmap 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
Update README with real Features and 功能特性 content
v1.0.0
Initial release
元数据
Slug code-to-mindmap
版本 1.0.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

Code To Mindmap 是什么?

Use when (1) user pastes source code and wants to visualize it as a mind map, node graph, or tree diagram. (2) user says "show this as a mindmap", "draw the... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 152 次。

如何安装 Code To Mindmap?

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

Code To Mindmap 是免费的吗?

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

Code To Mindmap 支持哪些平台?

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

谁开发了 Code To Mindmap?

由 王继鹏(@wangjipeng977)开发并维护,当前版本 v1.0.1。

💬 留言讨论