From ai-toolkit
Performs thorough PR review for frontend code using .spartan/config.yaml rules or React/Next.js defaults, checking app router conventions, TypeScript strictness, and performance.
How this command is triggered — by the user, by Claude, or both
Slash command
/ai-toolkit:fe-review [optional: PR title or focus area]spartan/Files this command reads when invoked
The summary Claude sees in its command listing — used to decide when to auto-load this command
# Frontend PR Review: {{ args[0] | default: "current branch" }}
Performing a thorough review of frontend changes.
## Step 0: Load rules
**If `.spartan/config.yaml` exists:**
- Read `rules.frontend` + `rules.shared` — check against these rules
- Read `review-stages` — only run enabled stages
- If `conditional-rules` is set, match rules to changed files
**If no config:** Use the default React/Next.js checklist below + scan for `rules/frontend-react/` or `~/.claude/rules/frontend-react/`.
Read all matched rule files before reviewing code.
---
Run `git diff main...HEAD` and analyze all...Performing a thorough review of frontend changes.
# Check for project config
cat .spartan/config.yaml 2>/dev/null
# Get changed frontend files
git diff main...HEAD --name-only | grep -E '\.(tsx?|jsx?|vue|svelte|css)$'
If .spartan/config.yaml exists:
rules.frontend + rules.shared — check against these rulesreview-stages — only run enabled stagesconditional-rules is set, match rules to changed filesIf no config: Use the default React/Next.js checklist below + scan for rules/frontend-react/ or ~/.claude/rules/frontend-react/.
Read all matched rule files before reviewing code.
Run git diff main...HEAD and analyze all modified frontend files.
'use client' when strictly needed (event handlers, browser APIs, stateful UI)'use client' just to use async/await (Server Components handle async natively)useEffect'use server'), not client-side fetch to API routesrevalidatePath or revalidateTag called after mutations (not manual router.refresh())(group)/ used to avoid URL pollution when grouping by auth/layout{ params: { id: string } }loading.tsx and error.tsx present for routes with async data# Check for anti-patterns
git diff main...HEAD -- "*.tsx" "*.ts" | grep "'use client'" | wc -l # count client components
git diff main...HEAD -- "*.tsx" | grep "useEffect.*fetch\|axios\|fetch(" # data fetching in effects
any types — use unknown + type guard if uncertain! non-null assertions without comment explaining why it's safe# Check for type escape hatches
git diff main...HEAD -- "*.tsx" "*.ts" | grep ": any\|as any\|@ts-ignore\|@ts-expect"
next/image (not <img>)next/link (not <a href>)dynamic() if not needed on initial paint'use client' that pushes rendering to browserfetch calls in Server Components use next: { revalidate } or next: { tags } appropriatelyuseFeature.ts)key prop on list items uses stable ID, not array indexComponent.test.tsx)@testing-library/react — no shallow renderingquerySelector in tests — use accessible queries (getByRole, getByLabelText)# Find components without tests
git diff main...HEAD --name-only | grep "\.tsx$" | while read f; do
testfile="${f%.tsx}.test.tsx"
[[ ! -f "$testfile" ]] && echo "⚠️ Missing test: $testfile"
done
<button>, not <div onClick>)<label> (htmlFor + id, or aria-label)alt text (empty alt="" for decorative)_types/ match Kotlin DTOs exactlyprocess.env.NEXT_PUBLIC_API_URL), never hardcodedOnly runs if .planning/design/system/tokens.md or .planning/design-config.md exists.
Read the design tokens file first. Then check every changed frontend file:
bg-blue-*, bg-purple-*, text-gray-*font-sans, Inter, Roboto, Arial, system-uip-[13px] or mt-[7px] → flag as warning# Quick scan for hardcoded colors (should be tokens)
git diff main...HEAD -- "*.tsx" "*.ts" "*.css" | grep -E '#[0-9a-fA-F]{3,8}|bg-(blue|red|green|purple|pink|indigo|violet)-[0-9]' | head -20
# Quick scan for generic fonts
git diff main...HEAD -- "*.tsx" "*.ts" "*.css" | grep -E "font-sans|Inter|Roboto|Arial|system-ui" | head -10
## Frontend PR Review: [title]
### Approved / Needs Changes / Blocked
### Critical Issues (must fix before merge)
- [issue with file:line reference and suggested fix]
### Suggestions (improve code quality)
- [suggestion]
### Performance Notes
- [any perf observations]
### Accessibility Notes
- [any a11y issues]
### Praise
- [what was done well — be specific]
### Verdict
[recommendation + any conditions]
npx claudepluginhub c0x12c/ai-toolkit --plugin ai-toolkit/fec-reviewReviews front-end code (specified file or recent git changes) across 11 quality dimensions, outputs a graded Markdown report with severity levels and merge readiness.
/react-reviewReviews React/JSX code for hook correctness, render performance, RSC boundaries, accessibility, and React-specific security issues, producing a categorized severity report.
/react-reviewReviews React/JSX code for hook correctness, render performance, server/client component boundaries, accessibility, and security. Produces a severity-categorized issue report.
/design-reviewReviews UI files, directories, or staged git changes against design conventions, anti-patterns, accessibility, performance, RTL, i18n, and brand standards. Supports --check, --fix, and --json output.
/auditAudits UI codebase for design style consistency, hardcoded design tokens (colors, spacing), accessibility (color contrast), and best practices across file, directory, or project scopes.
/frontendReviews TypeScript frontend codebase for code quality, performance, best practices, architecture, security, and dead code. Reports issues with example fixes and priorities.