Use when converting Figma designs to WordPress FSE block themes. Orchestrates autonomous workflow from design token extraction through pixel-perfect template generation. Keywords: Figma to WordPress, FSE conversion, design tokens, autonomous template generation, pixel-perfect FSE
Figma-to-FSE Autonomous Workflow
Overview
This skill orchestrates the complete autonomous conversion of Figma designs into WordPress Full Site Editing (FSE) block themes. It bridges Figma design systems with WordPress theme.json, enabling single-prompt conversion of 1-15 templates without "should I continue?" interruptions.
Core Innovation: Hybrid approach with brief clarification phase (1-2 min) followed by fully autonomous execution using superpowers:executing-plans.
Key Principle: Design system FIRST → theme.json foundation SECOND → templates THIRD → verification FOURTH. Extract ALL design tokens wholesale before generating any templates.
When to Use
Use this skill when:
Converting Figma designs to WordPress FSE themes
Building WordPress themes from design mockups
Generating pixel-perfect FSE templates from Figma
Extracting Figma design systems to theme.json
Autonomously creating multiple FSE templates
Trigger phrases:
"Turn Figma designs into FSE templates"
"Convert Figma to WordPress"
"Generate FSE theme from Figma"
"Pixel-perfect FSE conversion"
"Figma to theme.json"
"Extract Figma design system"
When NOT to use:
Classic WordPress themes (non-FSE)
Plugin development
Simple CSS changes to existing themes
Designs not in Figma
Prerequisites
Before starting, verify:
Figma MCP configured (.mcp.json has figma-desktop or figma server)
Figma file URL or desktop app open with Dev Mode enabled
Critical: If Figma MCP not accessible, STOP and inform user before proceeding.
⚠️ CRITICAL: File Location Requirements
This project uses ROOT-LEVEL folders for theme development:
project-root/
└── themes/[theme-name]/ ← ALL theme files go HERE (NOT wp-content/themes/)
PRE-FLIGHT VALIDATION (Run BEFORE any file writes):
Before creating or modifying ANY theme files, verify:
themes/ directory exists at project root
NO files being created in wp-content/themes/ (NEVER use this path)
Theme name slug is valid (lowercase, hyphens only, no spaces)
Auto-validation: the registered PreToolUse hook .claude/hooks/validate-theme-location.sh blocks incorrect paths (a copy also lives at scripts/figma-fse/validate-theme-location.sh).
Why root-level?
Clean development structure (no nested wp-content)
Easier version control
Testing copies files to WordPress wp-content/ separately
Deployment Note: During testing, files are copied from themes/ to WordPress wp-content/themes/. See TESTING-GUIDE.md for deployment procedures.
Fallback Design Tokens (Default Design System)
CRITICAL: When Figma design system is unavailable, incomplete, or cannot be extracted, use these professional fallback defaults. This ensures the workflow NEVER blocks on missing design systems.
Fallback Color Palette (13 tokens)
All colors are WCAG AA compliant with appropriate contrast ratios:
⚠️ CRITICAL: After downloading Figma assets (images with hash filenames), you MUST view every image file to identify what it depicts BEFORE any template or pattern generation begins. Subagents cannot guess image content from hash filenames.
Procedure:
View every downloaded image using the Read tool (which renders images visually):
For each PNG/JPG in themes/{theme-name}/assets/images/:
Read the file → describe what it shows
For each SVG in themes/{theme-name}/assets/images/:
Read the file → identify what icon/logo it is
Create semantic mapping file at .claude/figma-data/asset-semantic-mapping.json:
{"images":{"abc123def456.png":{"description":"Group photo of lodge members in regalia with flags","semantic_name":"hero-group-photo","suggested_usage":["hero section","about page header"]},"789xyz000111.png":{"description":"Masonic square and compass symbol on black background","semantic_name":"masonic-symbol","suggested_usage":["what-is-masonry section","decorative"]}},"icons":{"aaa111bbb222.svg":{"description":"Facebook social media icon","semantic_name":"icon-facebook"}}}
Provide the semantic mapping to ALL subagents implementing templates/patterns. Include the full mapping in every subagent prompt so they reference images by verified content, not guessed associations.
Why this is mandatory:
Hash filenames (e.g., 1dc507e8bed...png) reveal nothing about image content
Subagents will assign wrong images to wrong sections if they guess
A lodge seal assigned as a hero photo, or a dinner photo used for a scholarship section, produces obviously wrong results that undermine user trust
This step takes 2-3 minutes but prevents hours of debugging
NEVER skip this step. NEVER let subagents guess image assignments.
Check context: If approaching 80% context limit → trigger checkpoint (see Context Management)
Extract Structure with Error Recovery:
Try:
structure = get_code(template_node_id)
Log: "✓ Structure extracted via get_code"
Catch annotation error:
Log: "⚠ get_code failed (annotations detected), falling back to image analysis"
image = get_image(template_node_id)
structure = analyze_image_for_blocks(image)
Log: "✓ Structure extracted via visual analysis"
Catch connection error:
Log: "❌ Figma MCP connection failed"
Try remote MCP fallback
If both fail: STOP (blocker)
Continue: (don't stop for non-blocker errors)
Extract Figma Component Attributes (Phase 3):
For each component in template:
a. Extract design properties from Figma:
- Layout: padding, margin, gap, width, height
- Typography: font-size, font-weight, line-height, letter-spacing
- Visual: border-radius, border-width, opacity, box-shadow
- Colors: fill, stroke, background (exact hex values)
b. Match to theme.json tokens:
- Exact match (padding: 24px → spacing-50: 24px): Use token slug
- Close match (padding: 26px → spacing-50: 24px): Use closest token, log 2px discrepancy
- No match:
- If used 3+ times: Add new token to theme.json
- If used 1-2 times: Use inline style
c. Track comparison data:
- Component name
- Property name
- Figma value
- Template value (token or inline)
- Match type (exact/close/new token/inline)
- Recommendation (if mismatch)
Generate FSE Template:
Use WordPress block markup (HTML comments)
Apply matched theme.json tokens from attribute extraction
Use inline styles only when no suitable token exists
Semantic HTML structure (header, main, footer, nav, article, aside)
Alt text for images (extract from Figma or use placeholder)
Keyboard navigation support
Heading hierarchy (h1 → h2 → h3, no skipping levels)
Save Attribute Comparison Data (Phase 3):
Create `.claude/figma-data/` directory if not exists
Save per-template data to `.claude/figma-data/{template-name}-attributes.json`:
{
"template_name": "front-page.html",
"total_attributes_checked": 45,
"matched_attributes": 42,
"mismatches": [
{
"component": "Hero Button",
"property": "padding",
"figma_value": "24px",
"template_value": "16px (spacing-40)",
"recommendation": "Use spacing-50: 24px or add spacing-45: 24px"
}
],
"exact_matches": 40,
"close_matches_used": 2,
"new_tokens_added": 0
}
Aggregate into `.claude/figma-data/attribute-comparison.json` (all templates)
This data will be read by generate-comparison-report.sh
Validate & Hook Execution:
Run .claude/hooks/figma-fse-post-template.sh (if exists)
Check for hardcoded hex colors (should be ZERO)
Check for hardcoded pixel sizes (should be ZERO)
Verify block syntax (balanced open/close tags)
If validation failures: Log to errors.log, continue anyway
Update Progress:
Add template to templates_completed[]
Remove from templates_remaining[]
Log: "✓ Template {X} of {N} complete: {template-name}"
NO "should I continue?" prompt to user
Checkpoint Check:
If (templates_completed.length % 3 == 0): Trigger episodic memory checkpoint
Continue to next template without waiting
Continue to Next Template (NO prompt to user)
Step 2.5: Create Block Patterns
Identify repetitive sections that can become patterns:
If failures occur: Log them but complete remaining templates.
Step 2.7: MANDATORY Visual Verification Loop
⚠️ CRITICAL: After all templates and patterns are generated, you MUST render the actual site in a browser and compare screenshots against the Figma designs. Code review alone is NOT sufficient - it cannot catch wrong images, broken layouts, or visual regressions.
Procedure:
Start local WordPress environment:
./wordpress-local.sh start
# Install WP-CLI if needed
docker-compose exec wordpress bash -c "curl -sO https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && chmod +x wp-cli.phar && mv wp-cli.phar /usr/local/bin/wp"# Install WordPress if needed
docker-compose exec wordpress wp core install --url="http://localhost:8080" --title="Site" --admin_user=admin --admin_password=admin --admin_email=admin@example.com --allow-root
# Activate theme
docker-compose exec wordpress wp theme activate {theme-name} --allow-root
# Create pages with correct slugs and template assignments# Set front page, set permalinks
For EACH page template, run the verification loop:
For each page (home, about, contact, etc.):
a. Navigate browser to page URL (mcp__playwright__browser_navigate)
b. Take full-page screenshot (mcp__playwright__browser_take_screenshot fullPage=true)
c. Get Figma screenshot of same page (figma MCP: get_screenshot)
d. View both screenshots side-by-side (Read tool on screenshot file)
e. Compare section-by-section:
- Are the correct images in the correct sections?
- Do layouts match (columns, grids, alignment)?
- Are colors/backgrounds correct?
- Is typography rendering properly?
- Are full-bleed sections actually full-bleed?
f. Log differences found
g. Fix any issues directly in the template/pattern files
h. Reload and re-verify until the page matches
Minimum verification checklist per page:
Hero/header image is the CORRECT image (not just "an image")
Section backgrounds match Figma (dark/light/muted)
Column layouts render side-by-side (not stacked)
Full-bleed images go edge-to-edge (no padding)
Text is readable (correct colors on backgrounds)
Buttons are visible and styled correctly
Footer renders with all elements
Create verification report at .claude/reports/visual-verification.md:
# Visual Verification Report## Page: Home (front-page.html)- Screenshot: [path]
- Figma match: 95%
- Issues found: 2
- Hero image was lodge seal instead of group photo → FIXED
- CTA image not full-bleed → FIXED
- Final status: PASS
## Page: About (page-about.html)
...
Iteration rules:
If a page has visual issues, fix them and re-verify
Maximum 3 iteration rounds per page (if still failing after 3, log and move on)
Do NOT declare the theme complete until at least the homepage passes visual verification
Image mismatches are ALWAYS fixed (never acceptable)
Layout issues that affect readability are ALWAYS fixed
Minor spacing differences (< 8px) can be logged as acceptable
Why this is mandatory:
Code review cannot detect wrong images (hash filenames all look the same in code)
Layout bugs only manifest when rendered in a real browser
Full-bleed issues depend on WordPress CSS cascade, not just markup
This is the difference between "code that looks correct" and "a site that looks correct"
NEVER skip visual verification. NEVER declare the theme complete based on code review alone.
Step 2.8: Generate Comparison Report
Create .claude/reports/figma-fse-comparison.md:
Templates converted count
Design tokens used count
Zero hardcoded values verification
Quality checks results
Screenshots comparison (Figma vs rendered)
Visual verification results (from Step 2.7)
Issues log
Phase 3: Completion & Handoff
Step 3.1: Present Results
✅ Conversion complete!
Your FSE theme is ready at: themes/<theme-name>/
Summary:
- X templates created
- 0 hardcoded values (100% theme.json tokens)
- Fully responsive (mobile/tablet/desktop)
- Accessibility attributes included
- Quality checks: [pass/fail summary]
Next steps:
1. Review theme in WordPress admin
2. Test templates with real content
3. Adjust spacing/colors in theme.json as needed
See detailed report: .claude/reports/figma-fse-comparison.md
NO "should I continue?" during Phase 2-3. Work autonomously until complete or blocked.
Figma MCP Integration
Tool: get_variable_defs
Purpose: Extract design tokens from Figma design system
Usage:
When: Phase 1.2 - Design system extraction
Input: Design system page/frame node ID
Output: JSON of all variables (colors, typography, spacing)
Critical: Extract COMPLETE system wholesale, not selectively.
Tool: get_image
Purpose: Visual reference and fallback when get_code fails
When: Phase 2.4 - Template conversion
Input: Template/component node ID
Output: HTML/CSS structure
Known issue: Fails if Figma annotations present
Workaround: Fallback to get_image analysis
Error Recovery Pattern:
Try:
result = get_code(node_id)
Catch error:
Log: "get_code failed for {node_id}, using visual analysis"
image = get_image(node_id)
Analyze image → generate blocks
Continue: (don't stop execution)
Tool: get_code_connect_map
Purpose: Link Figma components to existing code components
Usage:
When: Phase 1.5 - If theme has existing component library
Input: Figma file key
Output: Mapping of Figma nodes to code paths
Optional - only if integrating with existing theme.
Error Recovery (Autonomous)
Pattern: Log errors, try alternatives, NEVER stop to ask user.
Error: Figma MCP Unreachable
If: Connection to Figma MCP fails
Then:
- Try both desktop (port 3845) and remote (mcp.figma.com)
- Log error to .claude/reports/errors.log
- If both fail: STOP and inform user (blocker)
Problem: 6-15 templates can exhaust context window (200K tokens)
Solution: Episodic memory checkpointing every 3 templates
Checkpoint Trigger Conditions
Trigger checkpoint when:
Template count divisible by 3 (templates_completed % 3 == 0)
Context approaching 80% limit (~160K tokens used)
Before switching to complex templates (e.g., before archive.php with loops)
Checkpoint Procedure
Step 1: Prepare Checkpoint Data
Create checkpoint object with all critical state:
{"checkpoint_id":"figma-fse-{theme-name}-{timestamp}","theme_name":"{theme-name}","total_templates":12,"templates_completed":[{"name":"header.html","status":"complete","blocks":8,"issues":[]},{"name":"footer.html","status":"complete","blocks":5,"issues":[]},{"name":"index.html","status":"complete","blocks":12,"issues":[]}],"templates_remaining":[{"name":"front-page.html","priority":3,"figma_node_id":"123:456"},{"name":"page.html","priority":3,"figma_node_id":"123:457"},{"name":"single.html","priority":3,"figma_node_id":"123:458"},// ... remaining templates],"design_system":{"colors":["primary","secondary","white","black","..."],"font_sizes":["small","base","medium","large","xl"],"spacing":["20","30","40","50","60","70","80","90"],"theme_json_path":"themes/{theme-name}/theme.json"},"component_patterns":{"hero_sections":"Cover block with columns","card_grids":"Columns with Group blocks","testimonials":"Quote block in Group"},"errors_encountered":[{"template":"index.html","error":"get_code failed","resolution":"used get_image fallback"}],"figma_file":{"url":"{figma-url}","design_system_location":"Design System page"}}
Step 2: Save to Episodic Memory
# Use episodic-memory plugin to save checkpoint
/episodic-memory:save "Figma-to-FSE checkpoint: {theme-name}, completed {X} of {N} templates"# Include full checkpoint data in the save
Step 3: Log Checkpoint
echo"📌 CHECKPOINT: Template {X} of {N} complete" >> .claude/logs/figma-fse-checkpoints.log
echo"State saved to episodic memory: checkpoint_id={checkpoint_id}" >> .claude/logs/figma-fse-checkpoints.log
Step 4: Continue Immediately
Do NOT wait for user confirmation
Do NOT pause execution
Checkpoint is non-blocking
Move immediately to next template
Resumption Procedure (If Session Interrupted)
If conversion interrupted and user returns:
Step 1: Detect Incomplete Conversion
User: "Continue converting my Figma templates"
Claude: Uses episodic-memory:search to find recent checkpoint
Search query: "Figma-to-FSE checkpoint {theme-name}"
Claude: "I found a checkpoint from [timestamp]:
- Completed: {X} templates (header, footer, index, ...)
- Remaining: {Y} templates (front-page, page, single, ...)
Resuming autonomous conversion from template {X+1}..."
[Continue with Step 2.4 loop from checkpoint.templates_remaining[0]]
Step 4: NO Re-Discovery
Do NOT re-extract design system (use checkpoint.design_system)
Do NOT re-survey templates (use checkpoint.templates_remaining)
Do NOT ask for plan approval again
Jump directly to Step 2.4 autonomous loop
Context Window Management
Monitor context usage:
After each template:
estimated_tokens = (templates_completed * avg_tokens_per_template)
if estimated_tokens > 160000: # 80% of 200K limit
Trigger checkpoint
Consider: Summarize previous templates to save context
Context-saving strategies:
Checkpoint every 3 templates (before hitting limit)
User: "Turn all Figma designs into FSE templates"
[provides Figma URL]
Claude: "I'm using the figma-to-fse-autonomous-workflow skill."
Phase 1: Discovery
"First, where is your design system in the Figma file?
(Common locations: 'Design System' page, 'Styles' page)"
User: "It's on the 'Design System' page"
Claude: [Extracts complete design system with get_variable_defs]
[Translates to theme.json]
[Surveys templates with get_image]
[Creates component mapping]
[Generates implementation plan]
"✅ Design system extracted:
- 12 colors
- 8 font sizes
- 9 spacing tokens
Found 8 templates to convert:
- Homepage
- About
- Services
- Contact
- Blog
- Single Post
- Archive
- 404
I'll create a complete FSE theme with pixel-perfect
templates using theme.json tokens exclusively.
Proceed with autonomous conversion?"
User: "Yes"
Claude: [Invokes superpowers:executing-plans]
[45 minutes of uninterrupted work]
"✅ Conversion complete!
Your FSE theme is ready at: themes/my-theme/
- 8 templates created
- 0 hardcoded values (100% theme.json tokens)
- Fully responsive
- Accessibility included
- Quality checks passed
See: .claude/reports/figma-fse-comparison.md"
Next Steps After Conversion
For User:
Install WordPress locally (if not already)
Activate theme in WordPress admin
Test templates with real content
Adjust colors/spacing in theme.json (not templates)
Add custom functionality in functions.php (if needed)
For Claude:
If user requests changes: Update theme.json (design tokens)
If templates need fixes: Regenerate using updated tokens
If new templates needed: Follow same workflow
If patterns needed: Use block-pattern-creation skill
Status: Phase 3 implementation complete (attribute-level validation, token matching, comparison reporting)
Version: 3.0.0
Last Updated: 2026-01-21
Supports: 1-15 templates with autonomous checkpointing every 3 templates + attribute validation