AI Coding Rules Generator
Pick your stack and download a clean CLAUDE.md, AGENTS.md, .cursorrules, or .windsurfrules file so your AI editor stops shipping open tables, exposed keys, and broken webhooks.
1. Target Rule File
5. Security Guardrails
CLAUDE.md
# CLAUDE.md - Project Engineering & Security Guardrails # Generated with https://vibecodedetector.com/rules-builder ## Stack Context - Framework: Next.js (App Router + TypeScript) - Database: Supabase (Postgres + Auth) - Billing: Stripe Checkout & Webhooks ## Core Working Rules - Make small, focused diffs. Do not refactor unrelated files or invent new dependencies without checking the package manifest first. - Verify every package name exists before installing it so hallucinated or typosquatted packages never enter the lockfile. - Keep code clean, strictly typed, and testable. Run typecheck and tests after every meaningful change. ## Framework Guidelines (Next.js (App Router + TypeScript)) - Use Next.js App Router with strict TypeScript. Keep secrets, DB clients, and admin keys strictly in server components or Route Handlers. - Never prefix private secrets with `NEXT_PUBLIC_`. Only public anon keys or public URLs belong in `NEXT_PUBLIC_*`. - Validate all API route request bodies and query parameters before reading or mutating state. - Keep `productionBrowserSourceMaps: false` and ship strict security headers (`HSTS`, `X-Frame-Options: DENY`, `X-Content-Type-Options: nosniff`). ## Database & Data Access (Supabase (Postgres + Auth)) - Enable Row Level Security (`ALTER TABLE ... ENABLE ROW LEVEL SECURITY`) on every public schema table in the same migration that creates it. - Never expose `SUPABASE_SERVICE_ROLE_KEY` in client code, browser bundles, or `NEXT_PUBLIC_*` env vars. - Scope every RLS policy to `auth.uid() = user_id` and test unauthenticated `anon` reads before shipping. ## Payments & Entitlements (Stripe Checkout & Webhooks) - Grant paid entitlements ONLY inside a server-side webhook verified via `stripe.webhooks.constructEvent(...)` using the raw request body. - Never unlock paid features based on `?success=true` query parameters or client-side checkout state. - Store `stripe_event_id` idempotently so duplicate webhook deliveries cannot double-credit accounts. ## Non-Negotiable Pre-Launch Security Guardrails - Never commit `.env` files, API keys, private keys, or webhook secrets. Keep `.env.local` in `.gitignore` and redact secrets from logs. - Every state-changing API route (`POST`, `PUT`, `PATCH`, `DELETE`) must verify the authenticated session server-side before reading or modifying user data. - Validate all external payloads, URLs, and webhooks at runtime with strict schemas (e.g. Zod or Pydantic) and reject unknown fields on sensitive endpoints. - Confirm RLS is enabled and deny-by-default on every Supabase table before merging any migration. ## Before Shipping Checklist - Run a pre-launch security scan (URL, GitHub repo, or private folder with zero upload) at https://vibecodedetector.com/ - Verify `package.json` dependencies, HTTP security headers, and auth guards before deploying to production.
The State of AI Vibe: Stay ahead in 3 minutes every Monday.
Everything that changed in AI coding this week: new frontier & open-weight models, live benchmark shifts, API price drops, $0 free tiers, urgent security fixes, and rising open-source tools. Zero hype, 1-click unsubscribe.