Tools
This skill is designed to call the Pencil MCP tool:
snapshot_layout
If your client namespaces MCP tools, it may appear as mcp__pencil__snapshot_layout.
When to use this skill
Intent Recognition (CRITICAL)
Even if a trigger phrase matches, you must verify the user's intent:
- Is the user explicitly asking to use "Pencil"?
- Is the current conversation context clearly about "Pencil" design tasks?
If the answer is NO, do NOT use this skill. (e.g., "Analyze layout" might refer to HTML/CSS layout analysis).
CRITICAL PREREQUISITE: You must ONLY use this skill when the user EXPLICITLY mentions "Pencil".
ALWAYS use this skill when:
- You need to understand the hierarchy and layout relationship of nodes in Pencil.
- You are planning to move or align elements and need their current bounds.
- You need to check for "problems" like clipped content or overlapping elements.
- The user asks to "Analyze layout" or "Check structure" of a Pencil design.
Trigger phrases include:
- "Pencil snapshot layout" (Pencil layout snapshot)
- "Analyze Pencil page structure" (Analyze Pencil page structure)
- "Check Pencil layout problems" (Check Pencil layout problems)
- "Get Pencil node hierarchy" (Get Pencil node hierarchy)
Input Parameters
filePath(string, optional): Path to access a specific.penfile. Default is active document.maxDepth(integer, optional):- Limit how deep to descend in the node tree.
- Recommendation: Always specify a reasonable limit (e.g., 2 or 3) to avoid context overflow.
0means only top-level nodes.
parentId(string, optional): Only return layout for this node's subtree.problemsOnly(boolean, optional):- Set to
trueto only return nodes with layout issues (e.g., clipped by parent). - Default:
false.
- Set to
How to use this skill
- Determine Scope: Do you need the whole page (
maxDepth=1) or a specific section (parentId=...)? - Call Tool:
snapshot_layout(...). - Analyze Output: The result is a tree structure with layout information (bounds, constraints).
Examples
1. Simple: Top Level Snapshot
Get the layout of the top-level frames to see where empty space might be. See 1-top-level.json.
2. Medium: Specific Frame Layout
Get the layout structure of a specific frame to understand its children's positioning. See 2-specific-frame.json.
3. Complex: Layout Problems
Check for layout issues (like clipped content) deep within a specific section. See 3-layout-problems.json.
Keywords
English keywords: snapshot layout, layout analysis, node hierarchy, structure check, bounds check, layout problems
Chinese keywords (Chinese keywords): layout snapshot, layout analysis, node hierarchy, structure check, boundary check, layout problems
Common pitfalls (Gotchas)
- Version compatibility: Pay attention to the compatibility between the framework version and dependency libraries; APIs may differ across versions
- Configuration file format: Configuration file format errors are the most common problem; it is recommended to use the editor's syntax checking
- Environment variables: Ensure all necessary environment variables are set correctly; do not hard-code sensitive information
- Dependency conflicts: When multiple versions coexist, pay attention to dependency conflicts; use a lock file to pin versions
- Performance pitfalls: In large-data scenarios, pay attention to performance optimization and avoid common problems such as N+1 queries
Usage workflow
Step 1: Environment preparation
Ensure the development environment has the necessary dependencies and tools installed.
Step 2: Configuration initialization
Perform basic configuration according to project requirements.
Step 3: Core functionality usage
Implement the core functionality according to the example code.
Step 4: Test verification
Run tests to ensure the functionality works properly.
Step 5: Deployment and release
After development is complete, perform deployment and monitoring.