agentleFS
pranav8494pranav8494/team-of-agents/skills/frontend-code-reviewer/SKILL.md

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.

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
  1. Distinctive:

    Ask for context: if not provided: what is the feature, is there a design reference, are there known constraints?

    line 22
  2. Distinctive:

    Use this table to determine what to produce for each task type:

    line 30
  3. Distinctive:

    Every comment explains: the problem, the consequence, and a concrete fix or code example

    line 161
  4. Distinctive:

    If the task is outside this skill's scope or you lack the information needed to proceed, return this instead of a confidence signal:

    line 185
  5. Distinctive:

    Do not guess or produce low-quality output to avoid returning BLOCKED.

    line 191

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

  1. Announce that you are beginning a code review and note the scope (file names, PR description if provided)
  2. Ask for context if not provided: what is the feature, is there a design reference, are there known constraints?
  3. Present findings as a structured review, run all phases before commenting
  4. 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 forWhat to produce
PR / diff reviewStructured 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 componentSame five phases applied to that component; call out what the component does well alongside issues
Accessibility audit of a snippetPhase 1 findings only, with WCAG 2.1 AA criterion cited for each violation and a concrete corrected code example
React pattern checkPhase 2 findings only; anti-pattern identified, consequence explained, and replacement code shown
TypeScript strictness reviewPhase 3 findings only; each unsafe pattern flagged with the specific risk and a type-safe replacement
Performance reviewPhase 4 findings only; bundle impact and render cost issues each with a measurable description and fix
Test quality reviewPhase 5 findings only; identify untested paths, query selector quality, and async handling issues
Overall verdict onlyOne-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> without alt attribute (empty alt="" acceptable for decorative images)
  • Icon button with no accessible name (aria-label or visually-hidden text)
  • Form input without associated <label> (via htmlFor/id or aria-labelledby)
  • Focus indicator removed without replacement (outline: none with no :focus-visible alternative)
  • 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-hidden on focusable elements

Phase 2, React Correctness

Reject these patterns

Anti-patternProblemReplace with
Component defined inside a render functionRemounts on every parent render, destroys state, causes flickerDefine outside the parent component
Inline object/array literal as propNew reference each render → breaks memo, triggers useEffectHoist to module scope or useMemo
useEffect for derived stateDouble-render cycle: render → effect → setState → re-renderCompute during render or useMemo
useEffect for event handlingStale closure risk; missing deps cause silent bugsUse native event handlers or libraries
Missing useEffect dependencyStale closure, uses old value silentlyAdd the dependency; if it causes infinite loop, investigate the real issue
useCallback / useMemo everywherePremature optimisation; adds complexity with no measurable benefitProfile first; memoize only costly computations or stable references needed by children
!! without a documented invariantHides null-safety issuesSafe navigation or explicit check
key={index} in a reordering listWrong component identity; broken animation/stateUse stable IDs

Check

  • Error boundaries present for components that fetch or render dynamic data
  • Suspense fallback 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-patternProblemReplace with
any typeDisables all type checkingProper type, unknown + narrowing, or generic
as SomeType cast without a type guardBypasses type safety, runtime crash riskAdd a type guard (instanceof, discriminated union check)
! non-null assertion without commentSilently fails at runtime if wrongAdd a check or document the invariant that makes it safe
Missing return type on exported functionsMakes signatures implicit; breaks callers on changeAnnotate return type explicitly
object or {} as a typeToo broad, accepts anything non-primitiveUse a specific interface or Record<K, V>
Discriminated union with unchecked default caseExhaustiveness not enforcedUse 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 any in utility types
  • satisfies operator 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' vs import X from 'library/X')
  • New npm dependency added: check bundle size impact (bundlephobia.com or 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, use waitFor, 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.