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
3Sign In
FeaturesExplore
RulesSkillsKnowledgePrompts
PricingBlogContributorsInstall Guide
Sign In

Explore

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

Sort:

124 rules matching filters

Choose the narrowest correct column types

MEDIUM

Pick the smallest data type that fits the domain instead of defaulting to BIGINT or wide VARCHAR.

Quality
Previous123456Next

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
MySQL & MariaDB

Use the InnoDB storage engine

HIGH

Use InnoDB for transactions, foreign keys, and row-level locking instead of MyISAM.

QualityMySQL & MariaDB

Enable strict SQL mode

HIGH

Run with STRICT_TRANS_TABLES so invalid or out-of-range values error instead of silently changing.

QualityMySQL & MariaDB

Define foreign keys for referential integrity

MEDIUM

Declare FOREIGN KEY constraints so the database enforces valid references between tables.

QualityMySQL & MariaDB

Use timestamptz, not timestamp, for points in time

MEDIUM

Store points in time as timestamptz so values are unambiguous across time zones and DST.

QualityPostgreSQL

Use CHECK constraints to enforce invariants

MEDIUM

Encode column and row invariants as CHECK constraints so bad data is rejected at the database.

QualityPostgreSQL

Use generated (stored) columns for derived values

MEDIUM

Compute derived values with GENERATED ALWAYS AS ... STORED instead of duplicating logic in every writer.

QualityPostgreSQL

Prefer text over varchar(n)

MEDIUM

Use text (optionally with a CHECK) instead of varchar(n); the length cap adds no performance benefit.

QualityPostgreSQL

Prefer identity columns (or uuid) over serial

MEDIUM

Use GENERATED ... AS IDENTITY or uuid for surrogate keys instead of the legacy serial pseudo-type.

QualityPostgreSQL

Use NUMERIC for money, never float

MEDIUM

Store monetary amounts as numeric/decimal so values are exact; binary floats introduce rounding errors.

QualityPostgreSQL

Use the narrowest correct data types

MEDIUM

Pick the smallest type that fits the domain instead of defaulting everything to text or bigint.

QualitySQL & Databases

Wrap multi-step writes in transactions

HIGH

Group related write operations in a single transaction so they commit or roll back atomically.

QualitySQL & Databases

Add NOT NULL and appropriate constraints

MEDIUM

Enforce data integrity at the schema level with NOT NULL, UNIQUE, CHECK, and FK constraints.

QualitySQL & Databases

Manage schema changes with versioned migrations

MEDIUM

Apply every schema change through ordered, reviewed migration files in version control.

QualitySQL & Databases

Prefer union string literals (or `as const`) over `enum`

MEDIUM

Use union string literals instead of `enum` for simpler types, better inference, and zero runtime cost.

QualityTypeScript

Don't use non-null assertions (`!`) — handle null explicitly

HIGH

The `!` operator lies to the compiler about null/undefined. Check and handle the empty case explicitly.

QualityTypeScript

Use exhaustive `switch` with a `never` default

MEDIUM

Add a `default` branch that assigns to `never` so adding a union member becomes a compile error until handled.

QualityTypeScript

Prefer `readonly`/immutable types where possible

MEDIUM

Mark properties and arrays `readonly` so accidental mutation is a compile error.

QualityTypeScript

Enable `noUncheckedIndexedAccess`

MEDIUM

Turn on `noUncheckedIndexedAccess` so index access includes `undefined` and forces a presence check.

QualityTypeScript

Type function returns at module boundaries

MEDIUM

Annotate return types of exported functions to lock the public contract and surface errors at the source.

QualityTypeScript

Use `satisfies` to validate without widening

MEDIUM

Use `satisfies` to check a value against a type while keeping its precise inferred literal type.

QualityTypeScript

Brand primitive IDs to prevent mix-ups

MEDIUM

Give string/number IDs a branded type so a `UserId` can't be passed where an `OrderId` is expected.

QualityTypeScript

Lean on inference, annotate public API boundaries

MEDIUM

Let TypeScript infer local types; add explicit annotations on exported functions and module boundaries.

QualityTypeScript

Never silently swallow errors

HIGH

An empty or log-only catch block hides failures, leaving the app in an inconsistent state with no diagnostic trail. Always handle, rethrow, or surface caught errors.

QualityError Handling