← 返回 Skills 市场
wangjipeng977

diagram-to-code

作者 王继鹏 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
36
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install wangjipeng-diagram-to-code
功能描述
Use when (1) user provides architecture diagram and needs infrastructure as code or component code.
使用说明 (SKILL.md)

Diagram To Code

Use when (1) user provides architecture diagram and needs infrastructure as code or component code.

Core Position

This skill solves the specific engineering problem of: user provides architecture diagram and needs infrastructure as code or component code

This skill is NOT:

  • A general-purpose capability that activates on anything
  • A replacement for manual human judgment
  • A tool that stores state or remembers across sessions

This skill IS activated ONLY when the trigger conditions are explicitly met.

Modes

/diagram-to-code

Default mode. Performs the core task end-to-end.

When to use: User provides input matching the trigger conditions above.

Execution Steps

  1. Receive diagram — User pastes an architecture diagram, flowchart, or infrastructure plan

    • Accepted formats: Mermaid, PlantUML, draw.io XML, ASCII art, or a text description
    • If the input is not recognizable as a diagram, state: "This skill converts architecture diagrams to infrastructure as code or component code. Please provide a diagram in Mermaid, PlantUML, or draw.io format."
  2. Parse diagram structure — Identify the diagram elements:

    • Detect nodes (services, components, databases, queues)
    • Identify relationships (arrows, dependencies, data flows)
    • Note labels, annotations, and any numeric values (latency, throughput)
    • Determine the diagram type (architecture, flowchart, sequence, ER)
  3. Map to target code form — Identify the appropriate output:

    • Infrastructure diagrams → Terraform (.tf), Kubernetes YAML, or CloudFormation
    • Flowcharts → state machine code, workflow scripts, or sequence diagrams
    • Component diagrams → code structure (React components, Python classes)
    • Network diagrams → config files or deployment manifests
  4. Generate code — Produce the target format with the diagram's structure:

    • Use correct syntax for the target platform (HCL for Terraform, YAML for K8s)
    • Name resources based on node labels in the diagram
    • Add comments linking each code block back to the diagram element
    • Include realistic defaults for unstated properties
  5. Deliver with validation — Return the code with a diagram-to-code mapping:

    • List each diagram node and the corresponding code resource
    • Note any assumptions made for unlabeled properties
    • If multiple output formats are possible, state which was chosen and why
    • Offer to refine specific components or add missing connections

Mandatory Rules

Do not

  • Do not make up facts or claim actions were taken that were not
  • Do not hardcode API keys — use os.getenv("API_KEY") instead
  • Do not store sensitive user data beyond the current session
  • Do not exceed token budget without warning the user first
  • Do not activate for off-topic requests — return a brief decline message

Do

  • Validate all inputs before acting
  • Handle errors gracefully with actionable error messages
  • Log actions taken for auditability
  • State explicitly when you are uncertain or data is insufficient

Quality Bar

A good output:

  • Solves exactly the problem described in the trigger conditions
  • Provides actionable result in the expected format within 3 turns
  • Handles error cases with specific guidance, not generic "try again"
  • States assumptions explicitly when input is ambiguous

A bad output:

  • Solves a different problem than the one triggered
  • Provides a generic "I can't help with that" without explaining why
  • Crashes, hangs, or returns malformed output on valid input
  • Activates for off-topic requests (false positive)

Good vs. Bad Examples

Scenario Bad Output Good Output
Trigger matched "I can help with that." + no action Correct transformation delivered in structured format
Invalid input Crash or wrong result "Missing required field: [X]. Please provide [Y]."
Ambiguous input Guesses and might be wrong States assumption and asks for confirmation
Off-topic request Attempts to help anyway "This skill activates when [trigger]. Please restate your request."

References

  • references/ — Detailed templates, schemas, and edge-case rules for this skill
安全使用建议
This version can remain in the normal install path based on the available evidence. As with any skill, users should still review its displayed instructions and only provide credentials or file access that clearly match the task they asked it to perform.
能力标签
requires-sensitive-credentials
能力评估
Purpose & Capability
No artifact-backed mismatch or high-impact capability was surfaced in the supplied SkillSpector, VirusTotal, or worker context.
Instruction Scope
SkillSpector reported no prompt-injection, scope-expansion, or unsafe instruction findings for this version.
Install Mechanism
No suspicious install behavior was identified in the supplied telemetry or accessible scan context.
Credentials
No undeclared credential, session, profile, broad local data, or external data-flow concern was reported.
Persistence & Privilege
No persistence, privilege escalation, background worker, or automatic mutation behavior was identified.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install wangjipeng-diagram-to-code
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /wangjipeng-diagram-to-code 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of "diagram-to-code" skill. - Converts architecture diagrams (Mermaid, PlantUML, draw.io, ASCII, or text-based) into infrastructure as code or component code. - Includes strict activation triggers; only processes requests with clear diagrams. - Returns code in appropriate formats (Terraform, Kubernetes YAML, CloudFormation, workflow scripts, component code) mapped from diagram elements. - Handles validation, clear error messages, and states assumptions when input is ambiguous. - Provides a mapping of diagram nodes to code resources in responses. - Declines off-topic or invalid requests with concise explanations.
元数据
Slug wangjipeng-diagram-to-code
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

diagram-to-code 是什么?

Use when (1) user provides architecture diagram and needs infrastructure as code or component code. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 36 次。

如何安装 diagram-to-code?

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

diagram-to-code 是免费的吗?

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

diagram-to-code 支持哪些平台?

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

谁开发了 diagram-to-code?

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

💬 留言讨论