database
Skill1 starsChanged 17 days agoMITView on GitHub
Unified database department: read-only query execution with defense-in-depth safety, schema exploration, slow-query triage with EXPLAIN ANALYZE and pg_stat_statements, missing and covering index design, RLS policy authoring with verification tests, performance optimization with memory and query tuning, zero-downtime migration locking guards, and production operations with pooling partitioning and monitoring — handles Postgres, MySQL, MSSQL, and SQLite through twelve modes. Use when asked to run a read-only query, explore a schema, diagnose a slow query, design an index, optimize database performance, write or verify an RLS policy, tune vacuuming, size connection pooling, guard database migrations, or operate a database. Not for backend app code (webdev), infra and deploy pipelines (devops), or platform operations.
We split this skill into the rules it gives an agent
4 rules. 0 are common, 4 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 20 edited versions we read keep these.
4
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 40
Every invocation resolves to exactly one mode.
- Distinctive: line 54
Only the resolved mode's reference is loaded — the rest stay on disk, saving tokens on every run.
- Distinctive: line 74
Run before reporting completion:
- Distinctive: line 126
Every recommendation cites the mechanism (plan node, stat row, policy test) that proves it.
“Common” is measured: kept by at least 6 in 10 of the 20 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
🗄️ database — Unified Database Department
One head skill for all database work. Query read-only, diagnose the slow query, index what matters, guard the rows, keep production healthy. Every mode runs handsfree — defaults are stated inline, assumptions recorded in the deliverable, zero questions asked.
Default stack: self-hosted Postgres 16+ with pg_stat_statements enabled for the diagnose/index/guard/operate modes; the query mode works with any SQL database that has a connection config. Supabase-approved references linked per mode where applicable. Supabase platform operations (dashboard, Auth service, Edge Functions) are linked out, never duplicated.
Modes
Every invocation resolves to exactly one mode. Match the request, then load only the matched reference:
| Mode | Trigger phrases | Behavior | Reference |
| query | "run a query", "select from", "query the database", "read from table" | Read-only query execution with defense-in-depth safety: config discovery, credential protection, query whitelist, single-statement enforcement, timeout, row/col caps, tabular output | references/query.md |
| diagnose | "slow query", "why is this slow", "EXPLAIN this", "high CPU", "timeouts" | Slow-query triage: pg_stat_statements ranking, EXPLAIN ANALYZE read, bloat and vacuum checks | references/diagnose.md |
| index | "design an index", "missing index", "covering index", "N+1", "FK is slow" | Missing, composite, covering, partial, and FK indexes plus N+1 and batch-upsert patterns | references/index.md |
| guard | "write an RLS policy", "verify RLS", "security invoker", "PK strategy", "row visible to wrong tenant" | RLS authoring with verification tests, security_invoker views, PK and identifier rules | references/guard.md |
| operate | "pooling", "partition this table", "pgvector", "locks", "vacuum tuning", "connection exhaustion" | Pooling, partitioning, pgvector basics, lock triage, and monitoring | references/operate.md |
| optimize | "optimize query", "database tuning", "slow query optimization", "work_mem", "buffer pool", "database-optimizer" | Deep performance tuning: execution plan diffing, memory tuning (shared_buffers, work_mem), query rewriting, and deadlock elimination | references/optimize.md |
| migrations | "database migration", "zero-downtime migration", "DDL locks", "table rewrite", "unindexed FK" | Zero-downtime migration guard: DDL lock simulation, table rewrite prevention, non-blocking constraints, and unindexed foreign key share-lock protection | references/migrations.md |
| graph | "database graph", "cognitive graph", "knowledge graph", "temporal triples", "entity graph", "graph traversal" | Bi-directional cognitive knowledge graph, temporal triples, sub-10ms traversal, and tenant fencing | references/graph.md |
| audit | "audit the database", "query audit", "performance audit", "debug slow queries" | Query audit (read-only verification, config paths) + performance audit (EXPLAIN plans, index gaps) | references/audit.md |
Only the resolved mode's reference is loaded — the rest stay on disk, saving tokens on every run.
Deep-dive references (load on topic, no separate mode)
Mode behavior is fixed; these extend a resolved mode when the request dips deeper than its playbook:
- Vector/hybrid search (embeddings, HNSW vs IVF, payload filters, hybrid FTS+vector, RAG chunking; Qdrant default, pgvector fallback) → references/vector-search.md
- Analytical query modes (columnar/DuckDB vs OLTP routing, aggregation-window analysis) and Neon/Supabase autoscaling + zero-downtime migration → references/analytical.md
Load alongside operate for vector basics or query for aggregation routing.
Support references (load on topic)
Loadable by topic; also routable as /database-<file> commands (not separate routed modes):
- tuning.md
Verification
Run before reporting completion:
- Query executed read-only (
SELECT/SHOW/EXPLAINonly — noINSERT/UPDATE/DELETE) - Query config path verified —
references/query.mdconfig discovery resolved - Output row/col limits respected (default 100 rows × 10 cols)
- Single-statement enforced (no
;-chained writes) - Migrations checked with migration guard (zero table rewrites, lock_timeout set, concurrent indexing, non-blocking FKs)
- Connection closed after query
- For diagnosis:
pg_stat_statementsranked beforeEXPLAIN ANALYZE
For connection testing: verify-connection live-checks the configured DSN, confirms read-write intent is absent.
Full audit-mode spec: skills/references/audit-mode-guidance.md.
When to Use
- Running read-only SELECT/SHOW/EXPLAIN queries against a configured database.
- Exploring database schemas: listing tables, columns, indexes, foreign keys.
- Diagnosing a slow query, high CPU, timeouts, or connection exhaustion.
- Designing indexes: missing, composite, covering, partial, FK, or vector.
- Writing or verifying RLS policies and secure views.
- Choosing PK strategy, identifiers, and constraints for a new schema.
- Sizing connection pools, partitioning tables, triaging locks, tuning vacuum.
- Designing vector/hybrid search, routing analytical (columnar) queries, or planning Neon/Supabase autoscaling and zero-downtime migrations.
Anti-Triggers
- Backend application code around the database (queries in app code, ORM models) →
webdev. - Infrastructure and deploy pipelines (servers, CI/CD, backups, restores) →
devops. - Supabase platform operations (dashboard settings, Auth service config, Edge Functions) → link out to Supabase docs, never duplicate here.
- Pre-launch verification of the app built on the database →
qa-launch.
Quick Reference
Routing ladder (decide before any mode)
| Question | Mode |
| 'Run this query and show me the results' | query |
| 'Which query is slow, and what does its plan say?' | diagnose |
| 'What index makes this fast without breaking writes?' | index |
| 'Who may see this row, and is it proven?' | guard |
| 'Will production stay healthy under load?' | operate |
Order: query → diagnose → index → guard → operate. Get the data, find the bottleneck, fix access paths, lock down rows, then harden operations.
Verification gate (every mode)
- The target is named: exact query, table, policy, or connection symptom — never "the database is slow".
- Every recommendation cites the mechanism (plan node, stat row, policy test) that proves it.
- Index changes state write cost and use
CONCURRENTLYon production tables. - RLS changes ship with a verification test showing allowed and denied rows.
- Production commands are read-only first; mutating commands are flagged before delivery.
- Query mode: credentials never appear in output; connection config is permission-checked before use.
Suite contracts
- Application code using the tuned queries →
webdev. - Deploying migrations, pools, or partitions →
devops. - Verifying the app release built on this database →
qa-launch.
Procedure
- Intake. establish the target (query text, table, policy, or symptom) and the environment (self-hosted version or Supabase project ref, which database type) before touching anything — tuning without a target optimizes noise.
- Resolve the mode. Match the request against the mode table; exactly one mode. Ambiguous → default to diagnose, state the assumption, proceed.
- Execute the mode playbook. Load
references/<mode>.mdand follow its Intake → Deliverable → Procedure → Quality gate in order. - Gate and deliver. Pass this file's Verification checklist plus the mode's quality gate, then deliver SQL plus evidence where the operator expects it.
Pitfalls
- Tuning without
EXPLAIN (ANALYZE, BUFFERS)— guessing which index helps. - Adding indexes for every filter — write amplification and bloat; prove with the plan.
- RLS policies calling
auth.uid()per row instead of(select auth.uid())— full-scan penalty on every query. SECURITY DEFINERfunctions orsecurity_invoker = falseviews in public schemas — privilege escalation path.- Pooling in session mode by default — exhausts connections; transaction mode fits most apps.
- Long transactions and missing FK indexes — lock queues and cascade scans.
- Random UUIDv4 PKs on large tables — index fragmentation; prefer identity or UUIDv7.
- Running write queries through the query mode — the query mode is read-only by default; INSERT/UPDATE/DELETE/MERGE are rejected at the gate.
- Credentials in error output — query mode sanitizes authentication errors before display.
Verification
- Exactly one mode resolved and its reference playbook followed end to end.
- Target named: query, table, policy, or symptom with environment.
- Every recommendation traces to plan output, stat row, or test evidence.
- Index DDL states write cost and uses
CONCURRENTLYfor production. - RLS work ships passing verification tests (allowed and denied rows).
- Query mode: read-only enforced, credentials sanitized, timeout/row-cap honored.
- No Supabase platform ops duplicated; links used instead.
- App-code, infra, and release work routed to
webdev,devops,qa-launch.
Other versions29 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 29
- gridaco/grida★ 2.7ksame name
- theopenco/llmgateway★ 1.7ksame name
- AsiaOstrich/universal-dev-standards★ 82same name
- msrv-tech/skills★ 60same name
- manu14357/Zelaxy★ 15same name
- darknecrocities/SkillBuilder★ 13same name
- YepAPI/skills★ 8same name
- The-Utopia-Studio/skills★ 6same name
- jholhewres/devclaw-skills★ 4same name
- SecuringTheRealm/str-agentic-adventures★ 4same name
19 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.
Used alongsideProjects with it also use monitoring, performance and 8 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.
cwklurksSkillmonitoring
Also in 3 projects that use this
klauswgSkillperformance
Optimize web performance for faster loading and better user experience. Use when asked to "speed up my site", "optimize performance", "reduce load time", "fix slow loading", "improve page speed", or "performance audit".
Also in 6 projects that use this
0xSeroSkillsecurity
Also in 9 projects that use this
JohnJBorenSkillci-cd
CI/CD pipeline design, GitHub Actions, testing automation, and deployment strategies
Also in 3 projects that use this
NVIDIASkilltesting
Run Python and Rust tests for physicsnemo-curator using uv + pytest with coverage reporting via pytest-cov, and cargo-nextest for Rust tests. Includes benchmark workflows with pytest-benchmark and criterion.
Also in 9 projects that use this
MicrosoftSkillapi-design
Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.
Also in 6 projects that use this
In this repository49 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- llms.txtllms.txt
- accountsSkill
- analyticsSkill
- automationSkill
- brandSkill
- client-commsSkill
- contentSkill
- crmSkill
- designSkill
- devopsSkill
- growthSkill
- gtmSkill
- incident-responseSkill
- mobileSkill
- opsSkill
- paidadsSkill
- qa-launchSkill
- researchSkill
- retainSkill
- sales-enablementSkill
- seoSkill
- smmSkill
- telegramSkill
- webdevSkill
- context-anchorSkill
- coupling-routerSkill
- evidence-ledgerSkill
- relaySkill
- secretarySkill
- gitSkill
- new-projectSkill
- updateagentsSkill
- updatedocsSkill
- animateSkill
- designscopeSkill
- refactorSkill
- auditSkill
- code-reviewSkill
- dead-letterSkill
- gauntlet-loopSkill
- humanizeSkill
- muse-securitySkill
- puaSkill
- clean-system-cacheSkill
- coachSkill
- periodic-retreatSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

