/sketch:sketch-design-to-codefrom Sketch
Generates production code from Sketch designs with 1:1 visual fidelity. Inspects project conventions, maps symbols to reusable components, exports assets, and validates output against the canvas.
Ships in Sketch. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Generate code from Sketch designs with project-aware reuse, symbol-driven components, and visual verification.
get_guide with topic: "mcp" — always; MCP prerequisites, run_code rules, failure handling, and visual verification.get_guide with topic: "use" — Sketch inspection, symbols, overrides, stacks, styles, exports, and content verification.Fetch guide subtopics on demand when the task needs them: troubleshooting, layout, organization, styling, symbols, assets, and prototyping.
Inverse workflow: Sketch from code/URL is sketch-design-from-reference
https://sketch.com/s/<doc-uuid>/f/<frame-uuid>).package.json → web, *.xcodeproj → iOS, android/ → Android). Ask if ambiguous.If MCP fails: stop and call get_guide with topic: "troubleshooting"; follow its MCP connection failure guidance. Do not implement from memory while MCP is unreachable.
Follow these steps in order. The main flow should be enough for ordinary work; load a reference file only when the step needs more detail or examples.
get_document_info./f/<canvas-frame-uuid> from URLs like https://sketch.com/s/<doc-uuid>/f/<frame-uuid>; find that layer using the share-link guidance in get_guide with topic: "use", and select it. Prefer this over current selection or name matching.get_document_info / get_layer_tree_summary; use targeted run_code only if the dedicated tools cannot resolve the target. Confirm if multiple matches.get_document_info lists under sections, is a canvas group of whole frames, not a region of a page: resolve it to its frames. A frame's sectionID is its innermost section, so include frames whose sectionID is a section nested inside it, following parentSectionID in sections. sections leaves out Components with Variants: map those with references/symbol-to-code.md instead. If this leaves several frames, ask the user which one to implement, or treat each one as a target frame when they want the whole section.get_screenshot on each target frame (targetDocumentID + layerID). This is the primary visual reference for implementation and validation.If selection is empty and no share link resolved, stop and ask the user to select the target frame.
Inspect the project before creating files. Reuse matching components and tokens, match neighboring file layout and state patterns, and keep scope to the target frames unless the user asked for more.
src/components, design system packages, and Storybook.@theme, tokens.ts, and asset catalogs.package.json, Podfile, build.gradle, and framework imports.npm run dev, yarn ios, Makefile, and mise config.Start with dedicated read-only MCP tools before writing custom probes.
get_document_info for the document ID, pages, page layer counts, and top-level Frames/Graphics with positions and dimensions.get_layer_tree_summary on the target page, frame, or layer for hierarchy, IDs, names, dimensions, text snippets, instance details, and stack hints.run_code only for details those tools do not expose: exact style values, pins/sizing, masks, symbol master IDs, override-capable layers, export settings, image sources, or custom geometry checks. Keep scripts small and flat: one probe or property concern per call, with a short title and JSON log.Collect enough data to explain hierarchy, layout, typography, styling, reusable styles, tokens, symbols, assets, and geometry for the selected frame and relevant descendants. Before coding, produce a short asset classification ledger for major regions and export candidates: actual Bitmap/Image layers, pure illustration/path artwork, icon/logo/symbol artwork, text-bearing UI, and mixed UI that should be split into coded structure plus exported inner artwork. For export candidates, record configured layer.exportFormats when present; they capture designer intent for file type, scale or absolute-size variants, prefix/suffix naming, and platform folder naming. For layout, identify whether the design uses stacks, pins/resizing, or other relative layout constraints; those define responsive intent. For large trees, shallow-map first, then deep-dive only critical subtrees.
Apply the tree-summary caveats from the required use guide; never treat an unexpanded or truncated node as empty.
For extraction examples, asset classification probes, and large-tree strategy, read references/extraction.md.
Produce a brief symbol/component map before coding. Repeated instances of the same Sketch master should normally become one reusable component with data-driven props. Nested symbols should normally become composed components, not flattened code.
Sketch master → Code component → Overrides / props
<Family>/<Variant A> → <Family><VariantA> → <override props>
<Family>/<Variant B> → <Family><VariantB> → <override props>
<Family>/<Container> → <Family><Container> → <override props>
<Family>/<Atom> → <Family><Atom> → <override props>
Call get_symbol_overrides per distinct instance (kind: all) when symbols or overrides matter. For symbol mapping examples, read references/symbol-to-code.md.
Export icons, bitmaps, logos, pure artwork groups, and other designed assets from exact Sketch layers or symbol sources when the document contains them. Do not invent placeholder icon packs for designed assets, and do not crop production assets from full-frame canvas checks; canvas checks are for verification. Before choosing fallback export options, inspect each export candidate for configured layer.exportFormats; when they exist, prefer passing those formats to sketch.export so exported files preserve the document's format, size, and naming presets. Put exports in project-conventional paths or a temp directory, log full paths, and verify files exist.
For asset classification details, exact export rules, fidelity checks, and path examples, read references/assets.md.
Translate design → project conventions with 1:1 visual parity vs the Sketch frame and extracted context:
@theme, Swift Color extensions, Android colors.xml, or the project equivalent.gap / frame layout. If the design uses stacks or relative layout, implement those constraints responsively. If it does not, match the page layout at the viewport defined by the frame while keeping containers, spacing, and media flexible where doing so does not break the reference.img / Image / AsyncImage.Do not over-engineer — no extra abstractions for one-off layers.
When the target is a web app:
package.json scripts / mise. Start dev server (npm run dev, etc.).Log what you verified in the final reply.
When the target is mobile or native (no browser loop):
Before claiming done, run the validation checks against the latest canvas check and implementation (web: after browser comparison).
run_code when values are uncertain.For code-specific canvas checks and mismatch recovery, read references/validation.md.
Direction-specific rules for Sketch → code. All generic Sketch MCP rules come from get_guide with topic: "mcp" → Critical Rules, from get_guide with topic: "use" → Mandatory Constraints, and Visual Verification & Completion — follow them in addition to the points below.
document.swatches) and shared styles; hardcode only when unlinked in Sketch.Code-only pitfalls below. Bridge/script issues are in get_guide with topic: "mcp" → Common Mistakes; document-operation issues are in get_guide with topic: "use" → Common Content Mistakes.
fs in run_code fails because fs is not a core package. Use mkdir -p in shell and export in Sketch script only.run_code scripts are hard to debug and recover from. Use one small flat script per probe or concern; do not combine probe, mutation, styling, and export setup in one call.Bridge/tool-call failures: call get_guide with topic: "troubleshooting" and analyze run_code failures before retrying. For Sketch document-operation failures, call the relevant topic (layout, symbols, or assets) for the failed area.
/f/<uuid>.layerID on get_screenshot.get_screenshot, deep-dive the mismatching subtree, and compare against references/validation.md.get_guide with topic: "mcp" — MCP workflow, run_code, visual verification, and completion rulesget_guide with topic: "use" — Sketch inspection, stacks, symbols, styles, exports, and content verificationWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
sketch-to-code, design-to-code, ui-generation, symbol-mapping
2 skills in this plugin
npx claudepluginhub sketch-hq/agents --plugin sketchOther plugins' skills for the same job