bitovi/ai-enablement-prompts/10-validator
Claude Code and agent skill by bitovi/ai-enablement-prompts
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Standalone validator for a completed figma-from-code rebuild. Navigates the live app, screenshots each component in its natural context, and compares against the matching Figma variant. Also used by the Phase 5 orchestrator agent as a reference for the Component App Map and comparison scripts.
Install
npx vskill@latest install bitovi/ai-enablement-prompts/10-validatorSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
Skill: Figma Rebuild Validator
Validates the output of figma-from-code by navigating the live app, screenshotting each component in its natural context, and comparing against the matching Figma variant — not the entire component set. Produces a structured report with side-by-side screenshots.
This skill can be used two ways:
- Standalone: Run directly to validate a completed rebuild (all phases below)
- As a reference for Phase 5: The orchestrator's Phase 5 agent reads this skill for the Component App Map, variant resolution logic, and structural QA scripts
When to Use
- After running
figma-from-codeto verify the output (standalone) - When auditing whether Figma components match their React implementations
- When the orchestrator's Phase 5 agent needs the Component App Map or comparison scripts
Prerequisites
Placeholders like{devServerUrl}and{skillRoot}resolve fromstate.json → config.
- Figma MCP must be connected and authenticated
- Dev server must be running at
{devServerUrl}— use the URL fromstate.json → config.devServerUrl(defaulthttp://localhost:5173) .temp/figma-from-code/state.jsonmust exist (produced byfigma-from-code)compare.jsfor pixel diff is vendored at{skillRoot}/scripts/compare.js
Workflow
Phase 1: Build Component Inventory
Step 1a — Read state file
Extract fileKey.
Step 1b — Query Figma for all components
Step 1c — Classify each component
Use the Component App Map below to assign each component a url, selector, optional click action, and figmaVariant (the variant properties that match what's rendered in the app).
Step 1d — Check dev server
If not_running: halt and tell the user to run the dev server.
Print the classification to the conversation:
Phase 1e: Variant Node Resolution
This is the key step that ensures Figma screenshots match the app variant.
For every component whose type === 'set' and that has a figmaVariant specified in the Component App Map, resolve the specific child variant node ID before taking screenshots.
What this solves
Without this step, get_screenshot(fileKey, setNodeId) returns an image of all variants tiled in the component set — not the single variant that the app is rendering. Resolving to the child node gives an apples-to-apples comparison.
Resolution script (run once per component set)
Store the resolved `variantNodeId` for each component. Use this in Phase 2 when calling get_screenshot.
Handling multiple app variants for one component
Some components appear in multiple variants in the app (e.g., Button appears as primary on form submit and ghost in menus). For these, create two entries in the comparison table:
| Entry | App Variant | Figma Variant Props | |
|---|---|---|---|
| Button (submit) | button[type="submit"] on the create form page | {Variant: "primary", Size: "regular"} | |
| Button (menu action) | [data-radix-dropdown-menu-content] button on list page | {Variant: "ghost", Size: "small"} |
Component App Map
The Component App Map assigns each Figma component a URL, Playwright CSS selector, optional click/hover action, and Figma variant properties for comparison targeting.
This map is built dynamically during Phase 1c from the component-map.json output (Phase 0a). It is NOT hardcoded.
The screenshot script is: {skillRoot}/scripts/screenshot.js
Usage:
Flags:
--selector— CSS selector for the element to screenshot--click— click this element before screenshotting (opens overlays, enters edit mode)--hover— hover over this element before screenshotting (reveals tooltips, hover cards)--variant— label printed in output for logging (no effect on screenshot)--nth N— use the Nth matching element (0-indexed)
Batch manifest entries additionally support fallbackSelectors (ordered alternates tried when the primary selector times out — the output line notes which one was used) and click as an ordered array for multi-step interactions.
Building the Map
For each component discovered in component-map.json, prefer its capture object — it records the exact URL, validated selector, ordered fallbackSelectors, and the interaction replay recipe (clicks array + hover) from discovery time. Use capture.url verbatim; never pair a selector with a different route than the one it was derived on.
For legacy maps without capture:
- URL: Use the route(s) where the component appears (from
component-map.json -> routes) - Selector: Use the best CSS selector (from
component-map.json -> selector). Prefer[data-component="Name"],[aria-label="..."], or class-based selectors - Click action: If the component requires interaction to become visible (overlays, dropdowns, edit modes), specify a click selector
- Hover action: If the component requires hover to reveal (tooltips, hover cards), specify a hover selector
- Figma variant: The variant properties that match the app's default rendering (e.g.,
{Variant: "primary", State: "Default"})
Selector Strategy by Component Type
| Component Type | Selector Strategy | Example | |
|---|---|---|---|
| Always visible (nav, header, sidebar) | aria-label or semantic HTML | header[aria-label="Main navigation"] | |
| List panels | Class-based width selectors | [class*="w-[200px]"] | |
| Detail panels | Flex layout selectors | [class*="flex-1"][class*="flex-col"] | |
| Form inputs | Input type + placeholder | input[placeholder="..."], textarea | |
| Buttons | Type or role selectors | button[type="submit"], a[href="..."] | |
| Inline editing | Click to enter edit mode | --click "h1" then screenshot the input | |
| Overlays/dialogs | Click trigger, screenshot overlay | --click "button[aria-label='...']" then [role="dialog"] | |
| Embedded components | Parent context selectors | [class*="ComponentName"] |
Components Not Directly Visible in App
Some components are not rendered by default and require special handling:
| Type | Reason | Capture Strategy | |
|---|---|---|---|
| Loading states (e.g., Skeleton) | Only visible during data fetch | Capture during initial page load before data arrives | |
| Error states (e.g., Alert) | Only visible on errors | Simulate a network error | |
| Hover components (Tooltip, HoverCard) | Requires hover | Use --hover "trigger-selector" | |
| Click-to-reveal (Calendar, Popover) | Requires interaction | Use --click "trigger-selector" | |
| Embedded primitives (Badge, Checkbox) | Only inside parent components | Screenshot parent, or open container first | |
| Not used in UI | Component exists but not rendered | Skip — note as not_visible in report |
For hover-only components, use Playwright's .hover() API in a custom script rather than the --click flag.
Phase 2: Screenshot Pairs (Sequential by Tier)
Process all tiers sequentially inline. For each tier, handle every component: check for pre-built screenshots, capture app + Figma screenshots, run the pixel diff. Components within a tier share URLs, so reuse a single Playwright page load per URL where possible.
Per-Tier Process
For each tier in state.json -> buildOrder.tiers, process all components using Steps 2a–2e below. After completing a tier, write results to .temp/figma-validation/tier-{N}-results.json:
Collecting Results
After all tiers are processed, read each tier-{N}-results.json and merge into a single component list for Phase 3/4. Components with verdict: "mismatch" or verdict: "minor_diff" are candidates for Phase 5 fixes.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/figma-from-code/skills/figma-from-code/10-validator/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/bitovi/ai-enablement-prompts/10-validator)