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:
Previous12...15Next

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

354 rules

Avoid implicit type conversions in comparisons

MEDIUM

Compare columns against values of the same type to avoid silent casts that disable indexes.

PerformanceMySQL & MariaDB

Use EXPLAIN to verify query plans

MEDIUM

Run EXPLAIN on slow or important queries to confirm indexes are used and scans are bounded.

PerformanceMySQL & MariaDB

Keep WHERE clauses sargable

MEDIUM

Avoid wrapping indexed columns in functions so the optimizer can use the index.

PerformanceMySQL & MariaDB

Index columns used in JOIN, WHERE, and ORDER BY

MEDIUM

Add indexes on columns that appear in join conditions, filters, and sort clauses.

PerformanceMySQL & 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

Use the InnoDB storage engine

HIGH

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

QualityMySQL & MariaDB

Choose the narrowest correct column types

MEDIUM

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

QualityMySQL & MariaDB

Define foreign keys for referential integrity

MEDIUM

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

QualityMySQL & MariaDB

Set an appropriate transaction isolation level

MEDIUM

Choose an isolation level (e.g. READ COMMITTED) that matches your concurrency and consistency needs.

PerformanceMySQL & MariaDB

Use prepared, parameterized statements

HIGH

Bind user input as parameters rather than concatenating it into SQL strings.

SecurityMySQL & MariaDB

Rotate database credentials regularly and never share them

MEDIUM

Issue per-service credentials from a secrets manager, rotate them on a schedule, and keep them out of source control.

SecurityManaged Databases

Right-size the instance and monitor CPU, IO, and storage

MEDIUM

Match instance class and storage to actual load, and alert on CPU, IOPS, and free-storage thresholds before they are hit.

PerformanceManaged Databases

Require TLS/SSL on all database connections

HIGH

Enforce sslmode=require (or stricter, with CA verification) so no client can connect to the managed database over plaintext.

SecurityManaged Databases

Grant least-privilege roles; never let apps use superuser

HIGH

Create scoped application roles with only the privileges they need; reserve superuser/owner accounts for migrations and admin.

SecurityManaged Databases

Offload read traffic to read replicas where appropriate

MEDIUM

Route read-heavy or analytics queries to read replicas, keeping the primary focused on writes and consistency-critical reads.

Architecture

Set statement and idle-in-transaction timeouts

MEDIUM

Configure statement_timeout and idle_in_transaction_session_timeout so stuck queries and orphaned transactions are killed automatically.

PerformanceManaged Databases

Monitor connection-limit usage and slow queries

MEDIUM

Track connection count against max_connections and capture slow queries (e.g. via pg_stat_statements) with alerting thresholds.

PerformanceManaged Databases

Design for failover and high availability

MEDIUM

Use a multi-AZ/standby configuration and ensure the app reconnects cleanly on failover instead of caching a dead endpoint.

Architecture

Prefer text over varchar(n)

MEDIUM

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

QualityPostgreSQL

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

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 generated (stored) columns for derived values

MEDIUM

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

QualityPostgreSQL

Avoid long-held locks in migrations

HIGH

Set a lock_timeout, split steps, and add columns nullable-then-backfill to keep migration locks short.

PerformancePostgreSQL

Use NUMERIC for money, never float

MEDIUM

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

QualityPostgreSQL
Managed Databases
Managed Databases