Full-stack-skills pencil
用于通过 Pencil MCP 读取/修改 .pen 设计文件并校验布局。用户提到 pencil/.pen/设计稿编辑、需要列出工具或执行 batch_get/batch_design 时调用。
install
source · Clone the upstream repo
git clone https://github.com/partme-ai/full-stack-skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/partme-ai/full-stack-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/pencil-skills/pencil" ~/.claude/skills/partme-ai-full-stack-skills-pencil && rm -rf "$T"
manifest:
skills/pencil-skills/pencil/SKILL.mdsource content
Pencil(MCP:pencil)
本 Skill 负责与 Pencil MCP Server 交互,读取/编辑加密的
.pen 设计文件,并提供可复制的调用模板与最佳实践。
关键边界与安全规则
文件内容是加密的:禁止用普通文件读取/搜索方式解析.pen
内容;只能通过 pencil MCP tools 访问与修改。.pen- 优先“先读后写”:写入前先用
/get_editor_state
了解当前文档结构与选区。batch_get
单次最多 25 条操作;超过时按“结构→内容→样式→验收”拆分多次执行。batch_design- 任何会造成大范围变更的能力(
、大批量replace_all_matching_properties
)都必须先输出变更计划,再执行。batch_design
MCP Server 配置(参考)
{ "pencil": { "name": "pencil", "transport": "stdio", "command": "/Users/wandl/.trae/extensions/highagency.pencildev-0.6.15-universal/out/mcp-server-darwin-arm64", "args": ["--ws-port", "61405"], "env": {} } }
使用流程(推荐)
:确认当前是否已打开get_editor_state(include_schema=false)
、当前选区。.pen- 如无文档:
打开或新建。open_document(filePathOrTemplate) - 读结构:
获取目标节点树、组件、变量等。batch_get(...) - 设计/修改:
(≤25 ops/次)。batch_design(filePath, operations) - 验收:
检查布局问题;必要时snapshot_layout(...)
截图复核。get_screenshot(...)
工具列表(Tools)与主要参数用途
以下为 pencil MCP 当前支持的工具(prompts/resources 不支持)。
1) get_editor_state
- 用途:获取当前编辑器状态、激活文档、当前选中节点等上下文。
- 参数:
:是否附带include_schema: boolean
schema。.pen
- 调用模板:
{ "name": "get_editor_state", "arguments": { "include_schema": false } }
2) open_document
- 用途:打开或创建
文件。.pen - 参数:
:filePathOrTemplate: string
文件路径或.pen
。"new"
- 调用模板:
{ "name": "open_document", "arguments": { "filePathOrTemplate": "new" } }
3) batch_get
- 用途:批量读取/搜索节点(读结构、读组件、读实例)。
- 关键参数:
(必填)filePath: string
:按 ID 读取nodeIds?: string[]
:限定在某节点子树内搜索parentId?: string
:按模式搜索(如patterns?: object[]
正则、name
、type
)reusable
:是否返回完整 path 几何(默认会用includePathGeometry?: boolean
缩略)...
:读取展开深度(建议 ≤3)readDepth?: number
:搜索深度searchDepth?: number
:展开实例resolveInstances?: boolean
:解析变量为当前值resolveVariables?: boolean
- 调用模板(按 pattern 搜索可复用组件):
{ "name": "batch_get", "arguments": { "filePath": "designs/app.pen", "patterns": [{ "reusable": true }], "readDepth": 2, "searchDepth": 3 } }
4) batch_design
- 用途:批量执行插入/复制/更新/替换/移动/删除/图片等操作。
- 关键参数:
(必填)filePath: string
(必填):操作脚本(每行一个 op,可绑定变量名;≤25 ops/次)。operations: string
- 调用模板(示意):
{ "name": "batch_design", "arguments": { "filePath": "designs/app.pen", "operations": "root=G()\\nframe=I(root,{type:\\\"frame\\\",name:\\\"Home\\\"})\\nU(frame,{width:390,height:844})" } }
5) snapshot_layout
- 用途:检查布局结构与常见问题(重叠、裁剪等),可只返回问题节点。
- 关键参数:
(必填)filePath: string
:仅检查子树parentId?: string
:检查深度maxDepth?: number
:仅输出有问题的节点problemsOnly?: boolean
- 调用模板:
{ "name": "snapshot_layout", "arguments": { "filePath": "designs/app.pen", "maxDepth": 2, "problemsOnly": true } }
6) get_screenshot
- 用途:对指定节点截图(视觉验收)。
- 参数:
(必填)filePath: string
(必填)nodeId: string
- 调用模板:
{ "name": "get_screenshot", "arguments": { "filePath": "designs/app.pen", "nodeId": "node_123" } }
7) get_guidelines
- 用途:获取设计指南/规则。
- 参数:
(必填)topic: \"code\" | \"table\" | \"tailwind\" | \"landing-page\" | \"design-system\"
- 调用模板:
{ "name": "get_guidelines", "arguments": { "topic": "design-system" } }
8) get_style_guide_tags
- 用途:获取可用风格标签集合。
- 调用模板:
{ "name": "get_style_guide_tags", "arguments": {} }
9) get_style_guide
- 用途:按 tags 或 id 获取风格指南。
- 参数(可选):
tags?: string[]id?: string
- 调用模板:
{ "name": "get_style_guide", "arguments": { "tags": ["mobile", "minimal", "fresh"] } }
10) get_variables
- 用途:读取
文件的变量与主题(用于生成全局样式/代码映射)。.pen - 参数:
(必填)filePath: string
- 调用模板:
{ "name": "get_variables", "arguments": { "filePath": "designs/app.pen" } }
11) set_variables
- 用途:更新
文件的变量与主题。.pen - 参数:
(必填)filePath: string
(必填)variables: object
:是否全量替换(默认合并)。replace?: boolean
- 调用模板:
{ "name": "set_variables", "arguments": { "filePath": "designs/app.pen", "replace": false, "variables": {} } }
12) find_empty_space_on_canvas
- 用途:在画布或某节点周边查找指定尺寸的空白区域。
- 参数:
(必填)filePath: string
(必填)width: number
(必填)height: number
(必填)padding: number
(必填)direction: \"top\" | \"right\" | \"bottom\" | \"left\"
:以某节点为参照(可选)nodeId?: string
- 调用模板:
{ "name": "find_empty_space_on_canvas", "arguments": { "filePath": "designs/app.pen", "width": 390, "height": 844, "padding": 24, "direction": "right" } }
13) search_all_unique_properties
- 用途:统计指定子树里若干属性(颜色/字体/间距等)的唯一值集合,用于分析是否一致。
- 参数:
(必填)filePath: string
(必填)parents: string[]
(必填;枚举:fillColor/textColor/strokeColor/strokeThickness/cornerRadius/padding/gap/fontSize/fontFamily/fontWeight)properties: string[]
- 调用模板:
{ "name": "search_all_unique_properties", "arguments": { "filePath": "designs/app.pen", "parents": ["root_frame"], "properties": ["fillColor", "fontFamily", "fontSize"] } }
14) replace_all_matching_properties
- 用途:在指定子树里批量替换匹配属性(换色/换字体/调整间距等)。
- 参数:
(必填)filePath: string
(必填)parents: string[]
(必填):按属性名提供 from/to 替换规则列表properties: object
- 调用模板:
{ "name": "replace_all_matching_properties", "arguments": { "filePath": "designs/app.pen", "parents": ["root_frame"], "properties": { "fontFamily": [{ "from": "Inter", "to": "SF Pro" }], "fontSize": [{ "from": 14, "to": 15 }] } } }
常见任务提示词(给大模型的执行指令模板)
A) “打开并分析当前设计结构”
- 调用
获取 activeFilePath 与 selectionget_editor_state(include_schema=false) - 用
读取选中节点与其子树(readDepth=2)batch_get - 用
输出布局问题清单snapshot_layout(problemsOnly=true) - 必要时
对问题节点截图确认get_screenshot
B) “批量换主题/换字体/统一间距”
先统计现状(输出唯一值集合与分布)search_all_unique_properties- 提出变更计划(from→to 映射、影响范围、回滚策略)
执行替换replace_all_matching_properties
+snapshot_layout
验收get_screenshot