Back to Skills

pencil-design

Design UIs in Pencil (.pen files) and generate production code from them. Use when working with .pen files, designing screens or components in Pencil, or generating code from Pencil designs. Triggers on tasks involving Pencil, .pen files, design-to-code workflows, or UI design with the Pencil MCP tools.

21stars1forksUpdated 7/14/2026

Security Assessment

Safe(100/100)
Security Score100/100

About pencil-design

pencil-design is a skill for designing production-quality UIs in Pencil (.pen files) and generating clean, maintainable code from them. It solves the problem of inconsistent, hard-to-maintain designs and poor generated code by enforcing best practices for design system reuse, variable usage, layout correctness, visual verification, and design-to-code workflows. It applies when designing screens or components in a .pen file, generating code (React, Next.js, Vue, Svelte, HTML/CSS) from Pencil designs, building or extending a design system, syncing design tokens between Pencil and code (Tailwind v4 @theme, shadcn/ui tokens), importing existing code into Pencil, or working with any Pencil MCP tools.

The skill defines six critical rules to prevent common agent mistakes. Rule 1: always reuse design system components by calling pencil_batch_get with patterns [{ reusable: true }], inserting matches as ref instances via I(parent, { type: "ref", ref: "<componentId>" }) and customizing descendants with U(). Rule 2: always use variables instead of hardcoded values by reading pencil_get_variables and using semantic Tailwind v4 utilities (bg-primary, rounded-md) rather than arbitrary value syntax. Rule 3: prevent text and content overflow, constraining widths to parent bounds (mobile typically 375px), using fill_container, and checking pencil_snapshot_layout with problemsOnly: true. Rule 4: visually verify every section with pencil_get_screenshot and layout snapshots. Rule 5: reuse existing assets such as logos and icons, copying with the C() operation rather than regenerating with G(). Rule 6: always load the frontend-design skill first for aesthetic direction. A documented workflow chains tools like pencil_get_editor_state, pencil_get_guidelines, pencil_find_empty_space_on_canvas, and pencil_batch_design, building section by section (plan, build, verify, fix, proceed).

It targets designers and developers using Pencil and its MCP tools who want distinctive, consistent UIs and high-quality generated code. Reference files cover design-system components, variables and tokens, layout and text overflow, responsive breakpoints, visual verification, asset reuse, the design-to-code workflow, and a Tailwind-shadcn mapping. A stated requirement is loading the frontend-design skill at the start of any Pencil design or code generation task to avoid generic AI aesthetics.

FAQ

What is this skill for?

Designing production-quality UIs in Pencil (.pen files) and generating clean, maintainable code (React, Next.js, Vue, Svelte, HTML/CSS) from them, while enforcing design system reuse, variable usage, layout correctness, and visual verification.

How should components and styles be handled?

Always reuse existing design system components by listing reusable ones with pencil_batch_get (patterns [{ reusable: true }]) and inserting them as ref instances, and always use variables from pencil_get_variables instead of hardcoded colors, radii, spacing, or typography. In generated code use semantic Tailwind v4 utilities like bg-primary and rounded-md, never arbitrary value syntax.

How does it prevent layout and overflow problems?

Constrain widths to parent bounds (mobile screens are typically 375px wide), use fill_container for text width inside auto-layout frames, and call pencil_snapshot_layout with problemsOnly: true to detect clipping and overflow, fixing issues before proceeding. It also verifies each section visually with pencil_get_screenshot.

Do I need any other skill to use it?

Yes. Rule 6 requires loading the frontend-design skill at the start of any Pencil design or code generation task. It provides aesthetic direction and design quality standards that prevent generic, cookie-cutter UI, and applies both when designing in Pencil and when generating code.

How are assets like logos reused?

Before generating an image, search for existing image or logo nodes with pencil_batch_get. If a matching asset exists elsewhere in the document, copy it with the C() operation. Use the G() (Generate) operation only for genuinely new images, and for logos always copy from an existing instance rather than regenerating.

All Files

10 files
references/layout-and-text-overflow.md4.9 KB
View
references/variables-and-tokens.md7.4 KB
View
references/responsive-breakpoints.md5.9 KB
View
README.md6.2 KB
View
references/design-system-components.md4.3 KB
View
SKILL.md11.4 KB
View
references/design-to-code-workflow.md16.1 KB
View
references/visual-verification.md4.4 KB
View
references/asset-reuse.md4.1 KB
View
references/tailwind-shadcn-mapping.md7.1 KB
View

Install pencil-design

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill