Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    Database, RLS, Payments & REST API Design Guide

    by ScStudy5

    1

    Tier-aware guide for PostgreSQL/RLS schemas, idempotent payment & REST APIs (OpenAPI 3.1, RFC 9457), backup restore testing, and performance optimization.

    Free

    Security scanned
    Database, RLS, Payments & REST API Design Guide

    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

    • orders table with id 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(), and updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW() backed by a set_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 scoped SELECT/INSERT/UPDATE/DELETE policies checking tenant ownership and zero service_role exposure on the client.

    2. OpenAPI 3.1 Contract (/v1/orders)

    • POST /v1/orders requiring Idempotency-Key (UUID header) and returning decoupled DTOs (201 Created) with server-calculated totals.
    • Standardized application/problem+json (RFC 9457) schemas for 401, 409 (duplicate idempotency key), 422 (field validation errors), and 429 (rate limit exceeded) with correlationId propagation.

    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, UTC TIMESTAMPTZ audit columns with updated_at triggers, 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-Key workflows, 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. 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. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 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

    Read Files
    Write Files

    File Scopes

    Project
    SQL
    schemas
    OpenAPI
    specs
    API
    controllers
    and
    generated
    baseline
    artifacts

    Reads project schema and API files to audit them and writes SQL, OpenAPI, or documentation artifacts only when requested. Makes no network calls.

    Listed1 day ago

    What's inside

    Frequently Asked Questions

    The bundled markdown instructions, reference catalog, and templates are written in Spanish, while code snippets and JSON examples use standard English identifiers. Modern multilingual AI agents read the Spanish guidance natively and produce all schemas, OpenAPI specs, code reviews, and documentation in English or whatever language you prompt in.

    No external tools, accounts, or API keys are required. The skill is a pure knowledge and template package that runs entirely inside your AI agent using local file read/write capabilities.

    Yes. The skill explicitly calibrates recommendations to three project tiers—Level 1 (MVP), Level 2 (Professional), and Level 3 (Enterprise)—so your agent avoids suggesting read replicas, Redis clusters, or DAMA-DMBOK governance for a small MVP while applying full rigor when scaling.

    It includes an OpenAPI 3.1 idempotent endpoint template, PostgreSQL/Supabase Row Level Security (RLS) policies, a backup Restore Testing checklist, and RFC 9457 Problem Details JSON error payloads.

    Free