BeforeMerge
FeaturesExploreSkillsPricingBlogDocs
Sign In
FeaturesExploreSkillsPricingBlogDocs
Sign In
BeforeMerge

AI-native code review knowledge base. Structured rules that catch what linters miss.

Product

  • Features
  • Explore
  • Pricing
  • Docs
  • GitHub

Company

  • About
  • Blog
  • Contributing

Legal

  • Privacy Policy
  • Terms of Service
  • MIT License

© 2026 BeforeMerge. Built by Peter Krzyzek

Explore

Browse 158 rules, 25 knowledge articles, and 25 prompt templates across security, performance, architecture, and quality.

158 rules

Use next/image Instead of Raw img Tags

HIGH

Raw <img> tags skip automatic optimization, lazy loading, and responsive sizing. next/image provides WebP/AVIF conversion, blur placeholders, and CLS prevention.

Imagesnextjs
beforemerge-nextjs-review

Always Return Cleanup Functions from useEffect

HIGH

useEffect hooks that set up subscriptions, timers, or event listeners without cleanup cause memory leaks, stale state updates, and race conditions.

useeffectnextjs
beforemerge-nextjs-review

Use Connection Pooling (Supavisor) for Serverless Deployments

HIGH

Each serverless invocation opening a direct database connection exhausts PostgreSQL's connection limit. Use Supavisor pooler URLs for all serverless environments.

supabasesupavisor
beforemerge-supabase-review

Implement Rate Limiting on Sensitive Endpoints

HIGH

Next.js has no built-in rate limiting. Without it, login, signup, password reset, and Server Actions are vulnerable to brute force and credential stuffing. [CWE-799, CWE-307 · A04:2021]

nextjsauthentication
beforemerge-nextjs-review

Avoid Barrel File Imports in Client Components

HIGH

Barrel file imports in Client Components force bundlers to load entire libraries. Use direct imports or Next.js optimizePackageImports.

nextjsimports
beforemerge-nextjs-review

Use Batch Operations Instead of Single-Row Loops

HIGH

Inserting or updating rows one at a time in a loop creates N HTTP requests. Use .insert([...]) or .upsert([...]) to batch into a single request.

supabasebulk
beforemerge-supabase-review

Never Log Sensitive Data

HIGH

Logging OAuth tokens, API keys, passwords, or PII exposes secrets in log aggregation services and crash reporters. Use scoped loggers with sanitization. [CWE-532 · A09:2021]

supabaseSecrets
beforemerge-supabase-review

Prefer Server Components Over Client Components

HIGH

Only add "use client" when a component needs hooks, event handlers, or browser APIs. Every unnecessary "use client" directive ships the component and all its dependencies to the browser as additional JavaScript — slowing down page loads, increasing bandwidth costs, and degrading the experience for users on slow connections or low-powered devices.

bundle-sizeperformance
beforemerge-nextjs-review

Extract Duplicated Logic After Third Occurrence

HIGH

When the same logic appears in three or more places, extract it into a shared function, hook, or module. Duplicated code means that when you fix a bug or change behavior in one copy, the other copies silently remain broken — leading to inconsistent behavior, hard-to-trace bugs, and wasted time tracking down "why does it work here but not there."

qualityrefactoring
beforemerge-fullstack-architecture-review

Avoid useEffect for Derived State

HIGH

Don't use useEffect to sync state that can be computed from existing state or props. Derived values should be calculated during render, not in effects. Effects for derived state cause extra renders, race conditions, and stale UI that flash incorrect data before correcting.

State ManagementReact
beforemerge-react-review

Use Stable Keys for List Items

HIGH

Always use stable, unique keys in array .map() renders. Missing or unstable keys (like array index) cause React to destroy and recreate DOM nodes, losing component state and causing visual glitches.

Reactquality
beforemerge-react-review

Missing Repository Abstraction

HIGH

Database access belongs in repository classes, not in services or route handlers. Repositories abstract the data source behind a typed interface. [CWE-1057]

solidarchitecture
beforemerge-fullstack-architecture-review

Keep 'use client' on the Smallest Possible Leaf Components

HIGH

Adding 'use client' to large components or pages ships unnecessary JavaScript to the browser. Push interactivity to the smallest leaf components.

nextjsReact
beforemerge-fullstack-architecture-review

Prefer Server Components Over useEffect + Fetch for Data Loading

HIGH

Using useEffect + useState for data fetching creates waterfalls, loading spinners, and unnecessary API routes. Use async Server Components instead.

useeffectnextjs
beforemerge-fullstack-architecture-review

Avoid the any Type

HIGH

Never use `any` as a type annotation. `any` disables all type checking for that value and everything it touches, spreading through your codebase like a virus — one `any` can silently disable type safety across dozens of files.

qualityTypeScript
TypeScript Review

Use Cursor-Based Pagination Instead of Offset Pagination

HIGH

Using .range() offset pagination for large datasets forces PostgreSQL to scan all skipped rows. Use cursor-based pagination with .gt()/.lt() for constant-time page fetches.

cursorQueries
beforemerge-supabase-review

Use Discriminated Unions for State

HIGH

Model mutually exclusive states with discriminated unions, not optional fields. Optional fields allow impossible states (e.g., `status: 'success'` with `error: 'failed'`) that compile but crash at runtime.

TypeScriptType Safety
TypeScript Review

Avoid select('*') — Request Only the Columns You Need

HIGH

Using .select('*') fetches all columns including large text/json fields, wastes bandwidth, leaks data shape, and prevents index-only scans.

Queriessupabase
beforemerge-supabase-review

Add Indexes for Frequent Queries

HIGH

Add database indexes for columns used in WHERE, JOIN, and ORDER BY clauses. Without indexes, the database scans every row in the table for every query — a table with 1M rows takes seconds instead of milliseconds.

DatabaseSQL
Database Review

Use Migration Files Instead of MCP or Dashboard SQL

HIGH

Schema changes via Supabase MCP, SQL editor, or dashboard don't create migration files. This causes schema drift between environments.

supabaseDatabase
beforemerge-supabase-review

Add Foreign Key Constraints

HIGH

Define foreign key constraints for all table relationships. Without foreign keys, the database allows orphaned rows (e.g., an order referencing a deleted customer), corrupting data integrity silently.

qualityDatabase
Database Review

Test Behavior, Not Implementation

HIGH

Test what the code does (outputs, side effects), not how it does it (internal method calls, private state). Implementation-coupled tests break every time you refactor, even when behavior is unchanged — making tests a liability instead of a safety net.

Testingquality
Testing Review

Maintain Test Isolation

HIGH

Every test must be independent — no shared mutable state, no execution order dependencies. When tests share state, they pass in isolation but fail together (or worse, fail randomly), creating flaky CI that wastes hours of debugging time.

Testingquality
Testing Review

Use Semantic HTML Elements

HIGH

Use semantic HTML elements (<nav>, <main>, <article>, <button>) instead of generic <div> and <span> with click handlers. Screen readers and assistive technology rely on semantic elements to understand page structure — a <div onClick> looks like nothing to a blind user.

qualitySemantic HTML
Accessibility Review

Automate these checks on every PR

BeforeMerge scans your pull requests against these rules automatically. Get actionable feedback before code ships to production.

Join WaitlistLearn More

Filters

Skill

Impact

Category

Skill

Impact

Category

Previous1234567Next