review-remix-v2
Skill91 starsChanged 7 days agoApache-2.0View on GitHub
Reviews legacy Remix v2 (@remix-run/*) codebases for routing, data flow, forms, error boundaries, meta/sessions, and SSR/caching traps. Remix v2 is EOL and superseded by React Router v7; use only when maintaining existing @remix-run/* applications.
- Reads credentials
In this repository85 other files it gives its agents.
- AGENTS.mdAGENTS.md
- llms.txtllms.txt
- agent-architecture-analysisSkill
- app-intents-code-reviewSkill
- artifact-analysisSkill
- axum-code-reviewSkill
- brainstorm-beagleSkill
- bubbletea-code-reviewSkill
- cloudkit-code-reviewSkill
- elixir-performance-reviewSkill
- elixir-security-reviewSkill
- elixir-writing-docsSkill
- exdoc-configSkill
- exunit-code-reviewSkill
- fastapi-code-reviewSkill
- fetch-pr-feedbackSkill
- ffi-code-reviewSkill
- fix-llm-artifactsSkill
- fowler-refactoringSkill
- gen-test-planSkill
- go-architectSkill
- go-code-reviewSkill
- go-data-persistenceSkill
- go-testing-code-reviewSkill
- healthkit-code-reviewSkill
- humanize-beagleSkill
- improve-docSkill
- ios-animation-code-reviewSkill
- liveview-code-reviewSkill
- llm-artifacts-detectionSkill
- llm-judgeSkill
- macros-code-reviewSkill
- phoenix-code-reviewSkill
- postgres-code-reviewSkill
- prfaq-beagleSkill
- prometheus-go-code-reviewSkill
- pytest-code-reviewSkill
- quick-planSkill
- react-flow-code-reviewSkill
- react-flowSkill
- react-router-code-reviewSkill
- react-router-v7Skill
- receive-feedbackSkill
- refactor-repoSkill
- resolve-beagleSkill
- respond-pr-feedbackSkill
- review-ai-writingSkill
- review-elixirSkill
- review-frontendSkill
- review-goSkill
- review-iosSkill
- review-llm-artifactsSkill
- review-planSkill
- review-pythonSkill
- review-rustSkill
- review-skillSkill
- review-structureSkill
- review-tuiSkill
- review-verification-protocolSkill
- run-test-planSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 0 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
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
- Very specific: line 21
If git diff returns nothing, inspect staged/working-tree changes or ask for an explicit file list.
- Very specific: line 42
Pure loaders & throws: Never mutate inside loader.
- Very specific: line 53
Primitive choice & pending state: Use <Form> + redirect() (PRG) when URL/history changes.
- Very specific: line 89
headersinheritance & forwarding: Only the deepest matched route's headers runs. - Very specific: line 99
Check clientLoader.hydrate + HydrateFallback to avoid unintended client round-trips or hydration mismatches.
- Very specific: line 125
Evidence & Exemptions: Every Critical/Major finding must cite an existing FILE:LINE with a verbatim quote, verify parent/root route context …
- Very specific: line 172
When maintaining an active Remix v2 app, note missing v3_* future flags (v3_fetcherPersist, v3_relativeSplatPath, v3_lazyRouteDiscovery, …
- Very specific: line 184
Keep Remix v2 semantics distinct from React Router v7 (@remix-run/* vs react-router, json()/defer() vs data()/raw returns).
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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
Remix v2 Maintenance Code Review
EOL & Migration Status: Remix v2 (
@remix-run/*) is End-of-Life and superseded by React Router v7 (react-router-v7). Use this skill strictly for maintaining existing@remix-run/*applications. Notev3_*future flags (v3_fetcherPersist,v3_relativeSplatPath,v3_lazyRouteDiscovery,v3_singleFetch,v3_throwAbortReason) or React Router v7 migration readiness as Informational only when relevant. Never prescribe Remix v1 (CatchBoundary,useTransition) or Next.js ("use client") patterns.
Arguments
- Path: Target directory or diff scope (default: current working directory)
Step 1: Identify Scope & Confirm Remix v2
git diff --name-only $(git merge-base HEAD main)..HEAD | grep -E '\.(tsx?|jsx?|mjs|cjs|css)$|^(remix|vite)\.config\.'
grep -E '"@remix-run/(react|node|cloudflare|deno|serve)"' package.json | head -3If git diff returns nothing, inspect staged/working-tree changes or ask for an explicit file list. If package.json contains no @remix-run/* package, stop—route to react-router-code-review or review-frontend instead. Check vite.config.* vs remix.config.js (including @remix-run/v1-route-convention and future.v3_* flags) before flagging compiler or routing issues.
Quick surface greps for targeted inspection:
- Routes & shells:
app/routes/filenames,app/root.tsx - Loaders/actions/boundaries:
grep -rE 'export (async )?function (loader|action|ErrorBoundary)|defer\(|useRouteError' app/ - Forms/meta/sessions/headers:
grep -rE '<Form|useFetcher|export (const|function) (meta|headers)|commitSession' app/
Step 2: Load Verification Protocol
Load the review-verification-protocol skill (review-verification-protocol when installed alongside sibling skills) before making any substantive severity judgment. Do not classify or write findings until this gate clears.
Step 3: Consolidated Remix v2 Review Checklist
1. Routing & Root Shell (app/routes/, app/root.tsx)
- Flat-routes v2 grammar: Index routes use
_index.tsx(notindex.tsxunless@remix-run/v1-route-conventionis wired). Pathless layouts use single_(_auth.tsx). Dotted children (users.profile.tsx) require<Outlet />inusers.tsxor trailing-underscore opt-out (users_.profile.tsx, valid only when a parent layout exists). Literal dots escape with brackets (sitemap[.]xml.tsx); splat routes readparams["*"], neverparams.splat. - Resource routes: Non-HTML
Responseroutes (JSON/PDF/RSS/webhooks) must have nodefaultexport. Parent loaders do not run for resource routes, so auth checks must live inside the resource route's ownloader/action. Callers using<Link>must passreloadDocument(or use<a>). - Root document shell:
app/root.tsxmust render<Meta />,<Links />,<Outlet />,<ScrollRestoration />before<Scripts />, and omit<LiveReload />under Vite (@remix-run/dev/vite). RootErrorBoundaryreplaces the whole document—useLayout(Remix>=2.4) or return the complete<html>shell with<Scripts />.- Under Classic Compiler (
remix.config.js),<LiveReload />already no-ops in production—do not wrap it inNODE_ENV === "development". - Under Vite, remove
<LiveReload />completely; Vite handles HMR natively.
- Under Classic Compiler (
2. Data Flow & Streaming (loader, action, shouldRevalidate)
- Pure loaders & throws: Never mutate inside
loader; move writes toaction. Short-circuit 401/403/404 withthrow new Response(...)orthrow json(...)—returningjson(..., { status: 404 })skipsErrorBoundary. - Streaming (
defer()/<Await>): Pre-v3_singleFetch, start slow unawaited promises before anyawaitinloadersodefer()streams immediately, and wrap every<Await>in<Suspense>witherrorElementso rejections degrade locally:
Underconst reviewsPromise = db.getReviews(params.id); // kick off BEFORE await const product = await db.getProduct(params.id); return defer({ product, reviews: reviewsPromise });v3_singleFetch,json()/defer()are deprecated in favor of raw object returns anddata(). - Navigation state & revalidation:
nav.formMethod/fetcher.formMethodare UPPERCASE ("POST","GET"); lowercase comparisons silently fail.useNavigation()skips"submitting"for GET navigations (idle -> loading -> idle), whereas<fetcher.Form>enters"submitting"even on GET (fetcher.load()skips it). Avoid blanketshouldRevalidate = () => falsewithout checkingformAction/defaultShouldRevalidate, and never calluseRevalidator().revalidate()immediately after<Form>/useFetchermutations.
3. Forms & Uploads (<Form>, useFetcher, FormData)
- Primitive choice & pending state: Use
<Form>+redirect()(PRG) when URL/history changes; useuseFetcher()for inline/per-row mutations. Derive pending and optimistic UI directly fromuseNavigation()(scoped withnavigation.formActionwhen sibling nav exists) or per-rowfetcher.state/fetcher.formData—never mirror intouseState:const optimistic = fetcher.formData ? fetcher.formData.get("favorited") === "true" : item.favorited; - Multi-action intent & uploads: Prefer a single route
actionswitching onformData.get("intent")over sprawling mutation-only sub-routes on the same resource. File-upload<Form>requiresencType="multipart/form-data". Capunstable_createMemoryUploadHandler({ maxPartSize })on user-controlled uploads (or use disk/stream handlers for large files). Note that<Form method="put|patch|delete">is JS-only without progressive enhancement unless normalized as POST +intent.
4. Error Boundaries (ErrorBoundary, entry.server.tsx)
- Unified v2 signature: Declare
export function ErrorBoundary()with no props (({ error })leaveserrorundefined at runtime). CalluseRouteError()and narrowisRouteErrorResponse(error)beforeerror instanceof Error:export function ErrorBoundary() { const error = useRouteError(); if (isRouteErrorResponse(error)) return <p>{error.status} {error.statusText}</p>; if (error instanceof Error) return <p>{error.message}</p>; return <p>Unknown error</p>; } - Root & server error boundary contracts: Root
ErrorBoundarymust calluseRouteLoaderData("root")defensively (neveruseLoaderData(), which fails if rootloaderthrew).entry.server.tsxhandleErrorfires only on uncaught runtime errors—not thrownResponses—and filteringif (request.signal.aborted) returnis intentional.
5. Meta, Sessions & Auth (meta, commitSession, CSRF)
- Meta v2 array contract (CRITICAL):
metamust returnMetaDescriptor[]([...]). A v1 object literal (() => ({ title })) or shorthand ({ "og:title": "..." }instead of{ property: "og:title", content }) often typechecks in loose configs but silently drops tags at runtime.metadoes NOT auto-merge parent tags—usematches.flatMap((m) => m.meta ?? [])or plain JSX<meta>tags inroot.tsx. Always null-guarddatainmeta(404/error renders passundefined).export const meta: MetaFunction<typeof loader> = ({ data, matches }) => { const parent = matches.flatMap((m) => m.meta ?? []).filter((t) => !("title" in t)); return [...parent, { title: data?.post?.title ?? "Not Found" }]; }; - Sessions, flash & auth: Gate auth in
loader/actionviathrow redirect(...), never component render (which leaks SSR loader data before client redirect). Implement logout as anaction(POST), never aloader(GET CSRF). CallcommitSession(session)and attachSet-Cookieafter everysession.set/unset/flashand in loaders that read aflashvalue (to clear it):const error = session.get("error"); // flash read mutates session return json({ error }, { headers: { "Set-Cookie": await commitSession(session) } }); - CSRF cookie separation & cookie security: With
remix-utils/csrf, store tokens in a dedicatedcreateCookie("csrf", ...)cookie—never share the session cookie. Ensure production session/CSRF cookies sethttpOnly: trueandsecure: process.env.NODE_ENV === "production", and keepsecretsas a rotation-ready array from env ([process.env.SESSION_SECRET!, ...], prepending new secrets ahead of old ones).
6. SSR, Caching & Server/Client Split (headers, *.server.ts)
headersinheritance & forwarding: Only the deepest matched route'sheadersruns; a personalized child omittingheadersinherits an ancestor'sCache-Control: public, s-maxage=...and leaks user HTML at the CDN. Resource routes ignoreheadersexports (set headers on the returnedResponse). Documentheadersmust forwardloaderHeaders:export const headers: HeadersFunction = ({ loaderHeaders }) => ({ "Cache-Control": loaderHeaders.get("Cache-Control") ?? "no-store", });- Server/client split,
clientLoader& prefetch: Server-only libs, secretprocess.env.*, and top-level side effects (new PrismaClient(),withAuth(loader)HOF wrappers pinning server imports) belong in*.server.tsorapp/.server/(Vite)—typeof window === "undefined"does not stop static import hoisting. Whitelistwindow.ENVand escape</script>(serialize-javascript), never rawJSON.stringify:
Check<script dangerouslySetInnerHTML={{ __html: `window.ENV = ${serialize(data.ENV, { isJSON: true })}` }} />clientLoader.hydrate+HydrateFallbackto avoid unintended client round-trips or hydration mismatches.<PrefetchPageLinks page="/..." />requires a leading/andprefetch="render"should not appear inside long lists; loaders with side effects must inspectPurpose/Sec-Purpose: prefetchheaders.
Context-Sensitive Rules
| Issue | Flag ONLY IF |
index.tsx or __double route | @remix-run/v1-route-convention is NOT wired in remix.config.js |
Child omitting headers | An ancestor route actually exports a broader cache policy (e.g. public) |
Vary: Cookie missing | Loader branches response on cookie/session AND response uses public/s-maxage |
useNavigation() missing formAction | Component contains sibling links/forms that could trigger false pending states |
Unbounded unstable_createMemoryUploadHandler | Endpoint accepts user-controlled uploads (not fixed-size internal artifacts) |
<Form method="put|patch|delete"> | Surface requires progressive enhancement (no-JS support) |
Missing csrf.validate(request) | App uses remix-utils/csrf or public action lacks an Origin check |
meta returning [] | Route is documented as requiring page-specific tags (otherwise inheritance is valid) |
Do NOT Flag (Valid Remix v2 Patterns)
- Resource routes with no
defaultexport; routes omittingErrorBoundaryto cascade to a parent boundary; nestedErrorBoundaryreturning a bare fragment without<html>. useLoaderData<typeof loader>()/useActionData<typeof action>()(type annotations, not casts), barenew Response(...)returns, anduseEffectfor browser-only APIs (localStorage,window).unstable_parseMultipartFormData/unstable_create*UploadHandler(unstable_is permanent in v2),sameSite: "lax"when CSRF/Origin protection is present, andsecrets: [process.env.X!, ...]when guarded by a startup env check.metareturning[],linksreturning[],headersreturningno-store,commitSessionin a loader reading flash state, orhandleErrorreturning early onrequest.signal.aborted.- GET
<Form>for search/filters,navigate={false}on<Form>,<Form>withoutaction(posts to current URL), oruseRevalidator()for focus/polling/SSE.
Verification Gates & Output Format
- Scope & Protocol: Record Step 1 target files, detect
@remix-run/*+ compiler config (vite.config.*vsremix.config.js), and loadreview-verification-protocol. - Evidence & Exemptions: Every Critical/Major finding must cite an existing
FILE:LINEwith a verbatim quote, verify parent/root route context before claiming omissions, and clear all Context-Sensitive Rules and Do NOT Flag exemptions. - Single-Pass Convergence: Report all issues across routing, data flow, forms, errors, meta/sessions, SSR/caching, types, and security in one pass. Requests for net-new modules, dependencies, or test suites are Informational, not blocking. Re-reviews verify prior fixes only.
Severity Defaults
- Critical: v1
metaobject literal in v2 route, rootErrorBoundarymissing<Scripts />,Cache-Control: publicon auth/session route, leaked secret env in client graph. - Major:
return json(..., { status: 404 })instead ofthrow,ErrorBoundary({ error })prop signature, missingcommitSessionaftersession.set/flash, unbounded memory upload,useNavigationvsuseFetchermismatch. - Minor / Informational:
v3_*future flags / React Router v7 upgrade readiness, missing test coverage (one Minor item), optional<Await>error-boundary defense-in-depth on Response-only routes.
## Review Summary
[1-2 sentence overview]
## Issues
### Critical (Blocking)
1. [FILE:LINE] ISSUE_TITLE
- Issue: ...
- Why: ...
- Fix: ...
### Major (Should Fix)
2. [FILE:LINE] ISSUE_TITLE
- Issue: ...
- Why: ...
- Fix: ...
### Minor (Nice to Have)
N. [FILE:LINE] ISSUE_TITLE
- Issue: ...
- Why: ...
- Fix: ...
### Informational (For Awareness)
N. [FILE:LINE] SUGGESTION_TITLE
- Suggestion: ...
- Rationale: ...
## Good Patterns
- [FILE:LINE] Pattern description (preserve this)
## Verdict
Ready: Yes | No | With fixes 1-N (Critical/Major only; Minor/Informational ignored)
Rationale: [1-2 sentences]Upgrade Readiness (Informational Only)
When maintaining an active Remix v2 app, note missing v3_* future flags (v3_fetcherPersist, v3_relativeSplatPath, v3_lazyRouteDiscovery, v3_singleFetch, v3_throwAbortReason) or deprecated json()/defer() usage under v3_singleFetch as Informational items pointing toward React Router v7 (react-router-v7)—never as blocking findings on legacy maintenance PRs.
Post-Fix Verification
npm run lint && npm run typecheck && npm run testRules
- Load
review-verification-protocolbefore judging severity. - Cite
FILE:LINEand verbatim code for every finding; check parent routes androot.tsxbefore claiming omissions. - Keep Remix v2 semantics distinct from React Router v7 (
@remix-run/*vsreact-router,json()/defer()vsdata()/raw returns). - Re-reviews verify prior fixes only—never introduce unrelated findings or re-flag unfixed Minor/Informational items.
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.

