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:
Previous1...345...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

Don't expose internal errors or stack traces to users

HIGH

Return a generic, safe message to clients while logging full details server-side. Leaking stack traces, SQL, or file paths aids attackers and confuses users.

QualityError Handling

Retry transient failures with exponential backoff

MEDIUM

Retry idempotent operations that fail transiently (network blips, rate limits) using exponential backoff with jitter and a max attempt cap — but never retry non-idempotent or permanent failures.

Quality

Narrow caught errors and rethrow what you can't handle

MEDIUM

Inspect the caught error, handle only the cases you understand, and rethrow the rest. A blanket catch that absorbs every error masks unrelated bugs.

Quality

Handle async errors and promise rejections

MEDIUM

Await promises inside try/catch and never leave a promise unhandled. An unhandled rejection can crash the process or silently drop a failure.

QualityError Handling

Use Result-style returns for expected failures

MEDIUM

Model predictable outcomes (validation, not-found, parse failures) as typed return values; reserve throwing for truly exceptional conditions. This makes failure paths explicit and type-checked.

Quality

Clean up shared state between tests

HIGH

Reset databases, mocks, globals, and temp files in teardown so each test starts fresh.

QualityTesting

Avoid conditionals and loops in test logic

MEDIUM

Keep tests straight-line; branching or computed expectations can hide bugs in the test itself.

QualityTesting

Treat coverage as a signal, not a target

MEDIUM

Use coverage to find untested risk, not as a quota that rewards assertion-free tests.

QualityTesting

Name tests by the behavior they verify

MEDIUM

Use descriptive names stating condition and expected outcome so failures read like a spec.

QualityTesting

Make tests deterministic — no real clock, network, or randomness

HIGH

Inject or mock time, network, and random sources so tests produce the same result every run.

QualityTesting

Assert one logical concept per test

MEDIUM

Each test should verify a single behavior so a failure points to exactly one cause.

QualityTesting

Mock at boundaries, not internal collaborators

MEDIUM

Stub external systems (network, DB, filesystem) but let internal objects run for real.

QualityTesting

Test edge cases and error paths, not just the happy path

MEDIUM

Cover empty inputs, boundaries, and failure modes where most real defects live.

QualityTesting

Structure tests with Arrange-Act-Assert

MEDIUM

Separate setup, the single action under test, and assertions into clear phases for readable tests.

QualityTesting

Follow the test pyramid — many unit, fewer integration, fewest E2E

MEDIUM

Favor fast isolated unit tests; reserve slow integration and E2E tests for critical flows.

QualityTesting

Protect Main with Required Reviews and CI

MEDIUM

Enforce branch protection on main: require pull-request review and passing CI before any merge.

Architecture

Don't Commit Large Binaries — Use Git LFS

MEDIUM

Keep large binary assets out of normal Git history; track them with Git LFS to avoid permanently bloating clones.

QualityGit

Keep History Linear with Squash or Rebase

MEDIUM

Prefer squash or rebase merges (per team policy) to keep main history linear and easy to read, bisect, and revert.

Architecture

Reference the Issue or Ticket

MEDIUM

Link commits and pull requests to their tracking issue or ticket so changes stay traceable to their why.

QualityGit

Never Force-Push Shared or Protected Branches

HIGH

Avoid force-pushing branches others build on; rewriting shared history destroys collaborators' work.

QualityGit

Never Commit Build Artifacts or Dependencies

HIGH

Keep generated output and installed dependencies out of version control by listing them in .gitignore.

QualityGit

Open Small, Reviewable Pull Requests

MEDIUM

Scope each pull request to one logical change so reviewers can understand it quickly and catch defects.

Architecture

Keep Branches Short-Lived and Updated

MEDIUM

Keep feature branches small and short-lived, rebasing or merging from the base branch often to avoid drift and painful conflicts.

Architecture

Use Conventional Commits Format

MEDIUM

Structure commit messages as type(scope): subject so history is machine-readable and changelogs/versioning can be automated.

QualityGit
Error Handling
Error Handling
Error Handling
Git
Git
Git
Git