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 158 rules, 25 knowledge articles, and 25 prompt templates across security, performance, architecture, and quality.

158 rules

Use Scoped Loggers with Structured Context

MEDIUM

Bare console.log statements with no context make production debugging impossible. Use scoped loggers with errorId, userId, and structured metadata.

productionquality
beforemerge-fullstack-architecture-review

Extract Duplicated Logic After the Third Occurrence

HIGH

Same logic duplicated in 3+ places creates consistency bugs and maintenance burden. Extract to the appropriate layer after the third occurrence.

qualityrefactoring
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

Stream Slow Content with Suspense Boundaries

MEDIUM

Pages that block until all data loads show nothing until everything is ready. Wrap slow components in Suspense to stream content progressively.

nextjsloading-states
beforemerge-fullstack-architecture-review

Use Promise.all for Independent Data Fetches

HIGH

Serial await statements for independent data fetches create request waterfalls. Use Promise.all to parallelize and cut load times by 2-5x.

promise-allnextjs
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

Missing Service Layer

HIGH

Business logic belongs in service classes, not in route handlers, server actions, or components. Use the ServiceResult<T> pattern. [CWE-1086]

single-responsibilitysolid
beforemerge-fullstack-architecture-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

Segregate Repository Interfaces by Consumer Need

MEDIUM

Split large repository interfaces into focused, role-specific contracts so consumers only depend on the methods they use

interface-segregationsolid
beforemerge-fullstack-architecture-review

Missing Factory for Dependency Injection

MEDIUM

Use factory classes (ServiceFactory, RepositoryFactory) for dependency wiring instead of direct instantiation or imports in consuming code.

dependency-injectionsolid
beforemerge-fullstack-architecture-review

Domain Entities Must Be Framework-Independent

MEDIUM

Domain entities should be pure TypeScript classes/interfaces with no framework dependencies like Supabase, React, or Next.js

solidarchitecture
beforemerge-fullstack-architecture-review

Build Features Bottom-Up from Domain to Presentation

MEDIUM

Build in dependency order: Domain, Interface, Repository, Service, Controller, Presentation. Top-down builds couple UI to data.

planningarchitecture
beforemerge-fullstack-architecture-review

Sanitize User Input

CRITICAL

Sanitize and escape all user-provided input before rendering in HTML, executing in SQL, or passing to system commands. Unsanitized input is the entry point for XSS, SQL injection, and command injection attacks — the three most exploited vulnerability classes in web applications.

NodeSanitization
Node.js Security Review

Log Errors with Context

HIGH

Always log errors with structured context: user ID, request ID, input data, stack trace. An error message like "Cannot read property of undefined" with no context is impossible to debug — you don't know which user hit it, what they were doing, or how to reproduce it.

qualityLogging
Error Handling Review

Use Error Boundaries

HIGH

Wrap UI sections in React Error Boundaries to catch rendering errors gracefully. Without error boundaries, a single component crash (a null reference, a failed API parse) takes down the entire page — showing users a white screen with no way to recover or navigate away.

Reactquality
Error Handling Review

Minimize Third-Party Scripts

HIGH

Audit and minimize third-party scripts (analytics, chat widgets, ad trackers). Each third-party script adds DNS lookups, TLS handshakes, and JavaScript execution that blocks the main thread — a single chat widget can add 500ms+ to page load and degrade Core Web Vitals scores.

Web PerformanceThird Party
Web Performance Review

Optimize Images

HIGH

Serve images in modern formats (WebP/AVIF), at appropriate dimensions, and with width/height attributes. Unoptimized images are typically the largest assets on a page — a single uncompressed hero image can be larger than all your JavaScript combined, destroying load times on mobile.

ImagesWeb Performance
Web Performance Review

Lazy-Load Below-Fold Content

HIGH

Lazy-load images, components, and data that are below the initial viewport fold. Loading everything upfront makes the user wait for content they haven't scrolled to yet — increasing Time to Interactive and burning mobile data on content the user may never see.

Web Performanceperformance
Web Performance Review

Avoid Prototype Pollution

HIGH

Never merge user-controlled objects into application objects using Object.assign, spread, or deep-merge without validation. Prototype pollution lets an attacker inject __proto__ properties that modify the behavior of every object in your application — enabling denial of service, authentication bypass, or remote code execution.

NodePrototype Pollution
Node.js Security Review

Set Security Headers

HIGH

Set security headers on all HTTP responses: Content-Security-Policy, X-Content-Type-Options, X-Frame-Options, Strict-Transport-Security. Missing headers leave your app vulnerable to XSS, clickjacking, MIME sniffing, and protocol downgrade attacks.

NodeHeaders
Node.js Security Review

Avoid eval() and Dynamic Code Execution

CRITICAL

Never use eval(), new Function(), or vm.runInScript() with user-provided input. These functions execute arbitrary code with the full privileges of your Node.js process — an attacker can read files, access databases, or take over the entire server.

NodeInjection
Node.js Security Review

Use Environment Variables for Config

HIGH

Store all environment-specific configuration (API URLs, database connections, feature flags) in environment variables, never in source code. Hardcoded config means your staging code talks to production databases, your API keys are in git history, and deploying to a new environment requires code changes.

Deploymentsecurity
DevOps & CI/CD Review

Run Tests Before Deploy

CRITICAL

CI must run the full test suite and block deployment on failure. Without gate checks, a broken commit reaches production, users experience bugs, and you spend hours debugging under pressure instead of catching it in CI for free.

DeploymentTesting
DevOps & CI/CD Review

Pin Dependency Versions

HIGH

Pin exact versions for all dependencies in production (no ^, ~, or * ranges). Unpinned dependencies silently pull in new versions that can introduce breaking changes, security vulnerabilities, or performance regressions — and you won't know until production breaks.

DependenciesCI/CD
DevOps & CI/CD 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
Sort:
Previous1234567Next