building-frontend-components
Skill8 starsChanged 9 months agoMITView on GitHub
Builds accessible, production-ready frontend components. Use when building UI components, forms, modals, or any React/Vue/Svelte frontend work — before writing component code.
In this repository6 other files it gives its agents.
- agent-councilSkill
- brainstormingSkill
- excel-toolkitSkill
- powerpoint-toolkitSkill
- writing-plansSkill
- writing-skillsSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 22
Do NOT skip this for "simple" components.
- Distinctive: line 84
Every component MUST handle:
- Distinctive: line 135
Before marking work complete:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Building Frontend Components
Iron Law
NO COMPONENT CODE WITHOUT PRE-IMPLEMENTATION CHECKLIST FIRST.
Wrote JSX before checking for existing design system components? Delete it. Styled before planning keyboard interaction? Delete it. These aren't optional steps.
Pre-Implementation Checklist
Before writing ANY component code:
- Check for existing design system — tokens, components, patterns already in repo
- Document component requirements — states (loading, error, empty), variants, accessibility needs
- Plan keyboard interaction — focus order, shortcuts, trap requirements
Do NOT skip this for "simple" components. Simple components have accessibility bugs too.
New project with no design system? See references/patterns.md → "Design Thinking" for direction-setting.
Framework selection guidance: See references/patterns.md → "Framework Selection".
Accessibility Essentials (Non-Negotiable)
Modal/Dialog Components
// REQUIRED attributes
<div
role="dialog"
aria-modal="true"
aria-labelledby="modal-title-id"
ref={dialogRef}
>
<h2 id="modal-title-id">{title}</h2>
</div>
// REQUIRED behaviors
// 1. Focus first interactive element on open
// 2. Trap focus within modal (Tab cycles inside)
// 3. Restore focus to trigger element on close
// 4. Close on Escape keyModals MUST implement focus trap. See references/patterns.md → "Focus Trap Implementation" for copy-paste hook.
Form Components
// REQUIRED: Link errors to fields
<input
id="email"
aria-invalid={errors.email ? 'true' : 'false'}
aria-describedby={errors.email ? 'email-error' : undefined}
/>
{errors.email && (
<span id="email-error" role="alert">
{errors.email.message}
</span>
)}
// REQUIRED: Form identification
<form aria-label="Login form">
{/* or aria-labelledby pointing to a heading */}
</form>Interactive Elements
| Element | Requirements |
| Button | Visible focus indicator, disabled state styling |
| Link | Underline or clear affordance, focus visible |
| Custom control | role, aria-* attributes, keyboard handler |
| Menu/Dropdown | aria-expanded, aria-haspopup, roving tabindex |
Component State Checklist
Every component MUST handle:
- Default — Normal display state
- Loading — Skeleton or spinner (avoid for <500ms operations)
- Empty — Meaningful empty state, not blank
- Error — Actionable message with recovery path
- Disabled — Visual indication +
aria-disabledordisabled - Focus — Visible focus indicator (never
outline: nonewithout replacement)
Anti-Patterns (Stop If You See These)
Generic AI Aesthetics
- ❌ Purple-on-white gradients with no context
- ❌ Cookie-cutter card layouts (centered hero + three icons)
- ❌ Flat solid backgrounds lacking atmosphere
- ✅ Honor existing design system OR establish distinctive direction
Technical Debt
- ❌ Inline styles scattered throughout (use CSS modules, Tailwind, or tokens)
- ❌ Magic numbers instead of design tokens
- ❌ Hardcoded colors like
#2563ebwithout token reference - ✅ Use CSS custom properties or design tokens
Accessibility Oversights
- ❌ Missing
role="dialog"andaria-modalon modals - ❌ No focus trap in modals/drawers
- ❌ Error messages without
role="alert" - ❌ Form fields without
aria-invalid/aria-describedby - ❌ Interactive elements without visible focus indicators
Common Mistakes from Baseline Testing
| What Agent Did | What Was Missing |
| Modal with Escape handling | No role="dialog", no focus trap, no focus restoration |
| Form with labels | No aria-invalid, no aria-describedby for errors |
| Error message display | No role="alert" for screen reader announcement |
| Inline styles | No design tokens, creates maintenance burden |
When NOT to Use This Skill
- Pure backend/API work with no UI
- Static content pages (use Astro or static HTML instead)
- Design system documentation (use the design system's own tooling)
Additional References
For error handling, styling standards, performance, and testing → see references/patterns.md.
Definition of Done
Before marking work complete:
- Pre-implementation checklist completed (design system check, requirements, keyboard plan)
- All states implemented (default, loading, empty, error, disabled)
- Keyboard navigation works (Tab, Shift+Tab, Enter, Escape, arrows)
- Screen reader announces all interactive elements
- Color contrast meets WCAG AA (4.5:1 text, 3:1 UI)
- Responsive at 360px, 768px, 1280px
- Works with 200% browser zoom
prefers-reduced-motionrespected- Error boundaries catch render failures
- No
anytypes, console logs, or TODOs remain - Tests pass (unit, a11y, visual if applicable)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

