Browse 225 rules, 42 knowledge articles, and 28 prompt templates across security, performance, architecture, and quality.
225 rules
Use supabase gen types typescript to generate types from your schema, then pass them as a generic: createClient<Database>().
Per Supabase docs: do not run code between createServerClient and supabase.auth.getUser(). A simple mistake could cause random logouts.
Use createClient() for authenticated pages (RLS enforced), createAdminClient() for server-side writes (service_role), and createReadOnlyClient() for public pages (anon key).
Use Promise.all for independent Supabase queries instead of sequential await chains.
Supabase client calls are NOT automatically deduplicated like fetch(). Querying the same data in layout.tsx and page.tsx doubles database load.
Public pages (explore, content detail) should use createReadOnlyClient() with the anon key, not the service_role.
Fetch data in async server components instead of client-side useEffect + fetch patterns.
Add import "server-only" to any module that uses secrets, database connections, or server-only APIs.
Organize routes using parenthesized layout groups like (auth), (dashboard), (content), (marketing) for separate layouts and clear separation of concerns.
Every table must have Row Level Security enabled. Tables without RLS are fully accessible via the anon key.
Centralize shared logic (auth, database clients, formatters) in a lib/ directory to avoid duplication.
Always check the error field from Supabase queries. The client returns { data, error } and never throws.
Wrapping auth.uid() in (select ...) ensures it's evaluated once per query instead of once per row.
Keep page.tsx, layout.tsx, loading.tsx, and error.tsx together in the same route segment directory.
Place server actions in separate *-actions.ts files rather than inline in page components.
For data that changes frequently (notifications, dashboards), use SWR or React Query instead of manual useEffect + fetch.
Name files and directories in kebab-case (lowercase with hyphens) to avoid cross-platform case sensitivity issues.
Use database triggers to auto-update updated_at instead of setting it in application code.
Add loading.tsx to route segments with slow data fetching. It provides instant visual feedback during navigation.
Every route group should have an error.tsx to prevent crashes from propagating to the entire app.
Server components can query Supabase directly. Don't create API route middlemen just to proxy Supabase queries.
When a dynamic route param doesn't match any record, call notFound() from next/navigation to show the 404 page.
Use atomic design to structure components: atoms (Button, Input), molecules (SearchBar, FormField), organisms (Header, Sidebar).
Always use environment variables for API keys, database credentials, and other secrets.
BeforeMerge scans your pull requests against these rules automatically. Get actionable feedback before code ships to production.