frontend-component-audit
Skill0 starsChanged 4 months agoMITView on GitHub
Audit a React/Next.js component or codebase for accessibility, performance, and consistency issues before shipping — checks re-render patterns, prop drilling depth, missing memoization, unhandled loading/error states, and WCAG violations. Use whenever the user shares a component file and asks to "review this", "is this production-ready", "why is this slow", "check this for accessibility", or before merging a PR that touches shared UI components. Also trigger proactively when generating new components if the user's codebase context suggests these standards apply (TypeScript strict mode, existing design system usage).
In this repository6 other files it gives its agents.
- changelog-generatorSkill
- competitive-teardownSkill
- github-readme-generatorSkill
- meeting-action-itemsSkill
- resume-tailorSkill
- sec-filing-analyzerSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
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 28
Every data-driven component needs explicit handling for: loading, empty, error, and success.
≈ “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
Frontend Component Audit
A structured pass over a React/Next.js component that catches the issues code review usually misses on a quick skim: re-render cascades, silent accessibility gaps, and missing edge-case states.
When this earns its keep
Skip this for trivial components (a styled <Badge> with no state). Use it for anything with data fetching, forms, lists, or user input — where bugs are invisible until a specific interaction path is hit.
Audit passes (run in this order)
Pass 1 — Correctness of state & effects
- Does every
useEffecthave a complete, correct dependency array? Flag missing deps and deps included only to silence the linter (stale closures either way) - Are there race conditions in async effects — e.g. a fetch that doesn't check if the component is still mounted / the request is still the latest before setting state?
- Is derived state stored in
useStatewhen it could be computed inline or viauseMemo? (Redundant state is a common source of "the UI is out of sync" bugs)
Pass 2 — Performance
- Unmemoized callbacks/objects passed as props to memoized children (defeats
React.memo) - Expensive computation in the render body without
useMemo - Missing
keyor unstablekey(array index on a reorderable list) causing unnecessary remounts - Context value objects recreated on every render, causing all consumers to re-render regardless of
memo
Pass 3 — Missing states
Every data-driven component needs explicit handling for: loading, empty, error, and success. Flag any component that only handles the happy path — this is the single most common gap in first-draft components.
Pass 4 — Accessibility (WCAG 2.1 AA baseline)
- Interactive elements are real
<button>/<a>, not<div onClick> - Form inputs have associated
<label>(explicithtmlFor, not just placeholder text) - Focus is managed on route change / modal open (focus trap, return focus on close)
- Color is not the only signal for state (error/success) — check for icon or text accompaniment
- Images/icons used as sole content have
alttext oraria-label
See references/wcag-checklist.md for the fuller checklist when doing a dedicated a11y pass.
Pass 5 — Consistency with codebase conventions
- Does this match existing patterns in the codebase (data-fetching library, styling approach, naming) rather than introducing a new pattern for one component?
- TypeScript: are props actually typed, or is
any/unknownpapering over a real type?
Output format
Report findings grouped by pass, each with: severity (blocker / should-fix / nice-to-have), location (line reference), and concrete fix (a code snippet, not just a description of the problem). Don't just list problems — show the diff.
Reference
references/wcag-checklist.md— extended accessibility checklist for dedicated a11y audits
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.

