backend-dev-guidelines
Skill4 starsChanged 12 months agoMITView on GitHub
Comprehensive backend development guide for Supabase Edge Functions + PostgreSQL. Use when working with Supabase (database, auth, storage, realtime), Edge Functions, PostgreSQL, Row-Level Security (RLS), Resend email, Stripe payments, or TypeScript backend patterns. Covers database design, auth flows, Edge Function patterns, RLS policies, email integration, payment processing, and deployment to Supabase.
- Reads credentials
- Commits and pushes
16 other projects use a version of this.
Adopted by
Most recently taken up by
- Metehan-Bicer/claude-code-startertheir own version, first seen Nov 1, 2026
- Bbeierle12/Skill-MCP-Claudetheir own version, first seen Nov 1, 2026
- davidanthonyn/claude-skillstheir own version, first seen Oct 20, 2026
- xfstudio/skillstheir own version, first seen Oct 13, 2026
- serithemage/claude-code-infrastructure-showcasetheir own version, first seen Oct 8, 2026
- langfuse/langfusetheir own version, first seen Oct 8, 2026
Used with
Projects with it also use tailwind-patterns, nodejs-backend-patterns and 6 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
xenitV1Skilltailwind-patterns
Tailwind CSS v4 principles. CSS-first configuration, container queries, modern patterns, design token architecture.
Also in 3 projects that use this
xfstudioSkillnodejs-backend-patterns
Build production-ready Node.js backend services with Express/Fastify, implementing middleware patterns, error handling, authentication, database integration, and API design best practices. Use when creating Node.js servers, REST APIs, GraphQL backends, or microservices architectures.
Also in 3 projects that use this
nek1987Skillsoftware-architecture
Guide for quality focused software architecture. This skill should be used when users want to write code, design architecture, analyze code, in any case that relates to software development.
Also in 3 projects that use this
xenitV1Skillclean-code
Pragmatic coding standards - concise, direct, no over-engineering, no unnecessary comments
Also in 3 projects that use this
OpenAISkilltest-driven-development
Use when implementing any feature or bugfix, before writing implementation code
Also in 3 projects that use this
OpenAISkillbrainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.
Also in 3 projects that use this
Other versions16 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 16
- langfuse/langfuse★ 37ksame name
- diet103/claude-code-infrastructure-showcase★ 10ksame name
- serithemage/claude-code-infrastructure-showcase★ 127same name
- litefuse/litefuse★ 102same name
- sabahattink/antigravity-fullstack-hq★ 30same name
- Bbeierle12/Skill-MCP-Claude★ 9same name
- xfstudio/skills★ 9same name
- serithemage/claude-code-demo★ 4same name
- weirdgme/Claude-code-infrastructure-showcase★ 4same name
- ai4brands-design/claude-skills★ 2same name
6 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository6 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- context-persistenceSkill
- frontend-dev-guidelinesSkill
- memory-managementSkill
- plan-approvalSkill
- skill-developerSkill
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 6 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 14 edited versions we read keep these.
6
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 323
When you need guidance on a specific topic, ask Claude to generate a resource file following the same pattern as the examples above.
- Distinctive: line 341
Not using Supabase?: Use the scaffold-customizer agent or manual replacement:
- Distinctive: line 357
Update "posts" table → your entities
- Distinctive: line 358
Update "users" → your user model
- Distinctive: line 359
Update business logic examples
- Distinctive: line 366
Keep error handling patterns
“Common” is measured: kept by at least 6 in 10 of the 14 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
📋 OPINIONATED SCAFFOLD: Modern Supabase + Edge Functions stack
Default Stack:
- Backend: Supabase Edge Functions (Deno runtime)
- Database: Supabase PostgreSQL + Row-Level Security
- Auth: Supabase Auth (JWT-based)
- Storage: Supabase Storage
- Email: Resend (transactional emails)
- Payments: Stripe (subscriptions + one-time)
- Language: TypeScript
- Deployment: Git push to Supabase
To customize: Run
/customize-scaffold backendor use the scaffold-customizer agent to adapt for Express, NestJS, Fastify, Django, Rails, Go, or other frameworks.
Backend Development Guidelines
Purpose
Establish consistency and best practices for Supabase-powered backends using Edge Functions, PostgreSQL with Row-Level Security, and TypeScript. This skill covers database design, authentication flows, API patterns, email integration, and payment processing.
When to Use This Skill
Automatically activates when working on:
- Creating or modifying Supabase Edge Functions
- Designing PostgreSQL database schemas
- Implementing Row-Level Security (RLS) policies
- Building authentication flows with Supabase Auth
- Integrating Supabase Storage for file uploads
- Sending transactional emails with Resend
- Processing payments with Stripe
- Input validation with Zod
- Testing with Supabase CLI
- Backend deployment and configuration
Quick Start
New Edge Function Checklist
- Function: Create in
supabase/functions/[name]/index.ts - Validation: Zod schema for input
- Auth: JWT verification with Supabase client
- Database: Use Supabase client with RLS
- Error handling: Try/catch with proper responses
- CORS: Configure allowed origins
- Tests: Local testing with Supabase CLI
- Deploy:
supabase functions deploy [name]
New Feature Checklist
- Database: Create migration with schema changes
- RLS: Add appropriate security policies
- Edge Function: Implement API endpoint
- Frontend Integration: Update Supabase client calls
- Testing: Test locally before deploy
- Monitoring: Check logs after deployment
Architecture Overview
Supabase Stack Architecture
HTTP Request
↓
Edge Function (Deno runtime)
↓
Supabase Client (Auth + validation)
↓
PostgreSQL Database (with RLS)
↓
Response with JSONKey Principle: Edge Functions are stateless, RLS enforces data security.
Integrations:
- Supabase Auth → JWT-based authentication
- Supabase Storage → File uploads and CDN
- Supabase Realtime → WebSocket subscriptions
- Resend → Transactional emails
- Stripe → Payment processing
See architecture-overview.md for complete details.
Directory Structure
project/
├── supabase/
│ ├── functions/ # Edge Functions
│ │ ├── create-user/
│ │ │ └── index.ts
│ │ ├── send-email/
│ │ │ └── index.ts
│ │ └── process-payment/
│ │ └── index.ts
│ ├── migrations/ # Database migrations
│ │ ├── 001_initial_schema.sql
│ │ ├── 002_add_rls.sql
│ │ └── 003_add_indexes.sql
│ ├── seed.sql # Test data
│ └── config.toml # Supabase config
├── lib/
│ └── supabase/
│ ├── client.ts # Supabase client setup
│ ├── auth.ts # Auth utilities
│ └── types.ts # Database types
└── types/
└── database.types.ts # Generated from schemaNaming Conventions:
- Edge Functions:
kebab-case-create-user,send-email - Database tables:
snake_case-user_profiles,subscription_plans - RLS policies:
snake_case-users_select_own,posts_insert_authenticated - TypeScript types:
PascalCase-UserProfile,SubscriptionPlan
Core Principles (7 Key Rules)
1. Edge Functions are Simple and Focused
// ❌ NEVER: 500-line Edge Function
Deno.serve(async (req) => {
// Massive logic...
});
// ✅ ALWAYS: Focused, single-purpose functions
Deno.serve(async (req) => {
const user = await getUserFromRequest(req);
const result = await createPost(user.id, req);
return new Response(JSON.stringify(result), { status: 201 });
});2. Always Verify JWT Tokens
import { createClient } from '@supabase/supabase-js';
const supabase = createClient(
Deno.env.get('SUPABASE_URL')!,
Deno.env.get('SUPABASE_ANON_KEY')!,
{
global: {
headers: { Authorization: req.headers.get('Authorization')! }
}
}
);
const { data: { user }, error } = await supabase.auth.getUser();
if (error || !user) {
return new Response('Unauthorized', { status: 401 });
}3. Use RLS for Data Security
-- Enable RLS on all tables
ALTER TABLE posts ENABLE ROW LEVEL SECURITY;
-- Users can only read their own data
CREATE POLICY "users_select_own" ON posts
FOR SELECT
USING (auth.uid() = user_id);
-- Users can only insert their own data
CREATE POLICY "posts_insert_own" ON posts
FOR INSERT
WITH CHECK (auth.uid() = user_id);4. Validate All Input with Zod
import { z } from 'zod';
const CreatePostSchema = z.object({
title: z.string().min(1).max(200),
content: z.string().min(1),
tags: z.array(z.string()).optional()
});
const body = await req.json();
const validated = CreatePostSchema.parse(body); // Throws if invalid5. Use Environment Variables via Deno.env
// ❌ NEVER: Hardcode secrets
const apiKey = 'sk_live_abc123';
// ✅ ALWAYS: Use environment variables
const apiKey = Deno.env.get('STRIPE_API_KEY')!;
const resendKey = Deno.env.get('RESEND_API_KEY')!;6. Handle Errors Gracefully
try {
const result = await performOperation();
return new Response(JSON.stringify({ success: true, data: result }), {
status: 200,
headers: { 'Content-Type': 'application/json' }
});
} catch (error) {
console.error('Operation failed:', error);
return new Response(JSON.stringify({
success: false,
error: error.message
}), {
status: 500,
headers: { 'Content-Type': 'application/json' }
});
}7. Test Locally Before Deploying
# Start Supabase locally
supabase start
# Test Edge Function locally
supabase functions serve create-user --env-file .env.local
# Run tests
curl -i http://localhost:54321/functions/v1/create-user \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{"email":"test@example.com"}'Common Imports
// Supabase
import { createClient } from '@supabase/supabase-js';
import type { Database } from '../types/database.types.ts';
// Validation
import { z } from 'zod';
// Email (Resend)
import { Resend } from 'resend';
// Payments (Stripe)
import Stripe from 'stripe';
// CORS helper
import { corsHeaders } from '../_shared/cors.ts';Quick Reference
HTTP Status Codes
| Code | Use Case |
| 200 | Success |
| 201 | Created |
| 204 | No Content (DELETE success) |
| 400 | Bad Request (validation error) |
| 401 | Unauthorized (no/invalid token) |
| 403 | Forbidden (valid token, no permission) |
| 404 | Not Found |
| 500 | Server Error |
Common Edge Function Patterns
Auth Check → Verify JWT, get user CRUD Operations → Create, Read, Update, Delete with RLS Email Sending → Resend integration Payment Processing → Stripe webhooks and charges File Upload → Supabase Storage integration
Anti-Patterns to Avoid
❌ Skipping JWT verification ❌ Querying database without RLS ❌ No input validation ❌ Exposing secrets in code ❌ Missing error handling ❌ Deploying without local testing ❌ Direct database access (bypassing RLS) ❌ console.log for production errors (use proper logging)
Example Resource Files
📝 Note: This is a scaffold skill with example resources. The provided resources demonstrate the pattern - you should generate additional resources as needed for your specific project.
✅ Provided Examples
architecture-overview.md - Complete Supabase stack architecture edge-functions-guide.md - Edge Function patterns and deployment database-and-rls.md - Database design and RLS policies
📋 Generate On-Demand
When you need guidance on a specific topic, ask Claude to generate a resource file following the same pattern as the examples above. Common topics:
- Validation patterns - Zod schemas and error handling
- Auth patterns - JWT verification, session management
- Storage patterns - File uploads, CDN, signed URLs
- Email integration - Resend templates and sending
- Stripe integration - Payments, subscriptions, webhooks
- Testing guide - Local testing, integration tests
- Complete examples - Full working Edge Function examples
How to request: "Generate a resource file for [topic] following the pattern in architecture-overview.md"
Customization Instructions
For Your Tech Stack
Not using Supabase? Use the scaffold-customizer agent or manual replacement:
# Option 1: Automated
# Claude will detect your stack and offer to customize
# Option 2: Manual find-and-replace
Supabase → Your database (Prisma, TypeORM, etc.)
Edge Functions → Your backend (Express, NestJS, etc.)
PostgreSQL → Your database (MySQL, MongoDB, etc.)
RLS → Your auth strategyFor Your Domain
Replace the generic examples with your domain:
- Update "posts" table → your entities
- Update "users" → your user model
- Update business logic examples
For Your Patterns
Adapt the principles to your architecture:
- Keep security-first approach
- Keep validation patterns
- Keep error handling patterns
- Adjust structure to your needs
Related Skills
- frontend-dev-guidelines - Next.js + React patterns for Supabase integration
- memory-management - Track architectural decisions
- skill-developer - Meta-skill for creating and managing skills
Skill Status: SCAFFOLD ✅ Line Count: < 500 ✅ Progressive Disclosure: Example resources + generation instructions ✅
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

