首页龙虾技能列表 › Json Canvas — 技能工具

Json Canvas — 技能工具

v1.0.0

Create and edit JSON Canvas files (.canvas) with nodes, edges, groups, and connections. Use when working with .canvas files, creating visual canvases, mind m...

0· 658·38 当前·38 累计
by @sadlay (Li Yaping)·MIT-0
下载技能包
License
MIT-0
最后更新
2026/3/5
安全扫描
VirusTotal
无害
查看报告
OpenClaw
安全
high confidence
The skill is an instruction-only helper for creating and editing .canvas JSON files and its requirements and instructions are consistent with that purpose.
评估建议
This is an instruction-only skill for editing .canvas JSON files and appears internally consistent. There is no install and it does not request credentials. When using it, be aware that 'file' node examples reference local file paths — if you provide or load a .canvas that points to sensitive files, the agent working on that canvas may read those paths as part of editing/validation. Review any .canvas content before allowing the agent to run and avoid including references to secrets or system fi...
详细分析 ▾
用途与能力
Name/description match the instructions: SKILL.md describes creating, editing, validating .canvas JSON, ID generation, node/edge formats and examples. Nothing requested (no env vars, no binaries, no installs) is unrelated to that purpose.
指令范围
Runtime instructions focus on reading/parsing/writing .canvas files and validating node/edge IDs and positions. Example file nodes reference local file paths (expected for canvas file format) but instructions do not tell the agent to exfiltrate data or access other unrelated system state.
安装机制
No install spec and no code files — lowest-risk model: the skill is purely documentation/instructions and does not pull code or write files during install.
凭证需求
The skill requires no environment variables, credentials, or config paths. The SKILL.md does reference local file paths only in the context of file-type nodes, which is proportional to editing canvas files.
持久化与权限
always is false and disable-model-invocation is false (normal). The skill does not request permanent/system-wide privileges or modify other skills' configs.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv1.0.02026/3/5

- Initial release of the json-canvas skill. - Enables creation and editing of JSON Canvas (.canvas) files with support for nodes, edges, groups, and connections. - Includes detailed workflows for creating canvases, adding nodes, connecting nodes, and editing structures. - Supports all node types: text, file, link, and group, following JSON Canvas Spec 1.0. - Provides comprehensive validation guidelines to ensure file integrity. - Offers layout suggestions, example structures, and references for further learning.

● 无害

安装命令 点击复制

官方npx clawhub@latest install json-canvas
镜像加速npx clawhub@latest install json-canvas --registry https://cn.clawhub-mirror.com

技能文档

File Structure

A canvas file (.canvas) contains two top-level arrays following the JSON Canvas Spec 1.0:

{
  "nodes": [],
  "edges": []
}
  • nodes (optional): Array of node objects
  • edges (optional): Array of edge objects connecting nodes

Common Workflows

1. Create a New Canvas

  • Create a .canvas file with the base structure {"nodes": [], "edges": []}
  • Generate unique 16-character hex IDs for each node (e.g., "6f0ad84f44ce9c17")
  • Add nodes with required fields: id, type, x, y, width, height
  • Add edges referencing valid node IDs via fromNode and toNode
  • Validate: Parse the JSON to confirm it is valid. Verify all fromNode/toNode values exist in the nodes array

2. Add a Node to an Existing Canvas

  • Read and parse the existing .canvas file
  • Generate a unique ID that does not collide with existing node or edge IDs
  • Choose position (x, y) that avoids overlapping existing nodes (leave 50-100px spacing)
  • Append the new node object to the nodes array
  • Optionally add edges connecting the new node to existing nodes
  • Validate: Confirm all IDs are unique and all edge references resolve to existing nodes

3. Connect Two Nodes

  • Identify the source and target node IDs
  • Generate a unique edge ID
  • Set fromNode and toNode to the source and target IDs
  • Optionally set fromSide/toSide (top, right, bottom, left) for anchor points
  • Optionally set label for descriptive text on the edge
  • Append the edge to the edges array
  • Validate: Confirm both fromNode and toNode reference existing node IDs

4. Edit an Existing Canvas

  • Read and parse the .canvas file as JSON
  • Locate the target node or edge by id
  • Modify the desired attributes (text, position, color, etc.)
  • Write the updated JSON back to the file
  • Validate: Re-check all ID uniqueness and edge reference integrity after editing

Nodes

Nodes are objects placed on the canvas. Array order determines z-index: first node = bottom layer, last node = top layer.

Generic Node Attributes

AttributeRequiredTypeDescription
idYesstringUnique 16-char hex identifier
typeYesstringtext, file, link, or group
xYesintegerX position in pixels
yYesintegerY position in pixels
widthYesintegerWidth in pixels
heightYesintegerHeight in pixels
colorNocanvasColorPreset "1"-"6" or hex (e.g., "#FF0000")

Text Nodes

AttributeRequiredTypeDescription
textYesstringPlain text with Markdown syntax
{
  "id": "6f0ad84f44ce9c17",
  "type": "text",
  "x": 0,
  "y": 0,
  "width": 400,
  "height": 200,
  "text": "# Hello World\n\nThis is Markdown content."
}

Newline pitfall: Use \n for line breaks in JSON strings. Do not use the literal \\n -- Obsidian renders that as the characters \ and n.

File Nodes

AttributeRequiredTypeDescription
fileYesstringPath to file within the system
subpathNostringLink to heading or block (starts with #)
{
  "id": "a1b2c3d4e5f67890",
  "type": "file",
  "x": 500,
  "y": 0,
  "width": 400,
  "height": 300,
  "file": "Attachments/diagram.png"
}

Link Nodes

AttributeRequiredTypeDescription
urlYesstringExternal URL
{
  "id": "c3d4e5f678901234",
  "type": "link",
  "x": 1000,
  "y": 0,
  "width": 400,
  "height": 200,
  "url": "https://obsidian.md"
}

Group Nodes

Groups are visual containers for organizing other nodes. Position child nodes inside the group's bounds.

AttributeRequiredTypeDescription
labelNostringText label for the group
backgroundNostringPath to background image
backgroundStyleNostringcover, ratio, or repeat
{
  "id": "d4e5f6789012345a",
  "type": "group",
  "x": -50,
  "y": -50,
  "width": 1000,
  "height": 600,
  "label": "Project Overview",
  "color": "4"
}

Edges

Edges connect nodes via fromNode and toNode IDs.

AttributeRequiredTypeDefaultDescription
idYesstring-Unique identifier
fromNodeYesstring-Source node ID
fromSideNostring-top, right, bottom, or left
fromEndNostringnonenone or arrow
toNodeYesstring-Target node ID
toSideNostring-top, right, bottom, or left
toEndNostringarrownone or arrow
colorNocanvasColor-Line color
labelNostring-Text label
{
  "id": "0123456789abcdef",
  "fromNode": "6f0ad84f44ce9c17",
  "fromSide": "right",
  "toNode": "a1b2c3d4e5f67890",
  "toSide": "left",
  "toEnd": "arrow",
  "label": "leads to"
}

Colors

The canvasColor type accepts either a hex string or a preset number:

PresetColor
"1"Red
"2"Orange
"3"Yellow
"4"Green
"5"Cyan
"6"Purple
Preset color values are intentionally undefined -- applications use their own brand colors.

ID Generation

Generate 16-character lowercase hexadecimal strings (64-bit random value):

"6f0ad84f44ce9c17"
"a3b2c1d0e9f8a7b6"

Layout Guidelines

  • Coordinates can be negative (canvas extends infinitely)
  • x increases right, y increases down; position is the top-left corner
  • Space nodes 50-100px apart; leave 20-50px padding inside groups
  • Align to grid (multiples of 10 or 20) for cleaner layouts
Node TypeSuggested WidthSuggested Height
Small text200-30080-150
Medium text300-450150-300
Large text400-600300-500
File preview300-500200-400
Link preview250-400100-200

Validation Checklist

After creating or editing a canvas file, verify:

  • All id values are unique across both nodes and edges
  • Every fromNode and toNode references an existing node ID
  • Required fields are present for each node type (text for text nodes, file for file nodes, url for link nodes)
  • type is one of: text, file, link, group
  • fromSide/toSide values are one of: top, right, bottom, left
  • fromEnd/toEnd values are one of: none, arrow
  • Color presets are "1" through "6" or valid hex (e.g., "#FF0000")
  • JSON is valid and parseable

If validation fails, check for duplicate IDs, dangling edge references, or malformed JSON strings (especially unescaped newlines in text content).

Complete Examples

See references/EXAMPLES.md for full canvas examples including mind maps, project boards, research canvases, and flowcharts.

References

数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务