sketch-implement-design
Translate Sketch layers into production-ready code with 1:1 visual fidelity using Sketch MCP tools (`run_code`, `get_selection_as_image`) for live design context, screenshots, and asset export. Use when implementing or updating UI from an open Sketch document, current selection, or specific Sketch layer IDs.
What this skill does
# Sketch Implement Design
## Overview
Implement UI from Sketch with high visual fidelity by querying live document data
through Sketch MCP. Use `run_code` to inspect and export data, and
`get_selection_as_image` as the visual source of truth.
## Prerequisites
- Keep Sketch open with the target document available.
- Enable Sketch MCP in Sketch settings:
**General** -> **Allow AI tools to interact with open documents**.
- Configure Codex MCP to point to the local Sketch server address shown in Sketch settings.
- Default address is usually `http://localhost:31126/mcp`.
- Select the layer or frame to implement in Sketch before calling `get_selection_as_image`.
## Required Workflow
Follow these steps in order. Do not skip steps.
### Step 0: Confirm Sketch MCP connectivity
If Sketch MCP calls fail:
1. Check that Sketch is running and MCP is enabled in settings.
2. Check the MCP server URL in your MCP client config.
3. Retry after confirming the server address in Sketch settings.
### Step 1: Identify the implementation target
Use these approaches in priority order:
- User gives a Sketch share link like
`https://sketch.com/s/<document-share-uuid>/f/<canvas-frame-uuid>`: extract
the `/f/<canvas-frame-uuid>` value, find that layer, and select it. Prefer
this target over current selection or name-based matching.
- User gives layer identifiers or names: use `run_code` to locate matching
layers and ask for confirmation.
- User selects the exact frame/component in Sketch.
Use `run_code` with the `find` function and this pattern when a share link is provided:
```js
const sketch = require('sketch')
const frameId = '4A2E31FF-56BD-4C29-92D2-829548D19C1D'
const frame = find(`#${frameId}`)
if (frame) sketch.getSelectedDocument().selectedLayers = [frame]
```
When multiple matches exist, stop and ask which layer to implement.
### Step 2: Fetch structured design context via `run_code`
Run `run_code` to collect design data for the selected root layer (and relevant descendants):
- Hierarchy: IDs, names, types, visibility, lock state
- Layout: frame, resizing behavior, pins, stack layout, clipping
- Typography: font family, size, weight, line height, alignment, decoration
- Styling: fills, borders, shadows, blur, corner radii, opacity, tint
- Reusable styling: shared text/layer style names and source library names
- Variables/swatches: color variable names and optional source library names
- Symbols: nested symbols and override-capable fields
- Export settings and image sources
Always start scripts with:
```js
const sketch = require('sketch')
```
Pass a short `title` argument to `run_code` and keep scripts minified unless the
user asks otherwise.
If output is too large:
1. Fetch a shallow tree map first (IDs, names, types only).
2. Fetch detailed context per critical child subtree.
3. Continue only after all required nodes are covered.
### Step 3: Capture visual reference via `get_selection_as_image`
Call `get_selection_as_image` on the same selected target. Use this image as the primary visual
reference for implementation and validation.
If selection is empty, stop and ask the user to select the intended layer/frame in Sketch.
### Step 4: Export required assets via `run_code`
Export icons, bitmaps, and other assets from Sketch instead of inventing placeholders.
Rules:
- Use assets from Sketch output; do not add new icon packs unless explicitly requested.
- Use absolute output paths.
- For `sketch.export`, always pass both `output` and `filename` (with extension).
Example:
```js
const sketch=require('sketch');const d=sketch.getSelectedDocument()
const l=d.selectedLayers.layers[0]
sketch.export(l,{
output:'/tmp/sketch-assets',
filename:`${l.id}.png`,
formats:['png']
});console.log('ok')
```
### Step 5: Translate Sketch output to project conventions
Treat Sketch data as design intent, then map to project standards:
- Reuse existing UI components before creating new ones.
- Map Sketch values to project tokens (color, spacing, type scale, radius).
- Match established architecture and state/data patterns.
- Keep generated code maintainable and idiomatic for the target stack.
### Step 6: Implement for 1:1 visual parity
Aim for visual parity with the Sketch screenshot and context:
- Match spacing, alignment, sizing, and hierarchy.
- Match typography and color usage.
- Preserve intended behavior for responsive/constraint-based layouts.
- Use tokenized values when possible; avoid unnecessary hardcoded values.
### Step 7: Validate against Sketch before completion
Validate implemented UI against the screenshot and design context checklist:
- Layout and spacing
- Typography
- Colors and effects
- States and interactions
- Asset rendering
- Responsiveness/constraints
- Accessibility basics
If mismatch remains, re-query with `run_code` for the affected subtree and iterate.
## Implementation Rules
- Prefer incremental updates over broad rewrites.
- Keep component boundaries consistent with the design hierarchy.
- Document intentional deviations (technical or accessibility constraints).
- Do not assume stale design data; re-query Sketch when unsure.
## Common Issues
### `Empty selection` from `get_selection_as_image`
Cause: Nothing selected in Sketch.
Fix: Ask the user to select the target layer/frame, then retry.
### `No document` from MCP tools
Cause: No open Sketch document or Sketch not running.
Fix: Open the document in Sketch and retry.
### `run_code` output is too large or truncated
Cause: Selection tree is too large.
Fix: Query shallow tree first, then fetch detailed context by subtree.
### Missing or incorrect exported assets
Cause: Invalid export options or relative output path.
Fix: Use absolute paths and pass both `output` and `filename`.
### Implementation does not match visual design
Cause: Incomplete context capture or token mismatch.
Fix: Re-capture screenshot and inspect exact node values via `run_code`.
## References
- [Sketch MCP server docs](https://www.sketch.com/docs/mcp-server/)
- [Sketch API reference](https://developer.sketch.com/reference/api/llms.txt)
Related in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.