BeforeMerge

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

Product

  • Features
  • Explore
  • Pricing
  • Docs
  • GitHub

Company

  • About
  • Blog
  • Contributors
  • Contributing

Legal

  • Privacy Policy
  • Terms of Service
  • MIT License

© 2026 BeforeMerge. Built by Peter Krzyzek

BeforeMerge
Features
Explore
PricingBlogContributorsInstall Guide
2Sign In
FeaturesExplore
RulesSkillsKnowledgePrompts
PricingBlogContributorsInstall Guide
Sign In

Explore

Browse 225 rules, 42 knowledge articles, and 28 prompt templates across security, performance, architecture, and quality.

225 rules

Validate Input at Runtime with Zod Instead of Type Assertions

HIGH

Using 'as' type assertions on external input (params, form data, request bodies) provides zero runtime safety. Use Zod for runtime validation. [CWE-20 · A03:2021]

supabaseValidation
Supabase

Always Check Error Before Using Data from Supabase Queries

HIGH

Destructuring { data } without checking { error } from Supabase queries ignores failures silently. When error is non-null, data is always null. [CWE-252]

supabasequality
Supabase

Distinguish Not-Found from Other Supabase Errors

MEDIUM

Treating all Supabase errors the same (if error, throw) hides whether a record is missing or the query itself failed. Check error codes for proper handling.

postgrestsupabase
Supabase

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
Supabase

Avoid N+1 Queries with Supabase Relational Selects

HIGH

Fetching parent records then looping to fetch children creates N+1 HTTP requests. Use Supabase nested .select('*, children(*)') to resolve in a single query. [CWE-400]

Queriessupabase
Supabase

Add Indexes for Filtered and Ordered Columns

HIGH

Filtering or ordering on unindexed columns causes full table scans. RLS policy columns like user_id and org_id especially need indexes. [CWE-405]

Queriessupabase
Supabase

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
Supabase

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
Supabase

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
Supabase

Generate Database Types from Schema

MEDIUM

Hand-writing TypeScript interfaces for database tables leads to drift between code and schema. Use supabase gen types to generate types automatically.

supabasetypes
Supabase

Follow Canonical Migration File Structure

MEDIUM

Migration files without proper structure (table, indexes, RLS, policies, comments) are harder to review and prone to missing critical steps like RLS.

supabaseDatabase
Supabase

Use the Correct Supabase Client for Each Context

HIGH

Using the wrong Supabase client for the context breaks RLS, leaks auth state, or causes hydration errors. Match client type to Next.js rendering context.

middlewarenextjs
Supabase

Prevent Prototype Pollution from Untrusted Input

CRITICAL

Spreading or Object.assign-ing untrusted user input into objects can pollute Object.prototype and lead to security bypasses. [CWE-1321]

ReactPrototype Pollution
React

Use Cryptographic Randomness for Tokens and IDs

CRITICAL

Math.random() is not cryptographically secure. Use crypto.randomUUID() or crypto.getRandomValues() for tokens, IDs, and security-sensitive values. [CWE-338]

Reactrandomness
React

Never Use eval() or new Function() with User Input

CRITICAL

Using eval(), new Function(), or innerHTML with user-controlled strings enables arbitrary code execution in the browser. [CWE-95 · A03:2021]

code-injectionReact
React

Sanitize Content Before dangerouslySetInnerHTML

CRITICAL

Using dangerouslySetInnerHTML with unsanitized user input enables XSS attacks. Always sanitize with DOMPurify or a trusted library. [CWE-79 · A03:2021]

SanitizationXSS
React

Always Clean Up useEffect Side Effects

MEDIUM

Missing cleanup in useEffect for subscriptions, timers, event listeners, and AbortControllers causes memory leaks, stale callbacks, and state updates on unmounted components.

useeffectReact
React

Never Use Array Index as Key for Dynamic Lists

MEDIUM

Using array index as key in lists that can be reordered, filtered, or inserted into causes React to mismap state to the wrong items, creating subtle and hard-to-debug UI bugs.

key-propreconciliation
React

Add Error Boundaries Around Unreliable UI Sections

MEDIUM

Without error boundaries, a single component crash unmounts the entire React tree. Wrap unreliable sections so failures are isolated and recoverable.

reliabilityReact
React

Do Not Mix Controlled and Uncontrolled Input Patterns

MEDIUM

Switching between controlled (value prop) and uncontrolled (defaultValue/no value) patterns on the same input causes React warnings and unpredictable behavior.

controlled-componentsforms
React

Avoid Inline Object/Array/Function Creation in JSX Props

HIGH

Creating new objects, arrays, or functions inline in JSX causes child components to re-render on every parent render due to referential inequality.

usecallbackReact
React

Virtualize Large Lists Instead of Rendering All Items

HIGH

Rendering thousands of DOM nodes for long lists causes slow initial render, high memory usage, and scroll jank. Use virtualization (react-window, TanStack Virtual).

tanstack-virtualReact
React

Memoize Expensive Computations with useMemo

HIGH

Running expensive calculations (sorting, filtering, transforming large datasets) on every render wastes CPU cycles. Use useMemo to cache results.

computationReact
React

Split Large Contexts to Prevent Unnecessary Consumer Re-renders

HIGH

Putting too much state in a single React Context causes all consumers to re-render when any value changes. Split into focused contexts.

State ManagementReact
React

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
Sort:
Previous1...456...10Next