Works with the AI Agents you already use
Database, RLS, Payments & REST API Design Guide
by ScStudy5
Tier-aware guide for PostgreSQL/RLS schemas, idempotent payment & REST APIs (OpenAPI 3.1, RFC 9457), backup restore testing, and performance optimization.
Free
Database, RLS, Payments & REST API Design Guide
Example session with this skill installed
Design a PostgreSQL schema with Row Level Security and an idempotent OpenAPI 3.1 endpoint for order checkout in a Professional-tier (Level 2) multi-tenant SaaS, using RFC 9457 error responses.
- Read your context and instructions
- Compiled the database rls payments
1. PostgreSQL Schema & RLS Baseline
orderstable withid UUID PRIMARY KEY,tenant_id UUID NOT NULL,total_cents INTEGER NOT NULL CHECK (total_cents >= 0),idempotency_key UUID NOT NULL,created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), andupdated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()backed by aset_updated_at()trigger.- Composite unique constraint
UNIQUE (tenant_id, idempotency_key)to prevent duplicate charges under concurrent requests. ALTER TABLE public.orders ENABLE ROW LEVEL SECURITY;with scopedSELECT/INSERT/UPDATE/DELETEpolicies checking tenant ownership and zeroservice_roleexposure on the client.
2. OpenAPI 3.1 Contract (/v1/orders)
POST /v1/ordersrequiringIdempotency-Key(UUID header) and returning decoupled DTOs (201 Created) with server-calculated totals.- Standardized
application/problem+json(RFC 9457) schemas for401,409(duplicate idempotency key),422(field validation errors), and429(rate limit exceeded) withcorrelationIdpropagation.
3. Payment & Restore Verification
- Webhook signature verification, backend payment-state confirmation, Dead Letter Queue (DLQ) for failed async jobs, and a staging Restore Testing drill template with defined RPO/RTO targets.
Connects securely to your tools. The creator never sees your data.
About this skill
Design rock-solid databases, resilient REST APIs, and evidence-based performance optimizations without premature over-engineering.
This free engineering guide equips your AI coding agent with a structured, tier-aware workflow (MVP, Professional, and Enterprise) for planning, auditing, and generating production-ready data and API artifacts.
What It Covers
- Database Modeling & Integrity: Balanced normalization, referential integrity, SQL constraints (
NOT NULL,UNIQUE,CHECK,FOREIGN KEY), strategic indexing, bounded ACID transactions, connection pooling, UTCTIMESTAMPTZaudit columns withupdated_attriggers, versioned reversible migrations (including expand-and-contract patterns), strict production vs. dev/QA seed separation, and backup Restore Testing drills aligned with RTO/RPO targets. - Row Level Security (RLS) & Multi-Tenancy: Ready-to-adapt PostgreSQL/Supabase RLS baseline policies (
SELECT/INSERT/UPDATE/DELETE), cross-tenant access verification, Storage bucket permission checks, and strict protection of privileged keys. - API Contracts & RFC 9457 Errors: OpenAPI 3.1 contract baselines, endpoint versioning, decoupled DTOs, strict payload validation, standardized Problem Details (RFC 9457) error JSON examples (
401,409,422,429), pagination/filtering/sorting, rate limiting, CORS, explicit timeouts, exponential backoff retries with jitter, and Correlation IDs. - Payments, Concurrency & Async Resilience: Race-condition prevention,
Idempotency-Keyworkflows, PCI-DSS gateway delegation, webhook signature verification, dunning procedures for failed payments, Dead Letter Queues (DLQ), and Outbox patterns. - Performance & LLM API Hygiene: N+1 query prevention, projection over
SELECT *, caching with clear invalidation, Core Web Vitals budgets, debouncing/virtualization, and structured outputs, token quotas, fallbacks, and caching for LLM integrations.
Included Files (4)
SKILL.md— Core workflow, rigor levels, audit checklist, and verification criteria.references/databases-apis-performance.md— Full technical catalog covering databases, APIs, performance tiers, resilience, data governance, and LLM API cost/reliability controls.examples/OPENAPI_AND_RLS_BASELINE.md— Copy-ready OpenAPI 3.1 contract, PostgreSQL/Supabase RLS policy baseline, and Restore Testing drill log.examples/rfc9457-error-examples.json— Standardized Problem Details JSON templates for 422, 401, 409, and 429 responses.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse All Claude Skills.
This is an advisory engineering methodology and template pack—it does not execute live database migrations, run load tests (k6/JMeter), or connect directly to your database or payment provider. For full AI governance/prompt security, pair it with dedicated AI engineering or security review workflows.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 1 day ago
- Free with an Agensi account
Requires
Nothing to install.
Permissions
File Scopes
Reads project schema and API files to audit them and writes SQL, OpenAPI, or documentation artifacts only when requested. Makes no network calls.