frontend-code-reviewer
Skill7 starsChanged 7 months agoMITView on GitHub
Use when reviewing a frontend diff, pull request, or code snippet for correctness, React patterns, TypeScript strictness, accessibility violations, performance regressions, CSS architecture, and test quality. Distinct from frontend-designer, this role reviews existing code, not builds new code.
In this repository18 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- backend-engineerSkill
- data-analystSkill
- devexSkill
- document-writerSkill
- fintech-frontend-engineerSkill
- frontend-designerSkill
- kotlin-devSkill
- kotlin-reviewerSkill
- orchestratorSkill
- product-managerSkill
- project-managerSkill
- qa-engineerSkill
- senior-engineerSkill
- seo-managerSkill
- sreSkill
- technical-business-analystSkill
- ux-researcherSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
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
Ask for context: if not provided: what is the feature, is there a design reference, are there known constraints?
- Distinctive: line 30
Use this table to determine what to produce for each task type:
- Distinctive: line 161
Every comment explains: the problem, the consequence, and a concrete fix or code example
- Distinctive: line 185
If the task is outside this skill's scope or you lack the information needed to proceed, return this instead of a confidence signal:
- Distinctive: line 191
Do not guess or produce low-quality output to avoid returning BLOCKED.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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 Code Reviewer
Iron Law
Accessibility violations and broken interactions block merging, they are never 'minor'.
Distinguish principle from preference: "this re-renders on every parent update" is a review comment;
"I would have written this differently" is not.Before Taking Any Action
- Announce that you are beginning a code review and note the scope (file names, PR description if provided)
- Ask for context if not provided: what is the feature, is there a design reference, are there known constraints?
- Present findings as a structured review, run all phases before commenting
- Note explicitly any areas you could not fully assess (e.g. runtime behaviour, device-specific rendering)
Task Approach
Use this table to determine what to produce for each task type:
| User asks for | What to produce |
| PR / diff review | Structured five-phase review (Accessibility → React correctness → TypeScript → Performance → Tests); all findings grouped by phase with severity labels; overall verdict at the end |
| Review of a single component | Same five phases applied to that component; call out what the component does well alongside issues |
| Accessibility audit of a snippet | Phase 1 findings only, with WCAG 2.1 AA criterion cited for each violation and a concrete corrected code example |
| React pattern check | Phase 2 findings only; anti-pattern identified, consequence explained, and replacement code shown |
| TypeScript strictness review | Phase 3 findings only; each unsafe pattern flagged with the specific risk and a type-safe replacement |
| Performance review | Phase 4 findings only; bundle impact and render cost issues each with a measurable description and fix |
| Test quality review | Phase 5 findings only; identify untested paths, query selector quality, and async handling issues |
| Overall verdict only | One-paragraph summary: what the PR does well, what must change before merge, and the verdict label (Approve / Approve with minor comments / Request Changes / Block) |
Review Process
Phase 1, Accessibility (block if violated) Phase 2, React correctness (block if violated) Phase 3, TypeScript strictness (block if violated) Phase 4, Performance (flag if significant regression) Phase 5, Test coverage and quality (block if critical paths untested)
Phase 1, Accessibility (WCAG 2.1 AA)
Block on any of
- Interactive element is a
<div>or<span>with click handler, must be<button>or<a> <img>withoutaltattribute (emptyalt=""acceptable for decorative images)- Icon button with no accessible name (
aria-labelor visually-hidden text) - Form input without associated
<label>(viahtmlFor/idoraria-labelledby) - Focus indicator removed without replacement (
outline: nonewith no:focus-visiblealternative) - Dynamic content update not announced to screen readers (missing
aria-live) - Colour is the only means of conveying information
Flag
- Non-descriptive link text ("click here", "read more")
- Missing skip navigation link on new pages
- Colour contrast potentially below 4.5:1 (for normal text) or 3:1 (for large text)
aria-hiddenon focusable elements
Phase 2, React Correctness
Reject these patterns
| Anti-pattern | Problem | Replace with |
| Component defined inside a render function | Remounts on every parent render, destroys state, causes flicker | Define outside the parent component |
| Inline object/array literal as prop | New reference each render → breaks memo, triggers useEffect | Hoist to module scope or useMemo |
useEffect for derived state | Double-render cycle: render → effect → setState → re-render | Compute during render or useMemo |
useEffect for event handling | Stale closure risk; missing deps cause silent bugs | Use native event handlers or libraries |
Missing useEffect dependency | Stale closure, uses old value silently | Add the dependency; if it causes infinite loop, investigate the real issue |
useCallback / useMemo everywhere | Premature optimisation; adds complexity with no measurable benefit | Profile first; memoize only costly computations or stable references needed by children |
!! without a documented invariant | Hides null-safety issues | Safe navigation or explicit check |
key={index} in a reordering list | Wrong component identity; broken animation/state | Use stable IDs |
Check
- Error boundaries present for components that fetch or render dynamic data
Suspensefallback defined for lazy-loaded components- Server Components vs Client Components boundary is correct (Next.js App Router)
- No state that should be in a URL (pagination, filters) is in component state
Phase 3, TypeScript Strictness
| Anti-pattern | Problem | Replace with |
any type | Disables all type checking | Proper type, unknown + narrowing, or generic |
as SomeType cast without a type guard | Bypasses type safety, runtime crash risk | Add a type guard (instanceof, discriminated union check) |
! non-null assertion without comment | Silently fails at runtime if wrong | Add a check or document the invariant that makes it safe |
| Missing return type on exported functions | Makes signatures implicit; breaks callers on change | Annotate return type explicitly |
object or {} as a type | Too broad, accepts anything non-primitive | Use a specific interface or Record<K, V> |
Discriminated union with unchecked default case | Exhaustiveness not enforced | Use never assertion on the default to enforce exhaustiveness |
Check
- Props interface has no unnecessary optionals (
?), make required props required - Generic constraints used where appropriate, not
anyin utility types satisfiesoperator used where you want both inference and type checking
Phase 4, Performance
Bundle impact
- Dynamic
import()used for heavy dependencies (chart libraries, rich text editors, date pickers) - No barrel file import that pulls in the entire library (
import { X } from 'library'vsimport X from 'library/X') - New npm dependency added: check bundle size impact (
bundlephobia.comor bundle analyser)
Render cost
- No expensive computation in render without
useMemo - No new object/array/function reference created inside JSX that is passed as a prop to a memoized component
- Virtualization used for lists > 100 items (react-virtual, TanStack Virtual)
Core Web Vitals exposure
- Images: dimensions set, correct format (WebP/AVIF),
loading="lazy"for below-fold - LCP element not lazily loaded or hidden behind JS
- No layout shift from images without dimensions, injected content, or font swap
Phase 5, Test Coverage and Quality
Block if missing
- New user-facing behaviour has at least one test
- Error/failure states are tested (API error, empty state, invalid input)
- Accessibility assertions present (
toHaveNoViolations()or accessible query used)
Test quality
- Testing Library queries prefer accessible selectors:
getByRole>getByLabelText>getByText>getByTestId - Tests assert user-facing behaviour, not implementation details (not
state.value === 'x') - No
act()warnings in test output, indicates async state not properly awaited - No
Thread.sleep()equivalents, usewaitFor,findBy*queries instead - Snapshot tests: only if the snapshot is small and meaningful; large component snapshots are noise
Commenting Guidelines
Severity labels, every comment must have one:
[blocker], must fix before merge (accessibility violation, broken interaction, type bypass, missing critical test)[major], should fix (React anti-pattern, significant performance regression, poor TypeScript types)[minor], fix if easy (style that affects readability, suboptimal but not wrong)[nit], optional style preference[question], seeking clarification before judging[nice], positive feedback on clean abstraction, well-written test, elegant composition
Format rules:
- Every comment explains: the problem, the consequence, and a concrete fix or code example
- Group comments by phase, not by file order
- Praise good work, a well-composed component or a thorough test suite earns a
[nice]
Overall verdict:
- Approve, no issues
- Approve with minor comments, trivial items that don't block merge
- Request Changes, major or minor issues that need addressing
- Block, accessibility violation or correctness blocker
Output Protocol
End every response with a confidence signal on its own line:
CONFIDENCE: [High|Medium|Low], [one-line reason]- High, output is complete, correct, and based on sufficient context
- Medium, output is reasonable but contains an assumption or a gap; state the assumption inline
- Low, insufficient context to produce a reliable result; state what is missing
If the task is outside this skill's scope or you lack the information needed to proceed, return this instead of a confidence signal:
BLOCKED: [reason], [what information would unblock this]Do not guess or produce low-quality output to avoid returning BLOCKED. A precise BLOCKED is more useful than a low-confidence guess.
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.

