Export .pen design to React/Tailwind code. Does ONE thing well. Input: .pen frame ID or file path Output: React component code + Tailwind config Use when: design-exploration or user needs implementation code from a finalized Pencil design.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install pencil-to-code或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install pencil-to-code⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/pencil-to-code/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: pencil-to-code description: | Export .pen design to React/Tailwind code. Does ONE thing well.
Input: .pen frame ID or file path Output: React component code + Tailwind config
Use when: design-exploration or user needs implementation code from a finalized Pencil design. effort: high ---
Export Pencil .pen designs to production React/Tailwind code.
Input:
Output:
// Get full frame tree
mcp__pencil__batch_get({
filePath: "<path>.pen",
nodeIds: ["frameId"],
readDepth: 10,
resolveInstances: true,
resolveVariables: true
})
// Get design variables/theme
mcp__pencil__get_variables({ filePath: "<path>.pen" })
Transform .pen variables → Tailwind theme:
/* From .pen variables */
@theme {
--color-primary: [from variables.colors.primary];
--color-background: [from variables.colors.background];
--font-sans: [from variables.fonts.body];
/* ... */
}
Reference: references/token-extraction.md
| .pen Node Type | React Output | |---------------|--------------| | Reference: Component structure: Tailwind mapping: Called by: Composes: 安装 Pencil To Code 后,可以对 AI 说这些话来触发它 Help me get started with Pencil To Code Explains what Pencil To Code does, walks through the setup, and runs a quick demo based on your current project Use Pencil To Code to export Invokes Pencil To Code with the right parameters and returns the result directly in the conversation What can I do with Pencil To Code in my documents & notes workflow? Lists the top use cases for Pencil To Code, with example commands for each scenario 将技能文件夹放到 ~/.claude/skills/pencil-to-code/ 目录(个人级,所有项目可用),或 .claude/skills/pencil-to-code/(项目级)。重启 AI 客户端后,用 /pencil-to-code 主动调用,或让 AI 根据上下文自动发现并使用。 Pencil To Code 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。 Pencil To Code 可免费安装使用。请查阅仓库了解许可证信息。 Export .pen design to React/Tailwind code. Does ONE thing well.
Input: .pen frame ID or file path
Output: React component code + Tailwind config
Use when: design-exploration or user needs implementation code
from a finalized Pencil design. Pencil To Code 属于「Documents & Notes」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。frame with layout | | | frame with children | Component with children | | text | , , or | | ref (instance) | Reusable component | | rectangle | with fill | | ellipse | | | image | or fill: url() |
references/node-mapping.md4. Generate Code
// components/[ComponentName].tsx
import { cn } from "@/lib/utils"
interface [ComponentName]Props {
className?: string
// Extracted props from design
}
export function [ComponentName]({ className, ...props }: [ComponentName]Props) {
return (
<div className={cn("[tailwind classes]", className)}>
{/* Nested structure */}
</div>
)
}.pen property → Tailwind class
--------------------------------
fill: #000 → bg-black
layout: horizontal → flex flex-row
gap: 16 → gap-4
padding: [16,24,16,24] → py-4 px-6
fontSize: 24 → text-2xl
fontWeight: 700 → font-bold
cornerRadius: [8,8,8,8] → rounded-lg5. Validate (Optional)
// Screenshot the .pen frame
mcp__pencil__get_screenshot({ nodeId: "frameId" })
// Compare visually with rendered React
// (Manual step or browser automation)6. Output
## Generated Components
### [ComponentName]
- File: `components/[ComponentName].tsx`
- Props: [list extracted props]
### Theme Configuration
- File: `app/globals.css` (additions)
## Verification
Screenshot comparison: [attached]Translation Rules
Layout System
.pen Tailwind
--------------------------------------
layout: "vertical" → flex flex-col
layout: "horizontal" → flex flex-row
layout: "grid" → grid
alignItems: "center" → items-center
justifyContent: "center" → justify-center
gap: 8 → gap-2
gap: 16 → gap-4
gap: 24 → gap-6
width: "fill_container" → w-full
height: "fill_container" → h-fullSpacing (8-point grid)
.pen padding Tailwind
----------------------------------------
[8,8,8,8] → p-2
[16,16,16,16] → p-4
[16,24,16,24] → py-4 px-6
[24,32,24,32] → py-6 px-8Typography
.pen Tailwind
----------------------------------------
fontSize: 12 → text-xs
fontSize: 14 → text-sm
fontSize: 16 → text-base
fontSize: 20 → text-xl
fontSize: 24 → text-2xl
fontSize: 32 → text-3xl
fontSize: 48 → text-5xl
fontWeight: 400 → font-normal
fontWeight: 500 → font-medium
fontWeight: 600 → font-semibold
fontWeight: 700 → font-boldColors
.pen Tailwind
----------------------------------------
fill: "#FFFFFF" → bg-white
fill: "#000000" → bg-black
fill: variable → bg-[var(--color-name)]
textColor: "#6B7280" → text-gray-500
stroke: "#E5E5E5" → border-gray-200Border Radius
.pen cornerRadius Tailwind
----------------------------------------
[0,0,0,0] → rounded-none
[4,4,4,4] → rounded
[8,8,8,8] → rounded-lg
[16,16,16,16] → rounded-2xl
[9999,9999,9999,9999] → rounded-fullConstraints
References
references/node-mapping.md — Complete node → component mappingreferences/token-extraction.md — Variable → theme extractiondesign-tokens/ — Token system conventionsIntegration
design-exploration orchestrator (after direction selection)design-tokens (for theme structure)Prompt 示例
UAUAUA常见问题
如何安装 Pencil To Code?▾
Pencil To Code 支持哪些 AI 平台?▾
Pencil To Code 是免费的吗?▾
Pencil To Code 有什么功能?▾
Pencil To Code 属于哪个分类?▾
使用场景
Automate my documents & notes tasks using Pencil To Code
Identifies repetitive steps in your workflow and sets up Pencil To Code to handle them automatically