Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/sawrus/agent-guides/db-performancenpx skills add sawrus/agent-guides --skill db-performancegit clone --depth 1 https://github.com/sawrus/agent-guidesWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/sawrus/agent-guides/db-performance)<a href="https://agentmods.dev/skills/sawrus/agent-guides/db-performance"><img src="https://agentmods.dev/badge/skills/sawrus/agent-guides/db-performance.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00032 | $0.01714 |
| Opus 5 | $0.00016 | $0.00857 |
| Sonnet 5 | $0.00006 | $0.00343 |
| Haiku 4.5 | $0.00003 | $0.00171 |
Grade A, and why
db-performance scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 206 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Skill: Database Performance
Expertise: EXPLAIN ANALYZE, index design (partial/covering), pg_stat_statements, autovacuum tuning, PgBouncer sizing.
When to load
When investigating slow queries, designing indexes, tuning PostgreSQL config, or sizing PgBouncer pools.
Query Analysis with pg_stat_statements
-- Enable (add to postgresql.conf, then restart or reload)
-- shared_preload_libraries = 'pg_stat_statements'
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
-- Top 10 slowest queries by total time
SELECT
left(query, 120) AS query_snippet,
calls,
round(total_exec_time::numeric, 2) AS total_ms,
round(mean_exec_time::numeric, 2) AS mean_ms,
round(stddev_exec_time::numeric, 2) AS stddev_ms,
rows
FROM pg_stat_statements
ORDER BY total_exec_time DESC
LIMIT 10;
-- Top queries by mean execution time (find worst-per-call)
SELECT
left(query, 120),
calls,
round(mean_exec_time::numeric, 2) AS mean_ms,
round(rows::numeric / calls, 1) AS rows_per_call
FROM pg_stat_statements
WHERE calls > 100 -- ignore one-offs
ORDER BY mean_exec_time DESC
LIMIT 10;
-- Queries with high I/O (missing index candidates)
SELECT
left(query, 120),
calls,
round(mean_exec_time::numeric, 1) AS mean_ms,
shared_blks_read + shared_blks_hit AS total_blocks,
round(shared_blks_hit::numeric / NULLIF(shared_blks_hit + shared_blks_read, 0) * 100, 1) AS cache_hit_pct
FROM pg_stat_statements
WHERE calls > 50
ORDER BY shared_blks_read DESC
LIMIT 10;
-- Reset stats after tuning
SELECT pg_stat_statements_reset();
EXPLAIN ANALYZE (reading execution plans)
-- Always use ANALYZE BUFFERS for real cost data
EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT)
SELECT o.*, c.email
FROM orders o
JOIN customers c ON c.id = o.customer_id
WHERE o.status = 'pending'
AND o.created_at > now() - interval '7 days';
/* Reading the output:
Seq Scan → full table scan, may need index
Index Scan → good, using index
Index Only Scan → best, covering index (no heap access)
Nested Loop → OK for small datasets; bad for large
Hash Join → good for large joins
Merge Join → good for pre-sorted data
Key numbers:
- actual time=START..END ms per row
- rows=N vs rows=N (estimated vs actual — big diff = stale stats)
- Buffers: hit=N read=N (high 'read' = cache miss → index opportunity)
*/
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 4d ago First seen · 206 lines · 32 tokens per session scan A 31835792121c
db-performance is a skill published in the GitHub repository sawrus/agent-guides (17 stars, last pushed 3d ago), licensed MIT. It adds 32 tokens to every session and 1,714 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
deprecation-and-migration
Manages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset…
db
Connect to any database — Cloud SQL, PostgreSQL, Snowflake, Databricks, Athena, Presto, or Oracle.
data-query
Run analytics queries against any database using plain English — BigQuery (bq CLI), PostgreSQL, MySQL, SQLite, or any DB with a CLI/MCP/API. Use when you need to pull metrics, analyze data, or answer business questions without writing SQL.
database-migration-guardian
Activate when writing, reviewing, or applying database migrations in PostgreSQL, MySQL, Prisma, or Drizzle to prevent table locks, zero-downtime failures, and data loss — trigger phrasings include "review this database migration", "how do I add a NOT NULL column without downtime", "write a safe PostgreSQL migration"…
db-architect
Activate when a developer needs to model relational schemas, parse SQL DDL statements, generate Mermaid Entity-Relationship Diagrams (ERD), analyze primary/foreign key relationships, or normalize database tables — trigger phrasings include "generate an ERD for my database", "convert this SQL schema to Mermaid"…
devops-vercel-render-deploy
Activate when deploying web applications, Next.js frontends, Node/Python backends, or PostgreSQL databases to cloud hosting platforms (Vercel, Render, Supabase, Railway) — trigger phrasings include "deploy my project to Vercel", "how do I host this Next.js app", "deploy backend to Render", "setup Supabase database"…