← 返回 Skills 市场
45
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install caulsal-diagram
功能描述
因果图(Causal Diagram / DAG)绘制工具。支持生成图片和 Mermaid 代码两种输出格式。 **触发场景**: - 用户要求绘制因果图、DAG、有向无环图 - 用户提到变量之间的因果关系需要可视化 - 用户说"画一个因果图"、"生成DAG"、"变量关系图" - 分析混杂、对撞结构、后门路径等因...
使用说明 (SKILL.md)
因果图绘制工具
快速开始
方式一:生成图片(适合公众号/文档插图)
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
注意事项
- 节点命名:使用简短、清晰的名称,避免特殊字符
- 边的方向:用
->表示因果方向,箭头从原因指向结果 - 布局选择:
tb(上下):适合有明确因果层级的情况lr(左右):适合流程类因果图
- 复杂图:节点超过 8 个时,建议拆分为多个子图
安全使用建议
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.
功能分析
Type: OpenClaw Skill
Name: caulsal-diagram
Version: 1.0.0
The skill bundle is a legitimate tool for generating causal diagrams (DAGs) in PNG or Mermaid format. The Python script `scripts/generate_dag.py` uses the Pillow library for image creation and contains no high-risk behaviors such as network requests, shell execution, or unauthorized file access. The documentation in `SKILL.md` and `references/mermaid-syntax.md` is strictly instructional and aligns with the stated purpose of the tool.
能力标签
能力评估
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.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install caulsal-diagram - 安装完成后,直接呼叫该 Skill 的名称或使用
/caulsal-diagram触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
因果图(Causal Diagram / DAG)绘制工具首发:
- 支持生成因果图为图片(PNG)或 Mermaid 代码两种格式
- 提供命令行脚本快速生成因果图图片
- 针对不同应用场景给出输出格式选择建议
- 附详细示例、常见结构模板及参数说明
- 适用于变量间因果关系可视化、DAG、因果推断等场景
元数据
常见问题
caulsal-diagram 是什么?
因果图(Causal Diagram / DAG)绘制工具。支持生成图片和 Mermaid 代码两种输出格式。 **触发场景**: - 用户要求绘制因果图、DAG、有向无环图 - 用户提到变量之间的因果关系需要可视化 - 用户说"画一个因果图"、"生成DAG"、"变量关系图" - 分析混杂、对撞结构、后门路径等因... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 45 次。
如何安装 caulsal-diagram?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install caulsal-diagram」即可一键安装,无需额外配置。
caulsal-diagram 是免费的吗?
是的,caulsal-diagram 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
caulsal-diagram 支持哪些平台?
caulsal-diagram 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 caulsal-diagram?
由 一个有毅力的吃货(@lyhue1991)开发并维护,当前版本 v1.0.0。
推荐 Skills