caulsal-diagram

v1.0.0

因果图(Causal Diagram / DAG)绘制工具。支持生成图片和 Mermaid 代码两种输出格式。 **触发场景**: - 用户要求绘制因果图、DAG、有向无环图 - 用户提到变量之间的因果关系需要可视化 - 用户说"画一个因果图"、"生成DAG"、"变量关系图" - 分析混杂、对撞结构、后门路径等因...

0· 54·0 current·0 all-time
by一个有毅力的吃货@lyhue1991

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for lyhue1991/caulsal-diagram.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "caulsal-diagram" (lyhue1991/caulsal-diagram) from ClawHub.
Skill page: https://clawhub.ai/lyhue1991/caulsal-diagram
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install caulsal-diagram

ClawHub CLI

Package manager switcher

npx clawhub@latest install caulsal-diagram
Security Scan
Capability signals
Crypto
These labels describe what authority the skill may exercise. They are separate from suspicious or malicious moderation verdicts.
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name/description and most files match: this is a DAG/causal-diagram tool that can render PNG images and includes Mermaid examples. However, the description/SKILL.md suggests the skill 'supports generating Mermaid code' programmatically, but the provided script (scripts/generate_dag.py) only generates PNG images; there is no code that emits Mermaid text automatically. That is an inconsistency (likely a documentation mismatch) but not malicious.
Instruction Scope
SKILL.md instructs running the local Python script or using Mermaid snippets for documentation. The script operates locally, only reads the provided node/edge arguments and filesystem to save the output image. It does not read other system files, environment variables, or call external endpoints.
Install Mechanism
No install spec provided (instruction-only with one local script). The only runtime dependency is Pillow (PIL) and system fonts; nothing is downloaded or executed from remote URLs.
Credentials
The skill declares no required environment variables, credentials, or config paths. The code does not access secrets or environment variables; requested resources are proportional to the stated purpose.
Persistence & Privilege
The skill does not request persistent 'always' presence and is user-invocable. It writes an output image to whatever path the user supplies; this is expected but means users should ensure the output path is safe and not pointed at sensitive system files to avoid accidental overwrites.
Assessment
This skill appears to be a benign, local DAG drawing tool. Before installing/using: 1) Ensure Python3 and Pillow (PIL) are available (the script uses PIL). 2) Note the docs mention Mermaid output, but no script is provided to auto-generate Mermaid — the repo only includes Mermaid examples and a reference file. 3) When running the script, choose a safe output path (the script will write the PNG you specify and can overwrite files). 4) Fonts: the script tries several system font paths — if Chinese fonts are missing it falls back to a default font. 5) Because the skill runs locally and has no network calls or secret access, it has low risk; still run first in a non-privileged environment if you want to be cautious. If you need programmatic Mermaid output, ask the maintainer for that feature or generate Mermaid text separately using the provided reference.

Like a lobster shell, security has layers — review code before you run it.

latestvk970fcpwj0rptqqyh1xsntsbfx85hrdy
54downloads
0stars
1versions
Updated 2d ago
v1.0.0
MIT-0

因果图绘制工具

快速开始

方式一:生成图片(适合公众号/文档插图)

python3 ~/.agents/skills/causal-diagram/scripts/generate_dag.py \
  --output causal_diagram.png \
  --title "因果图标题" \
  --nodes "年龄,疼痛程度,止痛药使用,心脏病风险" \
  --edges "年龄->疼痛程度,疼痛程度->止痛药使用,止痛药使用->心脏病风险"

方式二:生成 Mermaid 代码(适合飞书文档)

# 直接在文档中使用 Mermaid 语法
```mermaid
flowchart TB
    A[年龄] --> B[疼痛程度]
    B --> C[止痛药使用]
    C --> D[心脏病风险]

## 参数说明

### generate_dag.py 脚本参数

| 参数 | 说明 | 示例 |
|------|------|------|
| `--output` | 输出文件路径 | `diagram.png` |
| `--title` | 图表标题 | `"案例1:止痛药与心脏病"` |
| `--nodes` | 节点列表(逗号分隔) | `"A,B,C,D"` |
| `--edges` | 边列表(逗号分隔,用 -> 表示方向) | `"A->B,B->C"` |
| `--layout` | 布局方式:`tb`(上下)、`lr`(左右) | `tb`(默认) |

## 常见因果图结构

### 1. 链式结构(Chain)

A → B → C:A 通过 B 影响 C

```mermaid
flowchart LR
    A --> B --> C

2. 分叉结构(Fork)

A ← B → C:B 同时影响 A 和 C

flowchart TB
    B --> A
    B --> C

3. 对撞结构(Collider)

A → B ← C:A 和 C 共同影响 B

flowchart TB
    A --> B
    C --> B

4. 混杂结构(Confounder)

存在共同原因影响暴露和结果

flowchart TB
    C[混杂因素] --> E[暴露]
    C --> O[结果]
    E --> O

输出格式选择指南

场景推荐格式原因
飞书云文档Mermaid可编辑、可复制、自动渲染
微信公众号PNG 图片清晰美观、加载快
学术论文PNG/SVG高质量、可插入 Word
在线演示Mermaid动态、可交互

示例工作流

示例1:分析止痛药与心脏病的关系

# 生成图片
python3 ~/.agents/skills/causal-diagram/scripts/generate_dag.py \
  --output painkiller_dag.png \
  --title "止痛药与心脏病风险" \
  --nodes "年龄,疼痛程度,生活方式,止痛药使用,基础疾病,心脏病风险" \
  --edges "年龄->疼痛程度,疼痛程度->生活方式,疼痛程度->止痛药使用,生活方式->基础疾病,止痛药使用->心脏病风险,基础疾病->心脏病风险"

Mermaid 版本:

flowchart TB
    A[年龄] --> B[疼痛程度]
    B --> C[生活方式]
    B --> D[止痛药使用]
    C --> E[基础疾病]
    D --> F[心脏病风险]
    E --> F

示例2:班级规模与学生成绩

flowchart TB
    A[学校资金] --> B[班级规模]
    C[学生需求] --> B
    A --> D[教师质量]
    B --> E[学生成绩]
    D --> E

注意事项

  1. 节点命名:使用简短、清晰的名称,避免特殊字符
  2. 边的方向:用 -> 表示因果方向,箭头从原因指向结果
  3. 布局选择
    • tb(上下):适合有明确因果层级的情况
    • lr(左右):适合流程类因果图
  4. 复杂图:节点超过 8 个时,建议拆分为多个子图

Comments

Loading comments...