JohnWayneeee/ai-agent-skills / skills/pencil-to-code
pencil-to-code
VerifiedConvert Pencil `.pen` design files and named Pencil node IDs into production frontend code. Use when asked to implement, migrate, reproduce, or refine a Pencil/Figma-like visual design in code, especially for responsive artboards, glassmorphism, typography matching, background image layers, design tokens, or visual fidelity debugging against Pencil node IDs.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 3.5 KB |
| agents/openai.yaml | config | 304 B |
| references/handoff-checklist.md | markdown | 3.4 KB |
references/handoff-checklist.md
View on GitHub# Pencil To Code Handoff Checklist
Use this checklist while implementing or debugging visual fidelity.
## Pencil Extraction
- Read every requested artboard node with `batch_get`.
- Read handoff/spec nodes at enough depth to capture responsive rules.
- Use `get_variables` and map core variables into CSS/theme tokens.
- Take Pencil screenshots for each artboard with `get_screenshot`.
- For repeated components, inspect direct children rather than relying on screenshots alone.
## Facts To Capture
- Artboard: width, height, fill, clip behavior.
- Foreground stack: width, x/y, gap, padding, min height, spacer heights.
- Cards/buttons/rows: width, height, padding, gap, radius, stroke, fill, blur, shadow.
- Typography: text, font family, size, weight, line-height, letter-spacing, color, text growth/fixed width.
- Icons/images: source file, mode (`fill`, `fit`, etc.), size, crop/object position.
- Background layers: image dimensions, fill mode, veil gradient, vignette ellipse size/position, mist size/position, wire line positions and colors.
## Code Mapping
- Make reusable components for repeated visual units before fine-tuning CSS.
- Use CSS variables for design tokens: colors, foreground width, top offset, spacer, radii, blur, shadow.
- Keep foreground as a single flex/grid stack when the design is single-column.
- Put background scene layers in a dedicated component with `aria-hidden="true"` and `pointer-events: none`.
- Prefer real exported assets from the `.pen` folder over recreating logos or photos.
## Background Rules
- Match Pencil image fill semantics:
- `mode: fill` usually maps to `object-fit: cover` or CSS `background-size: cover`.
- If the designer scaled the image within a larger artboard, preserve aspect ratio and adjust `background-size`, `background-position`, or `transform: scale(...)`.
- Avoid `background-size: 100% 100%` unless the design intentionally distorts the image.
- Keep overlay layers separate from the image layer.
- Compare desktop crops carefully; a fix for mobile can break the wide artboard.
## Typography Rules
- Load the exact family used in Pencil when possible.
- If using `next/font`, ensure font CSS variables are in scope where they are consumed.
- Verify important labels with `getComputedStyle`, especially when text looks too bold or too generic.
- Match visual weight over nominal weight when browser rendering differs from Pencil.
- Preserve letter spacing exactly for labels and handles.
Useful browser check:
```js
Array.from(document.querySelectorAll(".selector")).map((el) => {
const s = getComputedStyle(el);
return {
text: el.textContent,
fontFamily: s.fontFamily,
fontSize: s.fontSize,
fontWeight: s.fontWeight,
lineHeight: s.lineHeight,
letterSpacing: s.letterSpacing,
};
});
```
## Responsive Verification
- Test every provided artboard size, not just generic breakpoints.
- Confirm fixed foreground columns do not expand on tablet/desktop.
- Confirm footer/actions remain in the required layout at every breakpoint.
- Confirm minimum touch targets are at least 40-44px.
- Check for horizontal overflow after matching fixed-width designs.
## Final Checks
- Run the repository's required formatter/lint/type/build command.
- Capture browser screenshots at all artboard sizes.
- Compare against Pencil screenshots and name any intentional deviations in the final summary.
- Remove temporary screenshots or debug artifacts before finishing.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |