Figma handoff norms
Skill Emraude-agency/figma-handoff/skills/figma-handoff-norms
Single source of truth for figma-handoff. Defines the blocking gates, the norm families (Structure, Sizing, Tokens, Naming, Components, A11y, Report), the shared scan definitions, the Figma defaults that are NOT violations, and the veille+transparency rule. Loaded by every figma-handoff agent before acting.From its SKILL.md
npx -y skills add Emraude-agency/figma-handoff --skill figma-handoff-normsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
17.3 KB, as published. Nobody here has run it
figma-handoff norms
Every figma-handoff agent loads this skill before acting. There is one taxonomy here — agents reference families by name (Structure, Sizing, Tokens, …), never by fragile numbers. If a rule is not in this file, it is not a norm.
One rule above all: the blocking gates below are pass/fail. A pass that leaves any gate red is a failure, not a deliverable. Structure and sizing are gated at the same criticality as naming — historically the handoff broke on structure/sizing while naming was over-polished. Do not repeat that.
Blocking gates (measured, not guessed)
Measure these on the working copy. 0 (or 100% where noted) = pass. Publish every value in the final report.
| Gate | Metric | Pass | Owner family |
|---|---|---|---|
nonAL | layout containers (see Scan defs) with layoutMode === "NONE" | 0 | Structure |
groups | GROUP nodes, excluding those locked inside an instance | 0 | Structure |
framing | screens partitioned into header? / body / tab-bar? with no orphan top-level child | 100% | Structure |
nonResponsive | content nodes with a hardcoded size where FILL/HUG is correct, + overlays not on ABSOLUTE+constraints | 0 | Sizing |
rawStyles | owned raw fills/strokes/radii on bindable nodes, recursing into nested masters (in-remote residuals are flagged, not failed) | 0 | Tokens |
generics | editable nodes (excl. instance-locked) keeping a blacklisted/auto name | 0 | Naming |
layoutPct | share of names that are layout/* | ≤ 10% | Naming |
dupes | repeated patterns (≥3) left non-instanced | 0 | Components |
erroredSets | COMPONENT_SET with inconsistent property definitions | 0 | Components |
A11y (contrast, touch target, focus) and missing states are flag-level, not auto-fixed — see family A. They never block promotion but must all be surfaced.
Cross-cutting rule — Veille & transparency
Before any normative decision (contrast threshold, auto-layout API, variant spec, token format, font availability), if you have a doubt OR the norm/API may have changed since training, do a targeted web lookup (WebSearch/WebFetch/context7), apply the most recent authoritative source, and CITE it in the report (title + date). On-demand at your judgment — not systematic. Never decide on memory alone when a doubt exists.
Scan definitions (shared by every gate)
These definitions are the single source the gates measure against. Apply them identically in audit and in execution.
Layout container — a node of type FRAME or COMPONENT with ≥1 child. The nonAL, groups, framing, nonResponsive and rawStyles gates scan both FRAME and COMPONENT, including the internals of component masters. Excluded from "layout container":
COMPONENT_SET— the variant wrapper. Its non-AL layout, ~5px radius and purple stroke are the Figma editor default (see "Figma defaults" below), never a violation.- Leaf icon / glyph — a FRAME/COMPONENT whose descendants are only
VECTOR/BOOLEAN_OPERATION/STAR/LINE(an icon), or named/role-tagged as an icon. These are graphics, not layout. - Media frame — a FRAME/COMPONENT carrying an IMAGE fill with 0 layout children (it is a photo, see Naming N-media).
Interactive node — has reactions, or resolves to a button / link / input / checkbox / toggle by role or name.
Bindable property — fills[].color, strokes[].color, cornerRadius (and per-corner), strokeWeight, padding*, itemSpacing, effects.
Recurse into masters — when scanning a node, resolve any instance to its master via await instance.getMainComponentAsync() and scan the master's internals too. A raw stroke buried 3 levels deep inside a nested master still counts against rawStyles.
Family S — Structure (gates: nonAL, groups, framing)
S1 — Auto-layout on every layout container
Every layout container (per Scan defs — FRAME and COMPONENT internals) must use auto-layout. layoutMode === "NONE" on a layout container = failure. Direction is inferred from child bounds; never recreate or reorder children (see figma-use-deep AL recipe). Gate: nonAL = 0.
S2 — Semantic framing of every screen
Each screen is partitioned top-level into:
- header — app-bar + filters/stories/tabs. Fixed (sticky top, see Sizing).
- body — the scrollable content region. Always present.
- tab-bar / footer — bottom navigation, when the design shows it. Fixed (sticky bottom).
No screen may keep loose, un-grouped, absolutely-positioned top-level children. Gate: framing = 100% of screens (body present and identified; header/tab-bar identified and fixed when present).
S3 — No groups
GROUP is forbidden as a structural primitive — convert to a frame (with auto-layout per S1). Emptied groups auto-delete; frames create a new origin, so recenter children (see figma-use-deep group→frame recipe). Gate: groups = 0, excluding groups locked inside an instance.
S4 — No redundant single-child wrapper
A chain of single-child frames with fixed height (primaryAxisSizingMode === "FIXED", no fill/stroke/effect/padding) is redundant nesting. Flatten the pass-through wrapper, or set it to HUG. If it carries real styling, keep it. Always reported (full path), never silently ignored.
Family Z — Sizing & responsive (gate: nonResponsive)
Structure without responsive sizing still breaks at dev time. Default to fluid; reserve fixed sizes for genuinely fixed elements (icons, avatars at a spec size).
Z1 — Responsive content sizing
- Cards / list items / sections:
FILLwidth,HUGheight. - Media (image/video):
FILLwidth, height driven by aspect ratio (fixed aspect, not fixed px). - Text:
HUGorFILL, never a frozen width that clips. - Icons / avatars / spec-sized chips: fixed size is correct — leave them.
Z2 — Sticky anchoring (nav bars keep a FIXED height)
- header → sticky top; FIXED height (its intrinsic height — HUG would eat the safe-area and collapse it).
- tab-bar / footer → sticky bottom; FIXED height (same reason — a HUG'd nav collapsed 69→47 in the field).
- body → scrollable between them, FILL.
- Order of operations: setting
layoutModeinstantly HUGs a frame, so a frame that must keep a size (screen root, header, tab-bar) needs aresize()right after (use figma-use-deep §13enableAutoLayout({w,h})).
Z3 — Overlays via constraints, never frozen coordinates
Badges, FABs, close buttons, absolute decorations use layoutPositioning = "ABSOLUTE" plus constraints (e.g. {horizontal: "MAX", vertical: "MIN"}) — never hardcoded x/y. Two ordering hazards (figma-use-deep §13): ABSOLUTE throws unless the parent is already auto-layout (frame the body first); and reparenting a child into an AL frame defaults it to FILL — re-fix its size with reparentKeepSize.
Gate: nonResponsive = 0 (no content node fixed-sized where FILL/HUG applies; nav bars FIXED-height; no overlay missing ABSOLUTE+constraints).
Family T — Tokens (gate: rawStyles)
T1 — Local-first foundation
Build the token foundation as local Variables created in the file, so the result is self-contained. Bind to an existing remote/library variable only when one with the same resolved value already exists in the file's linked libraries — otherwise create the local variable. Never leave a value hardcoded because "a library should provide it."
T2 — Zero raw styles (recursive, classified)
No bindable property may stay hardcoded once a token exists for its value. Scan recurses into nested masters (Scan defs) and classifies each residual instead of just counting (figma-use-deep §12) — counting alone gave false positives and negatives in the field:
- owned → editable → fix it. The gate
rawStyles = 0counts owned residuals only. - in-remote → inside a read-only library master → cannot be bound in place → flag it (and localize via
detachAndTokenizeonly if a true zero is required). Never counted as a blocking failure. - A radius is bound when uniform
cornerRadiusis bound OR all 4 per-corner radii are bound — a per-corner-bound radius is not a residual. Bind radii (per corner when needed), strokes and fills — not just fills. - A paint is bound via
paint.boundVariables.color, not the node'sboundVariables.fillsand never via truthiness of{}.
Snap odd off-scale values (strokeWeight: 1.78, 1.333; ad-hoc radii) to the nearest scale step before binding — the bound token must point at a clean scale value. setBoundVariableForPaint resets the paint opacity — always re-apply it (use figma-use-deep §13 bindPaint). Never flip scaleMode on a CROP image (it reveals hidden cropped content — e.g. multi-pose avatar sheets); preserve its imageTransform.
T3 — Text & effect styles
Repeated type specs (fontFamily+size+weight+lineHeight+letterSpacing, ≥ min occurrences) → a text style, applied. Repeated shadow specs → an effect style, applied.
Family N — Naming (gates: generics, layoutPct)
N-shot — Screenshot-driven, in context (before any rename)
Before naming a screen's nodes: get_screenshot each screen (maxDimension ≥ 1024) and actually look at it; correlate each visual region to the node tree (metadata + bounds + fills + text). Naming blind from metadata alone is forbidden. A name describes what the node is visually (header/app-bar, stories/ring, card/post, media/cover-photo, caption/body, meta/timestamp, nav/bottom-bar, btn/like), never its generic shape.
Screenshot in context, never in isolation: a master containing remote glyphs renders blank when shot alone → a false "empty" diagnosis. Always shoot the node on its assembled screen.
N-zero — Zero residual generic name (never-null)
After a naming pass, NO editable node (excluding instance-locked sublayers) keeps an auto/generic name. Blacklist (case-insensitive):
^(Frame( \d+)?|Frame 1597\d+|Group \d+|Container|Rectangle \d*|Ellipse \d*|image \d+|Background(\+Border)?|Vector|Line \d*|Polygon \d*|Star \d*|Icon|Text|Main|Article.*|Component \d+|Layer_?\d*)$
The classifier NEVER returns null/skip for a blacklisted node. Never-null structural fallback:
- container 0 children + image fill →
img/photo - container 0 children no fill →
layout/empty - container 1 child pass-through →
layout/wrap - container ≥2 children →
layout/col(VERTICAL) /layout/row(HORIZONTAL) - leaf RECTANGLE/ELLIPSE →
img/*if image fill elseshape/rect|ellipse - leaf VECTOR →
icon/*Property-name blacklist:Property \d+→ rename to a semantic property name (icon,state,size). Re-scan at the end and loop mop-up untilgenerics = 0(publish the count).
N-media — Media detection
Any frame/rect with an IMAGE fill — including an EMPTY auto-layout frame used as a photo background — is MEDIA: img/cover, img/photo, media/cover-photo. Never Container / item/box / layout/*.
N-role — Real business semantics (layout/* cap)
layout/* is allowed ONLY if the node has no identifiable UI role, cannot be named by content, and cannot be flattened. Strict preference for business roles: card/, list/, item/, media/, nav/, header/, meta/, btn/, field/, heading/, caption/, stats/, story/, xp/. Gate: layoutPct ≤ 10% per screen; above that the naming pass loops (deeper role inference or flatten).
Family C — Components (gates: dupes, erroredSets)
C1 — Componentization mandatory
Any pattern repeated ≥3 times (structural similarity) → createComponentFromNode(canonical) + combineAsVariants + text properties on variable content, then swap copies to instances via DIFF-THEN-REPLACE. Never build synthetic masters; never recreate existing assets. Gate: dupes = 0.
C2 — Deep rebuild of masters (not shallow clone+rename)
Cloning a legacy component and only renaming/tokenizing it is insufficient — it leaves absolute, fixed, raw internals. Every master created or adopted must pass the Structure, Sizing and Tokens gates internally, recursing into its own nested sub-components:
- internal layout containers on auto-layout (S1),
- responsive sizing FILL/HUG + overlay constraints (Z1–Z3),
- raw styles bound, including nested masters (T2).
A master that ships with internal
layoutMode === "NONE", fixed sizing, or raw styles is a failure even if its name and top-level look correct.
C3 — Component-health
Scan all COMPONENT_SET (try { set.componentPropertyDefinitions } catch = errored set, usually inconsistent variant props: 1 vs 2 vs 3). Repair: collapse all variants to a single consistent property (rename variant children), then rename the generic property (Property 1 → semantic like icon) via editComponentProperty. Instances auto-reconcile by node identity (verify a sample). Gate: erroredSets = 0.
C4 — Remote / read-only masters → detach-to-localize
A remote library master (and its remote glyphs, e.g. Layer_1 / OEIL / Group) is read-only — you cannot auto-layout or tokenize it in place. Detect remote masters early (at scan). To reach a true zero on Structure/Tokens, localize: detachInstance → tokenize the now-editable internals → createComponentFromNode (figma-use-deep §13 detachAndTokenize). When localizing isn't wanted, flag the remote residual instead (it is not a blocking failure — mirrors in-remote raw styles, T2).
Family A — Accessibility & states (flag-level, never blocking)
Surface every finding; do not auto-resize/recolor (visual risk). Cite the WCAG source when a threshold is in doubt (a11y moves fast).
A-contrast — WCAG 2.2 AA (computed)
For each resolvable text/background pair, relative luminance:
- channel c (sRGB 0–1):
c_lin = c <= 0.03928 ? c/12.92 : ((c+0.055)/1.055)^2.4 L = 0.2126*R_lin + 0.7152*G_lin + 0.0722*B_lincontrast = (Llighter + 0.05) / (Ldarker + 0.05)- Thresholds: normal text ≥ 4.5:1, large (≥18pt or 14pt bold) ≥ 3:1, UI/non-text ≥ 3:1.
A-target — Touch targets
Interactive nodes ≥ 44×44 (note SC 2.5.8's 24px floor vs the 44px HIG recommendation; let project context decide).
A-focus — Focus visible
Interactive components expose a focus-visible variant that changes more than hue (SC 2.4.7 / 2.4.11).
A-states — Interactive & data states
Interactive components expose default/hover/focus/disabled. Data-driven views expose empty/loading/error. Missing → flag (or scaffold from the existing default state if the states phase is active).
Family X — Annotations & report
X-annot — Native annotations
Add native Figma annotations (node.annotations) for data source, ARIA role, conditional visibility, motion. Annotate masters for reusable specs; annotate instances only for instance-specific data. Guard: annotations throws on TEXT nodes.
X-report — Report conformity
The final report MUST publish every blocking-gate value from the table above (all green = pass), the list of flagged a11y/state items, in-remote raw/master flags (T2/C4), preserve-only fonts, the count of flagged redundant wrappers (S4), and confirmation that naming was screenshot-driven in context (N-shot). Each rule gets an explicit status done / N-A / flagged(reason). No applicable rule may be silently omitted.
X-emit — Emit a versioned handoff folder (not only Figma annotations)
Figma annotations and agent memory are volatile and unshared — they vanish when the file changes and the build/CI/second-plugin can't read them. So in addition to the native annotations, every pass emits a versioned, machine-readable handoff/ folder to the location chosen at launch (tokens.json, code-connect-map.json, screens.json, audit.json, HANDOFF.md, RETROSPECTIVE.md). code-connect-map.json is the official design→dev exchange format consumed by figma-to-code. Schemas and the bridge are defined in the figma-handoff-artifacts skill.
Figma defaults that are NOT violations
Do not flag or "fix" these — they are editor defaults, and touching them creates noise or regressions:
COMPONENT_SETwithlayoutMode === "NONE", ~5px corner radius, and a purple/violet dashed stroke — the variant-wrapper default. Excluded fromnonAL(Scan defs).- Leaf icon/glyph frames without auto-layout — graphics, not layout.
- Locked sublayers inside an instance — owned by the master; fix the master, not the instance.
Font availability (detect at scan)
The MCP environment can only write text in fonts it can load (typically Google Fonts). A non-catalogued brand font (e.g. Dunbar) cannot be re-typed.
- Detect at scan: list fonts in use; mark any the environment can't load as "preserve-only".
- Preserve: keep preserve-only text via
clone()/swapComponent()within the same lineage (overrides survive); never re-type it. To bake such text into a new master,detach+componentizerather than swap. - Flag: report preserve-only fonts so the desktop/editor handles those edits.
- Fonts the environment CAN load (e.g. Inter): normal edits and override re-application are fine.