agentleFS
vlad-ryzhkovvlad-ryzhkov/ai-context-engineering-for-frontend/.claude/skills/frontend-code-review/SKILL.md

frontend-code-review

Skill2 starsChanged 8 months agoUnlicenseView on GitHub

Analyzes git diffs of frontend code (TS, React, Vue, JS) for security flaws, XSS, secrets, state leaks, FSD violations, and anti-patterns. Use for PR reviews or local diff checks. Do not use for reviewing generated artifacts — use Auditor agent instead.

  • Reads credentials

23 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use backend-code-review, frontend-query-mutation and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • jpoindexterSkill

    backend-code-review

    Review backend code for quality, security, maintainability, and best practices based on established checklist rules. Use when the user requests a review, analysis, or improvement of backend files (e.g., `.py`) under the `api/` directory. Do NOT use for frontend files (e.g., `.tsx`, `.ts`, `.js`). Supports pending-change review, code snippets review, and file-focused review.

    Also in 5 projects that use this

  • lien0219Skill

    frontend-query-mutation

    Guide for implementing Langflow frontend query and mutation patterns with Axios and TanStack React Query v5. Trigger when creating or updating API hooks in controllers/API/queries, consuming UseRequestProcessor in components, deciding whether to use useQuery or useMutation, handling conditional queries, cache invalidation, mutation error handling, or migrating legacy API calls to the query hook pattern.

    Also in 3 projects that use this

  • Charlie85270Skill

    component-refactoring

    Refactor high-complexity React components in Dify frontend. Use when `pnpm analyze-component --json` shows complexity > 50 or lineCount > 300, when the user asks for code splitting, hook extraction, or complexity reduction, or when `pnpm analyze-component` warns to refactor before testing; avoid for simple/well-structured components, third-party wrappers, or when the user explicitly wants testing without refactoring.

    Also in 4 projects that use this

  • mm-mazharSkill

    cache-components

    Expert guidance for Next.js Cache Components and Partial Prerendering (PPR).

    Also in 4 projects that use this

  • nilecuiSkill

    frontend-testing

    Generate Vitest + React Testing Library tests for Dify frontend components, hooks, and utilities. Triggers on testing, spec files, coverage, Vitest, RTL, unit tests, integration tests, or write/review test requests.

    Also in 7 projects that use this

  • GoogleSkill

    pr-creator

    Also in 5 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. 0 are common, 8 are distinctive, and 8 are very specific to this project.

  • 0

    Common

    Most of the 18 edited versions we read keep these.

  • 8

    Distinctive

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Before execution the agent MUST load: .claude/protocols/gardener.md

    line 14
  2. Very specific:

    CI Mode prerequisite: If running in CI, GITHUB_TOKEN must be exported with pull-requests: write permissions.

    line 16
  3. Distinctive:

    Do NOT output per-phase progress to chat.

    line 29
  4. Distinctive:

    Do NOT print intermediate grep results or file lists to chat.

    line 30
  5. Very specific:

    If diff is empty after filtering → output ⚠️ No frontend files in diff and STOP.

    line 82
  6. Very specific:

    If unclear — read package.json for react or vue dependency.

    line 107
  7. Distinctive:

    Read CLAUDE.md for project-specific conventions and banned patterns.

    line 111
  8. Distinctive:

    If diff exceeds 2000 added lines → review only CRITICAL and HIGH categories (Phases 2 and 3).

    line 119
  9. Distinctive:

    Scope rule: Only flag patterns in changed lines.

    line 134
  10. Very specific:

    Run only if package.json or config files are in the diff:

    line 138
  11. Distinctive:

    If React detected in Phase 1.3:

    line 147
  12. Very specific:

    If React Doctor unavailable → skip with note React Doctor not available — skipping Phase 2b

    line 153
  13. Distinctive:

    Verify presence of all 4 states:

    line 183
  14. Very specific:

    When running in CI (environment variable CI=true or GITHUB_ACTIONS=true):

    line 224
  15. Distinctive:

    Before marking SKILL COMPLETE, verify ALL of the following:

    line 250
  16. Very specific:

    Call .claude/protocols/gardener.md before SKILL COMPLETE.

    line 262

“Common” is measured: kept by at least 6 in 10 of the 18 edited versions of this file we could read. “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

SYSTEM REQUIREMENTS

Before execution the agent MUST load: .claude/protocols/gardener.md

CI Mode prerequisite: If running in CI, GITHUB_TOKEN must be exported with pull-requests: write permissions.


/frontend-code-review — Frontend Code Review

<purpose> Reviews git diffs for security vulnerabilities, architecture violations, anti-patterns, and performance regressions. Outputs a structured report (local) or inline PR comments (CI). </purpose>

Verbosity Protocol (SILENT MODE)

  • Do NOT output per-phase progress to chat.
  • Do NOT print intermediate grep results or file lists to chat.
  • Output to chat ONLY: blocker messages and the final SKILL COMPLETE block.

When to Use

  • Review a PR before merge
  • Review local staged/unstaged changes before committing
  • CI-triggered review on pull request events

When NOT to Use

  • Reviewing artifacts generated by /component-gen or /api-bind — use Auditor agent
  • Full repository analysis — use /fe-repo-scout
  • Specification review — use /spec-audit

Input

Usage: /frontend-code-review [target]

Targets:
  <pr-number>     Review a GitHub PR (e.g., 42)
  <branch>        Review diff of branch against main
  --staged        Review staged changes only
  (no argument)   Review diff of current branch against main

Protocol (BANNED)

  • BANNED: commenting on code formatting or style (linter handles this)
  • BANNED: suggesting full rewrites of unchanged code
  • BANNED: hallucinating code that does not exist in the diff
  • BANNED: flagging issues already covered by Biome/ESLint rules
  • BANNED: reviewing non-frontend files (Go, Python, SQL, Dockerfile) unless they contain secrets
  • BANNED: outputting intermediate grep/diff results to chat

Phase 1 — Context Discovery

1.1 Obtain Diff

# PR mode
git diff origin/main...HEAD -- '*.ts' '*.tsx' '*.vue' '*.js' '*.jsx' '*.css' '*.json'

# --staged mode
git diff --staged -- '*.ts' '*.tsx' '*.vue' '*.js' '*.jsx' '*.css' '*.json'

# PR number mode (gh pr diff does not support -- path filters;
# pipe output through grep or parse changed filenames to filter to frontend extensions)
gh pr diff <number>

If diff is empty after filtering → output ⚠️ No frontend files in diff and STOP.

1.2 Classify Changed Files

Group files by FSD layer (if applicable):

LayerPattern
appsrc/app/**
pagessrc/pages/**
widgetssrc/widgets/**
featuressrc/features/**
entitiessrc/entities/**
sharedsrc/shared/**
config*.config.*, tsconfig*, biome.json, package.json
othereverything else

1.3 Detect Framework

Scan diff file extensions:

  • .tsx / .jsx → React
  • .vue → Vue
  • Mixed → both (run framework-specific checks for each)

If unclear — read package.json for react or vue dependency.

1.4 Read Project Context

Read CLAUDE.md for project-specific conventions and banned patterns.

1.5 Diff Size Guard

git diff origin/main...HEAD --stat | tail -1

If diff exceeds 2000 added lines → review only CRITICAL and HIGH categories (Phases 2 and 3). Skip Phase 4. Note truncation in report.

Phase 2 — Security Scan

Reference: references/security-checklist.md

Scan added lines only (+ lines in diff) for each category in the security checklist.

For each finding, record:

  • File path and line number
  • Pattern matched
  • Severity (CRITICAL / HIGH / MEDIUM)
  • Recommendation

Scope rule: Only flag patterns in changed lines. Do not scan unchanged context lines.

Config & Dependency Review (conditional)

Run only if package.json or config files are in the diff:

  • New dependencies: check for known vulnerable or deprecated packages
  • Removed security headers or CSP rules
  • Changed API base URLs or CORS configuration
  • TypeScript strict mode disabled or loosened

Phase 2b — React Doctor Scan [React only]

If React detected in Phase 1.3:

  1. Run npx react-doctor@latest . --diff origin/main --score 2>&1
  2. Map findings: error → HIGH, warning → MEDIUM
  3. Deduplicate with Phase 3 anti-pattern results (skip findings already covered)
  4. Include health score in report header
  5. If React Doctor unavailable → skip with note React Doctor not available — skipping Phase 2b

Reference: .claude/skills/react-doctor/references/antipattern-map.md for rule→anti-pattern mapping.

Phase 3 — Architecture & Anti-patterns

3.1 FSD Import Violations

For each changed file, verify import paths respect FSD layer hierarchy:

shared → entities → features → widgets → pages → app
(lower)                                        (higher)

VIOLATION: importing from a higher or same layer

For each changed file classified in Phase 1.2, use the Grep tool to search for imports from higher or same-level layers. Example: for files in src/entities/, search for from.*features/, from.*widgets/, from.*pages/.

3.2 Anti-pattern Scan

Lazy Load Protocol: Read .claude/fe-antipatterns/_index.md for grep signatures. Read individual pattern files ONLY when a violation is found in the diff.

Load references/antipattern-scan.md for pattern tables with grep signatures (Common, React-gated, Vue-gated).

3.3 Async State Completeness

For each new or modified component that uses data fetching (useQuery, useSWR, useMutation, fetch, axios):

Verify presence of all 4 states:

  • Loading state (isLoading, isPending, skeleton, spinner)
  • Error state (isError, error, error boundary)
  • Empty state (empty array/null check)
  • Success state (data rendering)

Missing states → HIGH finding.

Phase 4 — Performance & A11y Spot-Check

Performance

CheckWhat to look forSeverity
Heavy importsimport moment|import lodash (non-tree-shakeable)MEDIUM
Unmemoized computation.filter(|.reduce(|.sort( in render without useMemo|computedMEDIUM
Large JSON importimport.*from.*\.json (bundled data)MEDIUM
Missing cleanupsetInterval|addEventListener without cleanup in returnHIGH
CLS riskImages without explicit width/height or fillMEDIUM

A11y Spot-Check

CheckWhat to look forSeverity
div-as-buttononClick|@click on div|span without role="button"HIGH
Missing alt<img without alt=HIGH
Missing aria-labelIcon-only buttons without aria-labelHIGH
Missing form labels<input without associated <label> or aria-labelMEDIUM
Autofocus abuseautoFocus on non-modal elementsMEDIUM

Phase 5 — Report Generation

Local Mode (default)

Generate report using template: references/review-report-template.md

Save to: audit/frontend-code-review_{YYYYMMDD_HHMMSS}.md

CI Mode (GitHub Actions)

When running in CI (environment variable CI=true or GITHUB_ACTIONS=true):

  1. Post inline PR comments for CRITICAL and HIGH findings:
gh api repos/{owner}/{repo}/pulls/{pr}/comments \
  --method POST \
  -f body="..." \
  -f commit_id="..." \
  -f path="..." \
  -F line=<number> \
  -f side="RIGHT"
  1. Post summary comment on PR with finding counts and top issues.

Severity Classification

LevelCriteriaAction
CRITICALSecurity vulnerability, secret exposureMust fix before merge
HIGHArchitecture violation, missing error handling, a11y blockerShould fix before merge
MEDIUMPerformance concern, minor anti-pattern, code smellConsider fixing

Quality Gate

Before marking SKILL COMPLETE, verify ALL of the following:

  • Diff obtained and filtered to frontend files only
  • Framework detected (not guessed)
  • Security scan completed against references/security-checklist.md
  • FSD import violations checked (if FSD structure detected)
  • Anti-pattern scan used correct framework gate (React/Vue/both)
  • No intermediate output printed to chat (SILENT MODE enforced)
  • Report written to audit/ (local) or PR comments posted (CI)

Gardener Protocol

Call .claude/protocols/gardener.md before SKILL COMPLETE.

Markdown skills (append to artifact): frontend-code-review

Completion Contract

SKILL COMPLETE: /frontend-code-review
 - Report: audit/frontend-code-review_{YYYYMMDD_HHMMSS}.md
 - Framework: [detected]
 - Diff: [N files changed, +X/-Y lines]
 - Findings: [N critical / N high / N medium]
 - Top issues: [list]
SKILL PARTIAL: /frontend-code-review
 - Framework: [detected]
 - Artifacts: [list]
 - Coverage: [phases completed / total]
 - Blockers: [description]

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.