Know what to check —
before you merge.
An AI-native code review knowledge base. Structured rules with bad-to-good examples, CWE/OWASP mappings, and detection hints that your AI coding agent actually understands.
---
title: Enable RLS on Every Table
impact: CRITICAL
detection_grep: "CREATE TABLE public\."
---
CREATE TABLE public.documents (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
owner_id uuid REFERENCES auth.users(id),
title text NOT NULL,
content text
);
-- No RLS! Any user with the anon key can read/write all documents.
CREATE TABLE public.documents (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
owner_id uuid REFERENCES auth.users(id),
title text NOT NULL,
content text
);
ALTER TABLE public.documents ENABLE ROW LEVEL SECURITY;
-- Users can only see their own documents
CREATE POLICY "users read own documents"
ON public.documents FOR SELECT
USING (owner_id = auth.uid());
-- Users can only insert documents they own
CREATE POLICY "users insert own documents"
ON public.documents FOR INSERT
WITH CHECK (owner_id = auth.uid());
-- Users can only update their own documents
CREATE POLICY "users update own documents"
ON public.documents FOR UPDATE
USING (owner_id = auth.uid())
WITH CHECK (owner_id = auth.uid());
-- Users can only delete their own documents
CREATE POLICY "users delete own documents"
ON public.documents FOR DELETE
USING (owner_id = auth.uid());Code review is broken
Existing tools leave critical gaps between what gets caught and what ships to production.
Linters catch syntax, not logic
ESLint finds unused variables, not missing auth checks. Your linter won't tell you that a server action is missing CSRF protection.
AI tools review without context
Generic AI code reviews give shallow, inconsistent feedback. Without structured rules, every review is a coin flip of what gets caught.
"Looks good to me"
"Consider error handling"
"No issues found"
OWASP docs aren't actionable
Security standards describe vulnerabilities in the abstract. Developers need framework-specific bad-to-good examples they can act on immediately.
A03:2021 — Injection
"An application is vulnerable when user-supplied data is not validated, filtered, or sanitized…"
What BeforeMerge does differently
A knowledge base built for the age of AI-assisted development. Structured rules that both humans and AI agents can understand.
Structured rule format
Every rule has frontmatter metadata, bad-to-good code examples, impact levels, and detection hints. Machine-readable by design.
AI-native from day one
Rules are written for AI agents to consume. Install a skill, and your Claude Code, Cursor, or Codex session loads the rules automatically.
CWE & OWASP mapped
Every security rule maps to CWE identifiers and OWASP Top 10 categories. Compliance teams get traceability, developers get context.
Framework-specific
Not generic advice. Rules target Next.js App Router patterns, Supabase RLS, WordPress hooks, and SOLID architecture in practice.
19 skills, 172 rules
Each skill is a focused collection of code review rules for a specific framework or domain. Install only what you need.
Accessibility
4 rulesAPI Design
4 rulesArchitecture
20 rules- SOLID principles
- Repository pattern
- Service layers
- Dependency direction
beforemerge-wordpress-review
21 rules- Hook security
- SQL injection (wpdb)
- Nonce verification
- Object caching
CI/CD & DevOps
3 rulesError Handling
2 rulesGit
3 rulesManaged Databases
3 rulesMySQL & MariaDB
4 rulesNext.js
35 rules- App Router security
- Server Actions
- Performance patterns
- XSS prevention
Node.js Security
4 rulesPostgreSQL
7 rulesReact
21 rulesSQL & Databases
5 rulesSupabase
22 rules- RLS policies
- Auth patterns
- SQL injection
- Connection pooling
Tailwind CSS
3 rulesTesting
3 rulesTypeScript
5 rulesWeb Performance
3 rulesInstall any skill with npx skills add BeforeMerge/beforemerge-skills --skill <name>
Every rule follows a structured format
Rules are Markdown files with YAML frontmatter. The consistent structure makes them parseable by AI agents and easy for humans to contribute.
- 1
Frontmatter metadata
Every rule starts with structured YAML frontmatter: title, impact severity (CRITICAL/HIGH/MEDIUM/LOW), CWE and OWASP mappings for compliance, detection patterns for automated scanning, and categorization tags.
This metadata powers AI agents, scanner tools, and compliance reports — all from a single source of truth.
- 2
Bad code example
A realistic, framework-specific code snippet that demonstrates the vulnerability or anti-pattern exactly as it appears in production codebases.
Written to match real-world patterns — not contrived textbook examples. Your AI agent learns what to flag.
- 3
Good code example
The corrected version showing the secure, performant, or idiomatic way to write the same code, with explanatory inline comments.
AI agents use this to suggest specific fixes, not just point out problems. Developers see exactly what to change.
- 4
Detection patterns
Semgrep patterns, grep commands, and regex hints that automated tools use to find potential violations across entire codebases in seconds.
These auto-generate scanner configurations — connect a repo, and BeforeMerge starts finding issues immediately.
---
title: Enable RLS on Every Table
impact: CRITICAL
cwe: ["CWE-862"]
owasp: ["A01:2021"]
detection_grep: "create table"
tags: [security, supabase, rls]
---
## Enable RLS on Every Table
**Impact: CRITICAL**
Every Supabase table must have Row Level
Security enabled or data is publicly
accessible.
-- Bad: Table without RLS
create table posts (
id uuid primary key,
user_id uuid references auth.users,
content text
);
-- Anyone can read/write all posts
-- Good: RLS enabled with policy
create table posts (
id uuid primary key,
user_id uuid references auth.users,
content text
);
alter table posts enable row level security;
create policy "Users manage own posts"
on posts for all
using (auth.uid() = user_id);Get started in 30 seconds
No dashboard to configure. No CI pipeline to set up. One command, instant code review intelligence.
Install in one click or one command
Click the Install button on any rule, or run one CLI command. Works with Claude Code, Cursor, GitHub Copilot, Windsurf, Cline, Codex, Aider, and Continue.
$ npx @beforemerge/cli install nextjs-security --type skillsAI agent loads the rules
Your AI coding agent reads the structured rules automatically. Add them to your project config — the agent understands what to look for.
# Rules
Include: https://beforemerge.com/api/v1/public/rules/no-eval# Security Rules
@beforemerge/nextjs-security# Code Review
@beforemerge/react-best-practicesGet actionable feedback
Instead of vague suggestions, you get specific, framework-aware review feedback with bad-to-good examples and compliance mappings.
Be first to know when BeforeMerge launches
We're building a SaaS platform that automatically scans your PRs against these rules. Join the waitlist for early access.
Open source, MIT licensed
All 172rules are open source and free to use. The skills repo is community-driven — contribute new rules, improve existing ones, or build skills for new frameworks.
$ git clone beforemerge-skills
$ cd beforemerge-skills
$ cp templates/rule.md skills/my-skill/
# Write your rule, open a PR