← 返回 Skills 市场
athola

Nm Cartograph Class Diagram

作者 athola · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
84
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install nm-cartograph-class-diagram
功能描述
Generate class diagrams showing classes, interfaces, inheritance, and composition
使用说明 (SKILL.md)

Night Market Skill — ported from claude-night-market/cartograph. For the full experience with agents, hooks, and commands, install the Claude Code plugin.

Class Diagram

Generate a Mermaid class diagram showing types, their relationships, and public interfaces from a codebase.

When To Use

  • Understanding class hierarchies and inheritance
  • Documenting public APIs of a module
  • Analyzing composition vs. inheritance patterns
  • Answering "what types exist and how do they relate?"

Workflow

Step 1: Explore the Codebase

Dispatch the codebase explorer agent:

Agent(cartograph:codebase-explorer)
Prompt: Explore [scope] and return a structural model.
Focus on classes, dataclasses, protocols, type aliases,
inheritance, and composition for a class diagram.
Extract: class names, methods (public only), attributes,
parent classes, and composed types.

Step 2: Generate Mermaid Syntax

Transform the structural model into a Mermaid class diagram.

Rules for class diagrams:

  • Use classDiagram diagram type
  • Show only public methods and key attributes
  • Use Mermaid relationship notation:
    • \x3C|-- for inheritance
    • *-- for composition
    • o-- for aggregation
    • ..> for dependency/usage
  • Add stereotypes for special types:
    • \x3C\x3Cprotocol>> for Python protocols/interfaces
    • \x3C\x3Cdataclass>> for dataclasses
    • \x3C\x3Cenum>> for enums
    • \x3C\x3Cabstract>> for abstract classes
  • Limit to 12-15 classes maximum
  • Group related classes with namespace
  • Omit private methods and dunder methods
  • Show return types for methods

Example output:

classDiagram
    class ResumeSession {
        +Path config_path
        +dict data
        +load() ResumeSession
        +to_pdf(Path) Path
        +to_html(Path) Path
    }

    class ResumeError {
        \x3C\x3Cabstract>>
        +str message
        +str context
    }

    class ValidationError {
        +list~str~ fields
    }

    class RenderError {
        +str template
    }

    ResumeError \x3C|-- ValidationError
    ResumeError \x3C|-- RenderError
    ResumeSession ..> ResumeError

Step 3: Render via MCP

Call the Mermaid Chart MCP to render:

mcp__claude_ai_Mermaid_Chart__validate_and_render_mermaid_diagram
  prompt: "Class diagram of [scope]"
  mermaidCode: [generated syntax]
  diagramType: "classDiagram"
  clientName: "claude-code"

If rendering fails, fix syntax and retry (max 2 retries).

Step 4: Present Results

Show the rendered diagram with analysis notes:

  • Total classes and relationship count
  • Key inheritance hierarchies identified
  • Composition patterns noted
安全使用建议
This skill appears coherent and does what it says: it will examine your codebase (via a codebase-explorer agent) to extract types/relationships and then send generated Mermaid code to the platform's Mermaid Chart renderer. Before installing or running it on private repositories, confirm you are comfortable granting the agent read access to the repository and that sending diagram content to the platform renderer is acceptable for your data sensitivity. Avoid embedding secrets or sensitive tokens in code snippets you expect the tool to analyze; if you need stricter privacy, run an offline or self-hosted diagramming workflow instead.
功能分析
Type: OpenClaw Skill Name: nm-cartograph-class-diagram Version: 1.0.0 The skill is a standard utility for generating Mermaid class diagrams from a codebase. It defines a clear workflow involving a codebase exploration step and rendering via a dedicated Mermaid Chart MCP tool. No indicators of data exfiltration, malicious execution, or harmful prompt injection were found in SKILL.md or _meta.json.
能力评估
Purpose & Capability
Name/description (generate class diagrams) matches the instructions: explore a codebase, extract types/relationships, generate Mermaid, and render. No unrelated binaries, env vars, or installs are requested.
Instruction Scope
Instructions explicitly dispatch a 'codebase-explorer' agent to read the codebase and then call a Mermaid Chart MCP to render the diagram. Reading repository files and sending generated mermaid code to a rendering service are expected for this purpose, but they do mean the skill will access source files and transmit diagram data to the platform renderer.
Install Mechanism
Instruction-only skill with no install steps or downloaded code. Lowest-risk install posture.
Credentials
No environment variables, credentials, or config paths are requested; the declared requirements are proportional to the stated functionality.
Persistence & Privilege
No 'always: true' or other elevated persistence requested. The skill is user-invocable and does not request system-wide changes.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install nm-cartograph-class-diagram
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /nm-cartograph-class-diagram 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of the class-diagram skill: - Generates Mermaid class diagrams from codebase structure. - Highlights classes, interfaces (protocols), inheritance, and composition. - Follows clear rules for public methods, key attributes, and relationships. - Integrates with codebase explorer and a diagram rendering step. - Limits diagrams to 12–15 classes for clarity. - Adds stereotypes for protocols, dataclasses, enums, and abstract classes.
元数据
Slug nm-cartograph-class-diagram
版本 1.0.0
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 1
常见问题

Nm Cartograph Class Diagram 是什么?

Generate class diagrams showing classes, interfaces, inheritance, and composition. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 84 次。

如何安装 Nm Cartograph Class Diagram?

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

Nm Cartograph Class Diagram 是免费的吗?

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

Nm Cartograph Class Diagram 支持哪些平台?

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

谁开发了 Nm Cartograph Class Diagram?

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

💬 留言讨论