Prompt file imported from JoseCortezz25/html-starter (
.claude/commands/figma-to-html.md). Copyright stays with the author.
figma-to-html
Stack: Vite, HTML, Tailwind CSS v4 (@theme tokens + BEM @apply), GSAP, Just-validate.
ALWAYS inspect the design with the Figma Desktop MCP (figma-desktop). Never guess values.
Always read first
src/styles/main.css— the@theme { }block is the single source of truth for colors, fonts, radius, and shadows..claude/knowledge/critical-constraints.md.claude/rules/styling.mdand.claude/rules/html-structure.md
Process
- Inspect the selected Figma frame (layout, variables, typography, spacing, assets). Take a screenshot for reference.
- Decompose it into Atomic Design levels: atoms (button, input), molecules (form-field, nav), organisms (page sections). Reuse existing components in
src/styles/components/**before creating new ones. - Tokens — for every Figma value:
- matching
@themevariable exists → use its utility (--color-accent→bg-accent); - reusable value without a token → add it to
@themeinsrc/styles/main.css(Figma aliasbrand/red→--color-brand-red); - one-off measurement → arbitrary utility inside
@apply(tracking-[0.3em]). Never arbitrary colors.
- matching
- Markup — write semantic HTML in the page file. Each component root gets
data-component="<level>/<name>"and the BEM block class. No inline styles; no long utility chains. - Styles — create
src/styles/components/<level>s/<name>.csswith@layer components { }and@apply; register it insrc/styles/main.css. - Behavior — motion →
src/scripts/animations/<organism>-animation.ts(insidegsap.matchMedia()); forms →src/scripts/forms/<form-name>.tswith messages insrc/scripts/messages/. Wire them insrc/main.ts. - Assets — export images/icons to
public/with kebab-case English names; decorative SVGs getaria-hidden="true". - Verify — run
pnpm typecheck && pnpm lint && pnpm build, then compare the page in the browser (Playwright or Chrome DevTools MCP) against the Figma screenshot at mobile and desktop widths.
Do not
- Do not add CSS comments or HTML comments describing the design.
- Do not use
var()or hex values in class lists. - Do not select elements in scripts by styling classes.
