-
Data Layer Defense Pack
Injection-proof queries, safe secrets handling, and schema guardrails for your database.
Prompts In This Pack
-
Database
Add a periodic data integrity audit
Runs scheduled consistency checks (orphans, bad states, drift) so data problems surface before users find them.
-
Database
Add database-level validation and constraints
Adds NOT NULL, CHECK constraints, and correct column types so bad data can't be written no matter what the app does.
-
Database
Add foreign keys and decide delete behavior
Enforces relationships at the database level and makes deletes cascade, restrict, or null out deliberately.
-
Database
Add the indexes my queries actually need
Reads your real queries, finds the lookups doing full collection scans, and adds the right indexes.
-
Database
Add pagination to every list endpoint
Replaces unbounded fetch-everything queries with cursor or offset pagination before tables get big.
-
Database
Guard seed and fixture data out of production
Adds environment guards so test users, demo records, and seed scripts can never run or leak into production.
-
Database
Add unique constraints where duplicates are bugs
Enforces uniqueness at the database level for emails, slugs, and one-per-user records so races can't create duplicates.
-
Security
Audit my auth flow for common vulnerabilities
Reviews your login, signup, and session handling for issues like missing rate limiting, weak token storage, and unprotected routes.
-
Database
Audit cascade deletes for accidental data loss
Traces every delete path to find cascades that could wipe out more data than intended.
-
Security
Audit my database's public access rules
Checks Supabase row-level security, Firebase rules, and client-exposed databases for tables anyone can read or write.
-
Database
Audit my schema for design mistakes that don't scale
Reviews your full data model for the structural choices that cause pain later: god tables, missing relationships, and fields doing two jobs.
-
Database
Find and fix slow queries with the slow query log
Enables slow query logging, ranks the worst offenders, and fixes them with indexes or rewrites.
-
Database
Find and drop indexes my app never uses
Uses database statistics to find indexes with zero or near-zero reads and removes them to speed up writes.
-
Database
Cap unbounded text fields
Adds length limits to user text fields and columns so no single record can bloat rows, pages, or payloads.
-
Database
Choose a safe ID strategy for records
Moves public-facing identifiers to unguessable IDs while keeping efficient internal keys, ending enumerable resource URLs.
-
Database
Design a schema for user-generated content
Plans tables, indexes, and relationships for posts, comments, and likes with sane defaults and soft-delete support.
-
Database
Enforce discipline on JSON fields
Audits schemaless JSON columns for structure drift and locks down validation, indexing, and size limits.
-
Database
Make sure tenants can't see each other's data
Audits every query in a multi-tenant app to confirm it is scoped by tenant or organization ID, and adds the missing filters.
-
Database
Handle concurrent writes without lost updates
Fixes read-modify-write races (counters, balances, inventory) with atomic operations or optimistic locking.
-
Security
Find and fix exposed environment variables
Scans your client-side code for API keys and secrets that should live on the server, then moves them behind a safe API layer.
-
Database
Fix my N+1 query problems
Finds loops that query per item and rewrites them as joins, eager loads, or batched lookups.
-
Database
Fix null vs. empty value handling
Standardizes when fields are null, empty string, or absent so reads stop breaking on inconsistent emptiness.
-
Database
Diagnose and fix database lock contention
Finds long-running transactions and lock-heavy code paths, then shortens transactions and adds deadlock retry handling.
-
Database
Make large data exports not kill the server
Moves CSV/JSON exports out of request handlers into streamed, background-generated downloads.
-
Database
Harden my database queries against injection
Refactors string-interpolated queries into parameterized statements and adds input validation at the boundary.
-
Database
Implement soft deletes without breaking queries
Adds deleted_at handling with every query updated to respect it, plus a purge path for real deletion.
-
Database
Audit my database network exposure and TLS
Confirms the database isn't reachable from the public internet and that connections use TLS with verified certificates.
-
Database
Find and fix database storage bloat
Identifies the tables eating disk (logs, dead rows, oversized payloads) and reclaims space with cleanup and maintenance.
-
Database
Write a database disaster recovery plan
Documents exactly what to do when the database is lost or corrupted, with timed restore drills and clear recovery targets.
-
Database
Backfill a big table without taking my app down
Plans and writes a batched, resumable backfill for populating a new column on a large production table.
-
Security
Prevent NoSQL injection in my queries
Stops query operator injection by validating input types and stripping $-prefixed keys before they reach the database.
-
Security
Restrict my app's database user permissions
Splits the app's database credentials away from superuser access and scopes them to what the app actually needs.
-
Deployment
Deploy database migrations without breaking production
Run schema changes safely against a live database with zero-downtime patterns and a plan for the bad case.
-
Database
Add query timeouts to database calls
Sets statement and request timeouts so slow or stuck queries fail fast instead of piling up behind a struggling database.
-
Database
Set up database connection pooling and timeouts
Configures a sane connection pool and query timeouts so traffic spikes can't exhaust your database connections.
-
Database
Set up data retention and cleanup jobs
Adds scheduled cleanup for expired sessions, stale tokens, old logs, and abandoned records so tables don't grow forever.
-
Database
Set up database backups and test a restore
Configures automated backups with retention, then actually restores one to prove it works.
-
Database
Set up real database migrations
Replaces manual schema edits and auto-sync with versioned, runnable migrations that work the same everywhere.
-
Database
Set up basic database monitoring
Adds visibility into connections, slow queries, disk growth, and locks with alerts before they become outages.
-
Database
Standardize date, time, and timezone handling
Audits how the app stores and displays dates so users in different timezones stop seeing wrong times and off-by-one dates.
-
Database
Stop storing money as floats
Finds every money value stored or calculated as a floating point number and converts it to integer cents or a decimal type.
-
Database
Wrap multi-step writes in transactions
Finds write flows that touch multiple records and makes them atomic so partial failures can't corrupt state.
Want to skip doing this by hand?
Fortivibe audits your app for all of the areas these prompts cover (and more).
More Prompt Packs
-
Launch-Ready Security Pack
Auth, secrets, injection, and headers. Everything you need to harden before launch.
-
Ship Fast Starter Pack
Deployment, caching, and automation prompts to get your app live with confidence.
-
Secure Accounts Essentials Pack
Lock down auth, secrets, and headers so user accounts stay safe from day one.
-
Payment Protection Pack
Webhooks, idempotency, refunds, and dunning. Stop payments issues before they start.
-
Test Before You Launch Pack
Unit, API, and end-to-end tests for the paths your users will actually hit on day one.
-
Speed Rescue Pack
Find and fix the slow queries, missing indexes, and heavy pages dragging your app down.