Build production-ready frontend components with accessible markup, sensible props, defined states, and tested behavior. Use this skill whenever the user wants to build a component from scratch, refactor an existing one, design a component API, or implement a UI element with proper states and accessibility. Triggers on build a component, create a button, create a modal, create a form input, component API, props design, component states, refactor component, accessible component. Also triggers when implementing UI from a design that needs to be reusable.
8k tokens
context cost
the whole folder, loaded on every use
4
files
instructions only
0
copies elsewhere
how many repositories repackaged it
512
stars on the repo
on the repository, not the skill itself
Install
one command, takes just this skill from the repository
Every state needs visual treatment AND accessibility treatment.
4. Props / API
Design the component's contract.
API design principles:
Required props minimal. What's truly needed every time? That's required. Everything else has a sensible default.
Boolean props are red flags. Three booleans means seven combinations. Prefer enum strings: variant: "primary" | "secondary" | "ghost" over primary={true} ghost={false}.
Children > props. Where content is content, accept children. Don't invent headerText and bodyText props when slots work.
Composition > configuration. A component that does 5 things via 12 props often should be 5 smaller components.
Type the props. TypeScript or PropTypes or JSDoc. The type is documentation that won't go out of date.
5. Accessibility
Build it accessible from the start. Adding accessibility later is 5x harder.
Universal:
Semantic HTML elements (<button>, <a>, <nav>, <form>, etc.) over generic <div>
Keyboard navigable (Tab, Shift+Tab, Enter/Space for buttons)
Focus visible
Tap targets minimum 44 by 44 pixels
ARIA only where semantic HTML is insufficient
Component-specific:
Button: use <button>. Don't fake one with a <div>.
Modal: focus trap, ESC to close, returns focus to trigger on close, role="dialog" and aria-labelledby.
Form input: label associated via for/id or aria-labelledby. Error messages linked via aria-describedby. aria-invalid when in error state.
Toggles:<button> with aria-pressed for two-state, or role="switch" for on/off.
Tabs:role="tablist" / role="tab" / role="tabpanel" with aria-selected and arrow-key navigation.
Tooltips and popovers: triggered by focus AND hover. Dismissible with ESC.
Loading states: announce with aria-live so screen readers know something changed.
6. Tests
Verify the component works before declaring it done.
Test types by priority:
Visual regression. Renders correctly across variants and states. (Storybook + visual diff tools, or manual screenshots.)
Accessibility. Passes axe or equivalent automated checks.
Keyboard navigation. Tab, Enter, Escape, arrow keys all work as expected.
Component logic. Props produce expected output. Events fire correctly. (Unit tests.)
Integration. Component works inside its expected parent contexts.
A component without at least automated accessibility testing is not done.
Workflow
Understand the use case. What UI need does this component serve? Where will it appear? Adjacent components?
Sketch the anatomy. Name the parts.
List variants and states. Match the design system or define new ones if needed.
Design the API. Required props, optional props, children, events. Type it.
Build the markup with semantic HTML. Choose the right elements. Avoid generic <div> for interactive things.
Style with tokens. No hardcoded colors, spacing, or sizes.
Building with <div onClick>. Loses keyboard accessibility, screen reader semantics, and focus. Use <button> or <a>.
Hardcoding colors and sizes. Tokens exist for a reason. Hardcoded values resist theming and consistency.
Boolean prop explosion.<Button primary large rounded fullWidth disabled icon />. Too many booleans means you actually need fewer variants designed more thoughtfully.
Forgetting focus states. Hover gets attention; focus gets neglected. Keyboard users see invisible buttons.
Skipping disabled-state thought. A disabled button should look obviously disabled AND be aria-disabled AND not respond to clicks.
Inventing ARIA. ARIA roles and properties have specific behaviors. Made-up ARIA is worse than no ARIA. Use semantic HTML first.
Loading state that doesn't announce. Screen readers don't know the spinner appeared. Use aria-live="polite" or role="status".
Tooltip-only critical content. Hover-only content is invisible to keyboard and touch users. Critical content goes in the visible UI.
Component without docs. Future-you, your teammate, or the next maintainer cannot use what they cannot understand.
Output format
A complete component delivery includes:
Component code (in the appropriate framework)
Storybook (or equivalent) entry showing all variants and states
Documentation:
Anatomy diagram or description
Props/API table
Usage examples (basic, advanced, edge cases)
When to use vs. when to use an alternative
Anti-patterns (what to avoid)
Accessibility notes
Tests (visual regression + accessibility + logic)
Reference files
references/component-spec-template.md - Template for documenting a component (props, states, accessibility, edge cases) before building.
references/component-api-patterns.md - Common patterns for designing flexible component APIs (compound components, controlled vs uncontrolled, polymorphic as prop, render props, slots).
references/accessibility-patterns.md - ARIA patterns for common interactive components.
How to use it
Copy the folder
Take rampstackco/frontend-component-build from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
Check the name does not clash
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.