This skill should be used when the user asks about "pencil 사용법", ".pen 파일", "노드 타입", "레이아웃 시스템", "pencil mcp", "batch_design", "batch_get", or wants to understand how to work with Pencil design files...
Pencil MCP 서버를 사용하여 .pen 파일을 읽고, 수정하고, 디자인을 생성하는 방법을 제공한다.
.pen 파일은 디자인 데이터를 저장하는 암호화된 형식이다. 반드시 Pencil MCP 도구만 사용하여 접근한다.
중요: Read, Grep, Write 도구로 .pen 파일을 직접 읽거나 쓰지 않는다. 항상 Pencil MCP 도구를 사용한다.
| Type | 용도 | 주요 속성 |
|---|---|---|
frame |
컨테이너, 레이아웃 | layout, gap, padding, fill |
text |
텍스트 콘텐츠 | content, fontSize, fontWeight, textColor |
rectangle |
사각형 도형 | fill, stroke, cornerRadius |
ellipse |
원/타원 | fill, stroke |
ref |
컴포넌트 인스턴스 | ref (컴포넌트 ID 참조) |
image |
이미지 프레임 | G() 오퍼레이션으로 적용 |
icon_font |
아이콘 | icon, iconSize |
Auto Layout 속성:
layout: "horizontal" | "vertical" | "grid"
gap: number (자식 간 간격)
padding: number | [top, right, bottom, left]
alignItems: "start" | "center" | "end" | "stretch"
justifyContent: "start" | "center" | "end" | "space-between"
크기 지정:
width: number | "fill_container" | "hug_contents"
height: number | "fill_container" | "hug_contents"
현재 에디터 상태와 선택된 노드 정보를 가져온다.
mcp__pencil__get_editor_state(include_schema: boolean)
디자인 작업 시작 전 항상 호출하여 활성 파일과 선택 상태를 확인한다.
노드를 검색하거나 ID로 읽는다.
mcp__pencil__batch_get(
filePath: string,
patterns?: [{ reusable?: boolean, type?: string, name?: string }],
nodeIds?: string[],
readDepth?: number,
searchDepth?: number
)
사용 예시:
patterns: [{ reusable: true }]nodeIds: ["nodeId1", "nodeId2"]patterns: [{ type: "text" }]디자인 수정 오퍼레이션을 실행한다.
mcp__pencil__batch_design(
filePath: string,
operations: string // JavaScript 유사 구문
)
노드의 스크린샷을 가져와 시각적으로 검증한다.
mcp__pencil__get_screenshot(filePath: string, nodeId: string)
디자인 작업 후 항상 스크린샷으로 결과를 확인한다.
새 노드를 삽입한다.
// 기본 삽입
frame1=I("parentId", { type: "frame", layout: "vertical", gap: 16 })
text1=I(frame1, { type: "text", content: "Hello", fontSize: 16 })
// 컴포넌트 인스턴스 삽입
button=I("parentId", { type: "ref", ref: "ButtonComponentId" })
기존 노드의 속성을 업데이트한다.
// 직접 업데이트
U("nodeId", { fill: "#FF0000", padding: 16 })
// 컴포넌트 인스턴스 내부 노드 업데이트
U("instanceId/labelId", { content: "New Label" })
노드를 복사한다.
// 단순 복사
copy1=C("sourceId", "parentId", { x: 100, y: 100 })
// 속성 오버라이드와 함께 복사
copy2=C("sourceId", "parentId", {
descendants: {
"labelId": { content: "Copied Label" }
}
})
노드를 새 노드로 교체한다.
newNode=R("oldNodeId", { type: "text", content: "Replaced" })
노드를 삭제한다.
D("nodeId")
노드를 다른 위치로 이동한다.
M("nodeId", "newParentId", 0) // index는 선택사항
프레임에 이미지를 적용한다.
// AI 생성 이미지
imgFrame=I("parentId", { type: "frame", width: 400, height: 300 })
G(imgFrame, "ai", "modern office workspace")
// 스톡 이미지
G("existingFrameId", "stock", "nature landscape")
get_editor_state로 현재 상태 확인batch_get으로 사용 가능한 컴포넌트 확인get_guidelines로 디자인 가이드라인 로드get_style_guide_tags + get_style_guide로 스타일 영감 얻기batch_design으로 화면 구성get_screenshot으로 결과 검증batch_get으로 대상 노드 구조 파악batch_design의 U() 오퍼레이션으로 속성 수정get_screenshot으로 변경사항 확인snapshot_layout으로 레이아웃 구조 분석batch_design으로 수정get_screenshot으로 검증references/node-properties.md - 모든 노드 타입의 상세 속성references/layout-examples.md - 레이아웃 패턴 예시