/frontend:frontend-craftfrom frontend
Use when reviewing, rewriting, or generating HTML, CSS, or accessible frontend code. Guides DOM structure, CSS architecture, layout decisions, and accessibility patterns for clean, idiomatic, production-quality interfaces.
Ships in frontend. 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.
A comprehensive guide for writing clean, semantic, accessible frontend code. Covers CSS architecture, HTML structure, layout decisions, and accessibility — distilled from production codebases that prioritize readability, maintainability, and user experience.
Use this skill to review existing code for violations, rewrite messy code into clean patterns, or generate new frontend code that meets high standards from the start.
Each file is self-contained. You MUST read the relevant sub-file(s) before writing or editing code in that area.
| File | Read before... | Covers |
|---|---|---|
css-architecture.md | Writing or editing any CSS/stylesheet | Layers, custom properties, BEM naming, file org, component variants, state classes, dark mode, :has() patterns |
html-structure.md | Writing or editing any HTML template | Semantic elements, DOM flatness, div discipline, IDs vs classes, button vs link, native elements over ARIA, data attributes |
layout-and-spacing.md | Making any layout decision or adding spacing | Flexbox vs grid decision guide, spacing tokens, logical properties, clamp(), container queries, responsive patterns, gap vs margins |
accessibility.md | Adding any interactive element, icon, form, or keyboard behavior | ARIA, keyboard nav, focus management, screen reader text, :focus-visible, reduced motion, form accessibility |
component-patterns.md | Building cards, dialogs, forms, lists, toolbars, or trays | Named patterns: Card, Dialog, Disclosure, Form, Navigable List, Icon Button, Toolbar, Tray |
review-checklist.md | Reviewing or completing any frontend PR | Quick-scan checklist for all concerns — also included below |
<dialog> over JS modals, <details> over accordion JSNever style and structure at the same time. Build frontend in deliberate layers, getting user confirmation between steps. Each step must be correct before moving to the next.
1. DOM Structure → Correct semantic elements, flat nesting, proper hierarchy
2. Layout → Flex/grid, positioning, spacing, alignment
3. Font weight → Bold vs normal — establish what's important vs secondary
4. Font color → Ink vs subtle vs muted — reinforce the visual hierarchy
5. Font size → Scale — confirm heading/body/caption proportions
6. Decoration → Borders, shadows, backgrounds, border-radius, icons
7. Interaction → Hover, focus, transitions, animations
Why this order matters:
Ask the user after steps 1-2 and after steps 3-5. Don't assume what's important — the user defines hierarchy.
Within a single CSS rule, follow the same progression:
.card {
/* 1. Layout structure */
display: flex;
flex-direction: column;
position: relative;
z-index: 1;
/* 2. Sizing and spacing */
inline-size: 100%;
padding: var(--block-space) var(--inline-space);
gap: var(--block-space-half);
/* 3. Typography */
font-weight: normal;
color: var(--color-ink);
font-size: var(--text-normal);
text-align: start;
/* 4. Visual decoration */
background-color: var(--color-canvas);
border-radius: 0.5rem;
box-shadow: var(--shadow);
/* 5. Interaction */
transition: box-shadow 100ms ease-out;
}
Quick-scan checklist for reviewing frontend code.
<main>, <header>, <footer>, <nav>, <article>, <section>, <dialog>, <details>)<div> only used for layout wrappers, not for semantic content<body><a href="#"> or <div onclick> for interactive elements<dialog> not <div role="dialog">)@layer blocks — nothing unlayered.block__element--modifier — no camelCase, no single underscoresis- prefix (.is-expanded, .is-active)!important — use @layer ordering for specificityz-index without token (--z-popup, --z-nav, etc.)transition: allcurrentColor + mask-image) — not inline SVG per instancetext-wrap: balance on headings, text-wrap: pretty on paragraphsaccent-color on form inputs for themed native controlsgap on parents — not margins on children for inter-sibling spacinginline-size, block-start) — not physical (width, top)--inline-space, --block-space) — not px literalsclamp() — not breakpoint utility classes100dvh not 100vh for mobile viewportplace-content: center for centering single items:hover rules wrapped in @media (any-hover: hover) — touch-safe::before pseudo-element when visual size is smaller)overscroll-behavior: contain on scrollable modals/trays/panels#main as first focusable elementaria-labelaria-hidden="true"alt="":focus-visible styling on all interactive elements — never outline: none without replacementprefers-reduced-motion: reduce respected globally<input> has an associated <label> (via for/id or nesting)listbox, option, radiogroup, checkbox)aria-expanded or native <details><article> with <header>/<footer> — not all divs<dialog> element — not <div class="modal"><details>/<summary> where possiblerequired, pattern, type) before JS validationtype (submit or button)buttons.css → .btn).parent .child):has() used for state-dependent styling instead of JS class toggling| Red Flag | Fix |
|---|---|
<div class="header"> | Use <header> |
z-index: 999 | Use --z-* token |
margin-bottom: 16px on list items | Use gap on parent |
color: #3b82f6 | Use var(--color-link) |
outline: none on :focus | Use :focus-visible with ring |
| Icon button with no text | Add .visually-hidden span |
<a href="#" onclick="..."> | Use <button> |
width: 100% | Use inline-size: 100% |
height: 100vh | Use min-block-size: 100dvh |
.card .header selector | Use .card__header (BEM) |
!important | Rethink cascade / use @layer |
Empty alt on meaningful image | Write descriptive alt text |
tabindex="3" | Use 0 or -1 only |
transition: all 0.3s | List explicit properties + use duration token |
.card:hover without hover media query | Wrap in @media (any-hover: hover) |
| Small icon button with no tap expansion | Add ::before for 44px target |
| Scrollable modal without overscroll containment | Add overscroll-behavior: contain |
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub xu-chris/ai-setup --plugin frontend