Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
bighardperson avatar

Pencil To Code

  • 8 installs
  • 33 repo stars
  • Updated April 26, 2026
  • bighardperson/computer-science-skills-collection

Pencil-to-code is a skill that exports a Pencil .pen design into production React and Tailwind component code.

About

Pencil-to-code exports a finalized Pencil .pen design into production React and Tailwind code. It reads the .pen frame tree, extracts design variables into a Tailwind theme, and maps node types to semantic HTML components. A developer uses it after a design direction is chosen to turn a mockup into implementation code.

  • Exports Pencil .pen designs into React + Tailwind components
  • Maps .pen variables to a Tailwind 4 @theme token system
  • Converts node types (frame, text, ref, image) to semantic HTML

Pencil To Code by the numbers

  • 8 all-time installs (skills.sh)
  • Ranked #1,729 of 2,244 Frontend Development skills by installs in the Skillselion catalog
  • Data as of Jul 30, 2026 (Skillselion catalog sync)
At a glance

pencil-to-code capabilities & compatibility

Capabilities
design to code · component generation · token extraction
Use cases
frontend · ui design
From the docs

What pencil-to-code says it does

Export Pencil .pen designs to production React/Tailwind code.
SKILL.md
**Single concern**: Export → code. No design modifications.
SKILL.md
npx skills add https://github.com/bighardperson/computer-science-skills-collection --skill pencil-to-code

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs8
repo stars33
Last updatedApril 26, 2026
Repositorybighardperson/computer-science-skills-collection

What it does

Convert a finalized Pencil .pen frame into React and Tailwind component code.

Who is it for?

Turning a finalized Pencil design into React and Tailwind components

Skip if: Modifying designs; it does export only, no design changes

When should I use this skill?

A finalized Pencil .pen design needs to be converted to implementation code

What you get

React component files plus a Tailwind theme derived from the .pen variables.

  • React component files
  • Tailwind theme configuration

By the numbers

  • 8-point spacing grid mapping
  • 7-row node-type to component mapping table

Files

SKILL.mdMarkdownGitHub ↗

Pencil to Code

Export Pencil .pen designs to production React/Tailwind code.

Interface

Input:

  • Frame ID to export (or entire document)
  • Target framework: React (default), Vue, HTML
  • Optional: Component name, output path

Output:

  • React component(s) with Tailwind classes
  • Tailwind theme configuration (from .pen variables)
  • Optional: Screenshot comparison for validation

Workflow

1. Read Design Structure

// 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" })

2. Extract Design Tokens

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

3. Map Nodes to Components

.pen Node TypeReact Output
frame with layout<div className="flex ...">
frame with childrenComponent with children
text<p>, <h1-6>, or <span>
ref (instance)Reusable component
rectangle<div> with fill
ellipse<div className="rounded-full">
image<img> or fill: url()

Reference: references/node-mapping.md

4. Generate Code

Component structure:

// 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>
  )
}

Tailwind mapping:

.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-lg

5. 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-full

Spacing (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-8

Typography

.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-bold

Colors

.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-200

Border 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-full

Constraints

  • Single concern: Export → code. No design modifications.
  • Tailwind 4 @theme: CSS-first token system
  • React + TypeScript: Default output target
  • Semantic HTML: Choose appropriate elements
  • Accessibility: Include aria attributes where detectable

References

  • references/node-mapping.md — Complete node → component mapping
  • references/token-extraction.md — Variable → theme extraction
  • design-tokens/ — Token system conventions

Integration

Called by:

  • design-exploration orchestrator (after direction selection)
  • Direct user invocation

Composes:

  • design-tokens (for theme structure)

Related skills

FAQ

What frameworks does pencil-to-code output?

React with Tailwind by default, with Vue and HTML as target options.

Does it modify the design?

No. It is single-concern export to code and does not modify designs.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.