[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M752MSPTTV4XNN7CAVGZZY69":3,"skill-same:01M752MSPTTV4XNN7CAVGZZY69":52},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":29,"commitSha":30,"skillDirectory":31,"forksCount":32,"repositoryHtmlUrl":33,"repositoryHomepageUrl":6,"ownerHtmlUrl":34,"ownerBlogUrl":35,"ownerDescription":36,"updatedAt":37,"install":38,"resources":51},"01M752MSPTTV4XNN7CAVGZZY69","postgres-dba",null,"Complete guide for DBA agents managing PostgreSQL databases — query execution, performance tuning, connection monitoring, index health, and VACUUM management. USE THIS SKILL whenever the user asks to inspect, diagnose, optimize, or manage a PostgreSQL database. Triggers include: 'show me slow queries', 'check table bloat', 'what connections are active', 'find unused indexes', 'why is my DB slow', 'run this SQL', or any Postgres health\u002Fdiagnostic task.","review-bench\u002Ftallclub_matimo","review-bench","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F286778065?v=4","01M7517F9NTEPDZDAXJBR30FWT","ReviewBench","01M752MJ9AMPM35VHCA4HV09DY",0,"MIT","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Ftallclub_matimo\u002Fblob\u002Fmain\u002Ftypescript\u002Fexamples\u002Fmcp\u002Fmatimo-tools\u002Fskills\u002Fpostgres-dba\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: postgres-dba\ndescription: \"Complete guide for DBA agents managing PostgreSQL databases — query execution, performance tuning, connection monitoring, index health, and VACUUM management. USE THIS SKILL whenever the user asks to inspect, diagnose, optimize, or manage a PostgreSQL database. Triggers include: 'show me slow queries', 'check table bloat', 'what connections are active', 'find unused indexes', 'why is my DB slow', 'run this SQL', or any Postgres health\u002Fdiagnostic task.\"\nversion: \"1.0.0\"\nlicense: \"MIT\"\nmetadata:\n  category: \"Database\"\n  difficulty: \"intermediate\"\n  apply-to: \"pg_run_query pg_table_stats pg_slow_queries pg_index_health pg_active_connections pg_vacuum_status\"\n---\n\n# PostgreSQL DBA Skill\n\nA complete skill for DBA agents to monitor, diagnose, and manage PostgreSQL databases using Matimo tools.\n\n## Prerequisites\n\nAll tools communicate with PostgreSQL via a REST API wrapper. Ensure:\n1. A REST API (PostgREST, custom Express\u002FFastAPI, or Supabase) is running and accessible.\n2. Two environment variables are set:\n   - `PG_API_URL` — Base URL of the REST API (e.g., `http:\u002F\u002Flocalhost:3000`)\n   - `PG_API_KEY` — Bearer token for authenticating with the REST API\n\nThe API must expose a `POST \u002Fquery` endpoint accepting `{ sql, database }` and returning `{ rows, rowCount, fields }`.\n\n---\n\n## Tools You Will Use\n\n| Tool | Purpose |\n|------|---------|\n| `pg_run_query` | Execute arbitrary read-only SQL SELECT statements |\n| `pg_table_stats` | Get table size, live\u002Fdead row counts, and VACUUM history |\n| `pg_slow_queries` | Fetch top slow queries from `pg_stat_statements` |\n| `pg_index_health` | Inspect index usage stats and identify unused indexes |\n| `pg_active_connections` | Monitor live connections and long-running transactions |\n| `pg_vacuum_status` | Check dead tuple counts and autovacuum status per table |\n\n---\n\n## Workflow 1: Health Check (Start Here)\n\nWhen a user asks \"how is my database doing?\", run this sequence:\n\n### Step 1 — Active Connections Snapshot\n```\npg_active_connections({ state: \"all\", minDurationSeconds: 0 })\n```\nLook for: high connection count, `idle in transaction` states, long-running queries (duration > 30s).\n\n### Step 2 — Table Health Overview\n```\npg_table_stats({ schema: \"public\" })\n```\nLook for: high `dead_rows` relative to `live_rows`, missing recent `last_autovacuum` timestamps.\n\n### Step 3 — VACUUM Pressure Check\n```\npg_vacuum_status({ schema: \"public\", deadTupleThreshold: 5000 })\n```\nLook for: `dead_pct` above 10%, stale `last_autovacuum` on high-write tables.\n\n### Step 4 — Index Health\n```\npg_index_health({ schema: \"public\", showUnused: true })\n```\nLook for: large indexes with 0 scans (storage waste and write overhead).\n\n---\n\n## Workflow 2: Performance Debugging\n\nWhen a user says \"the DB is slow\":\n\n### Step 1 — Find Long-Running Queries\n```\npg_active_connections({ state: \"active\", minDurationSeconds: 10 })\n```\nAny query over 10s is suspicious. If `wait_event` is `Lock`, there's contention.\n\n### Step 2 — Pull Slow Query Statistics\n```\npg_slow_queries({ limit: 20, minCalls: 5 })\n```\nKey columns:\n- `avg_ms` — Above 100ms warrants investigation.\n- `cache_hit_pct` — Below 95% means disk I\u002FO; consider indexes or increasing `shared_buffers`.\n- `stddev_ms` — High variance indicates lock waits or table bloat.\n\n### Step 3 — Check Index Coverage\n```\npg_index_health({ schema: \"public\", showUnused: false })\n```\nCross-reference slow queries with low-scan indexes.\n\n### Step 4 — Targeted Ad-Hoc Queries\n```\npg_run_query({ sql: \"SELECT * FROM pg_locks WHERE NOT granted\" })\n```\nUse for any diagnostic SQL not covered by specialist tools. Read-only SELECTs only.\n\n---\n\n## Workflow 3: Bloat and VACUUM Management\n\n### Step 1 — Find Bloated Tables\n```\npg_vacuum_status({ schema: \"public\", deadTupleThreshold: 10000 })\n```\nTables with `dead_pct` above 20% and stale `last_autovacuum` need attention.\n\n### Step 2 — Confirm with Table Stats\n```\npg_table_stats({ schema: \"public\", table: \"orders\" })\n```\nLarge gap between `table_size` and `total_size` indicates index bloat.\n\n### Step 3 — Report to User\nRecommend the DBA run directly in psql:\n```sql\nVACUUM ANALYZE tablename;\n-- For severe bloat (locks table, use off-hours):\nVACUUM FULL tablename;\n```\nDo NOT execute these via `pg_run_query` — they are write operations.\n\n---\n\n## Workflow 4: Index Optimization\n\n### Step 1 — List Unused Indexes\n```\npg_index_health({ schema: \"public\", showUnused: true })\n```\nAn index with `scans: 0` has never been used since last `pg_stat_reset()`.\n\n### Step 2 — Confirm Before Recommending Drops\nBefore recommending `DROP INDEX`:\n1. Verify it's not used by a constraint (PRIMARY KEY, UNIQUE).\n2. Check if stats were recently reset: `SELECT stats_reset FROM pg_stat_bgwriter`.\n3. Always get human DBA confirmation — dropping is irreversible.\n\nSafe drop command:\n```sql\nDROP INDEX CONCURRENTLY index_name;\n```\n\n---\n\n## Common Ad-Hoc Queries via `pg_run_query`\n\n### Check replication lag\n```sql\nSELECT client_addr, state, (sent_lsn - replay_lsn) AS replication_lag_bytes\nFROM pg_stat_replication;\n```\n\n### Tables missing primary keys\n```sql\nSELECT t.table_name FROM information_schema.tables t\nLEFT JOIN information_schema.table_constraints c\n  ON t.table_name = c.table_name AND c.constraint_type = 'PRIMARY KEY'\nWHERE t.table_schema = 'public' AND c.constraint_name IS NULL;\n```\n\n### Cache hit rate (target > 99%)\n```sql\nSELECT round(sum(blks_hit) * 100.0 \u002F sum(blks_hit + blks_read), 2) AS cache_hit_pct\nFROM pg_stat_database;\n```\n\n### Largest tables by disk usage\n```sql\nSELECT relname, pg_size_pretty(pg_total_relation_size(oid)) AS size\nFROM pg_class WHERE relkind = 'r'\nORDER BY pg_total_relation_size(oid) DESC LIMIT 10;\n```\n\n### Find duplicate indexes\n```sql\nSELECT indrelid::regclass AS table_name, array_agg(indexrelid::regclass) AS duplicate_indexes\nFROM pg_index GROUP BY indrelid, indkey HAVING COUNT(*) > 1;\n```\n\n---\n\n## Error Handling\n\n| Error | Cause | Resolution |\n|-------|-------|------------|\n| `401 Unauthorized` | Invalid `PG_API_KEY` | Verify env var is set correctly |\n| `Connection refused` | REST API not running | Confirm API server is up at `PG_API_URL` |\n| `pg_stat_statements not found` | Extension not installed | Run `CREATE EXTENSION pg_stat_statements;` as superuser |\n| `permission denied` | Insufficient DB role | Ensure DB user has `pg_monitor` role |\n| Empty rows on `pg_slow_queries` | No qualifying queries | Lower `minCalls` or wait for traffic |\n\n---\n\n## Best Practices\n\n1. All tools are read-only. Never use `pg_run_query` for INSERT, UPDATE, DELETE, or DDL.\n2. Do not drop indexes without DBA confirmation — always present findings first.\n3. Treat `idle in transaction` as urgent — it holds locks and blocks other queries.\n4. `VACUUM FULL` locks the table exclusively — prefer `VACUUM ANALYZE` unless bloat is extreme.\n5. Run the health check workflow on a daily schedule to catch issues early.\n","# PostgreSQL DBA Skill\n\nA complete skill for DBA agents to monitor, diagnose, and manage PostgreSQL databases using Matimo tools.\n\n## Prerequisites\n\nAll tools communicate with PostgreSQL via a REST API wrapper. Ensure:\n1. A REST API (PostgREST, custom Express\u002FFastAPI, or Supabase) is running and accessible.\n2. Two environment variables are set:\n   - `PG_API_URL` — Base URL of the REST API (e.g., `http:\u002F\u002Flocalhost:3000`)\n   - `PG_API_KEY` — Bearer token for authenticating with the REST API\n\nThe API must expose a `POST \u002Fquery` endpoint accepting `{ sql, database }` and returning `{ rows, rowCount, fields }`.\n\n---\n\n## Tools You Will Use\n\n| Tool | Purpose |\n|------|---------|\n| `pg_run_query` | Execute arbitrary read-only SQL SELECT statements |\n| `pg_table_stats` | Get table size, live\u002Fdead row counts, and VACUUM history |\n| `pg_slow_queries` | Fetch top slow queries from `pg_stat_statements` |\n| `pg_index_health` | Inspect index usage stats and identify unused indexes |\n| `pg_active_connections` | Monitor live connections and long-running transactions |\n| `pg_vacuum_status` | Check dead tuple counts and autovacuum status per table |\n\n---\n\n## Workflow 1: Health Check (Start Here)\n\nWhen a user asks \"how is my database doing?\", run this sequence:\n\n### Step 1 — Active Connections Snapshot\n```\npg_active_connections({ state: \"all\", minDurationSeconds: 0 })\n```\nLook for: high connection count, `idle in transaction` states, long-running queries (duration > 30s).\n\n### Step 2 — Table Health Overview\n```\npg_table_stats({ schema: \"public\" })\n```\nLook for: high `dead_rows` relative to `live_rows`, missing recent `last_autovacuum` timestamps.\n\n### Step 3 — VACUUM Pressure Check\n```\npg_vacuum_status({ schema: \"public\", deadTupleThreshold: 5000 })\n```\nLook for: `dead_pct` above 10%, stale `last_autovacuum` on high-write tables.\n\n### Step 4 — Index Health\n```\npg_index_health({ schema: \"public\", showUnused: true })\n```\nLook for: large indexes with 0 scans (storage waste and write overhead).\n\n---\n\n## Workflow 2: Performance Debugging\n\nWhen a user says \"the DB is slow\":\n\n### Step 1 — Find Long-Running Queries\n```\npg_active_connections({ state: \"active\", minDurationSeconds: 10 })\n```\nAny query over 10s is suspicious. If `wait_event` is `Lock`, there's contention.\n\n### Step 2 — Pull Slow Query Statistics\n```\npg_slow_queries({ limit: 20, minCalls: 5 })\n```\nKey columns:\n- `avg_ms` — Above 100ms warrants investigation.\n- `cache_hit_pct` — Below 95% means disk I\u002FO; consider indexes or increasing `shared_buffers`.\n- `stddev_ms` — High variance indicates lock waits or table bloat.\n\n### Step 3 — Check Index Coverage\n```\npg_index_health({ schema: \"public\", showUnused: false })\n```\nCross-reference slow queries with low-scan indexes.\n\n### Step 4 — Targeted Ad-Hoc Queries\n```\npg_run_query({ sql: \"SELECT * FROM pg_locks WHERE NOT granted\" })\n```\nUse for any diagnostic SQL not covered by specialist tools. Read-only SELECTs only.\n\n---\n\n## Workflow 3: Bloat and VACUUM Management\n\n### Step 1 — Find Bloated Tables\n```\npg_vacuum_status({ schema: \"public\", deadTupleThreshold: 10000 })\n```\nTables with `dead_pct` above 20% and stale `last_autovacuum` need attention.\n\n### Step 2 — Confirm with Table Stats\n```\npg_table_stats({ schema: \"public\", table: \"orders\" })\n```\nLarge gap between `table_size` and `total_size` indicates index bloat.\n\n### Step 3 — Report to User\nRecommend the DBA run directly in psql:\n```sql\nVACUUM ANALYZE tablename;\n-- For severe bloat (locks table, use off-hours):\nVACUUM FULL tablename;\n```\nDo NOT execute these via `pg_run_query` — they are write operations.\n\n---\n\n## Workflow 4: Index Optimization\n\n### Step 1 — List Unused Indexes\n```\npg_index_health({ schema: \"public\", showUnused: true })\n```\nAn index with `scans: 0` has never been used since last `pg_stat_reset()`.\n\n### Step 2 — Confirm Before Recommending Drops\nBefore recommending `DROP INDEX`:\n1. Verify it's not used by a constraint (PRIMARY KEY, UNIQUE).\n2. Check if stats were recently reset: `SELECT stats_reset FROM pg_stat_bgwriter`.\n3. Always get human DBA confirmation — dropping is irreversible.\n\nSafe drop command:\n```sql\nDROP INDEX CONCURRENTLY index_name;\n```\n\n---\n\n## Common Ad-Hoc Queries via `pg_run_query`\n\n### Check replication lag\n```sql\nSELECT client_addr, state, (sent_lsn - replay_lsn) AS replication_lag_bytes\nFROM pg_stat_replication;\n```\n\n### Tables missing primary keys\n```sql\nSELECT t.table_name FROM information_schema.tables t\nLEFT JOIN information_schema.table_constraints c\n  ON t.table_name = c.table_name AND c.constraint_type = 'PRIMARY KEY'\nWHERE t.table_schema = 'public' AND c.constraint_name IS NULL;\n```\n\n### Cache hit rate (target > 99%)\n```sql\nSELECT round(sum(blks_hit) * 100.0 \u002F sum(blks_hit + blks_read), 2) AS cache_hit_pct\nFROM pg_stat_database;\n```\n\n### Largest tables by disk usage\n```sql\nSELECT relname, pg_size_pretty(pg_total_relation_size(oid)) AS size\nFROM pg_class WHERE relkind = 'r'\nORDER BY pg_total_relation_size(oid) DESC LIMIT 10;\n```\n\n### Find duplicate indexes\n```sql\nSELECT indrelid::regclass AS table_name, array_agg(indexrelid::regclass) AS duplicate_indexes\nFROM pg_index GROUP BY indrelid, indkey HAVING COUNT(*) > 1;\n```\n\n---\n\n## Error Handling\n\n| Error | Cause | Resolution |\n|-------|-------|------------|\n| `401 Unauthorized` | Invalid `PG_API_KEY` | Verify env var is set correctly |\n| `Connection refused` | REST API not running | Confirm API server is up at `PG_API_URL` |\n| `pg_stat_statements not found` | Extension not installed | Run `CREATE EXTENSION pg_stat_statements;` as superuser |\n| `permission denied` | Insufficient DB role | Ensure DB user has `pg_monitor` role |\n| Empty rows on `pg_slow_queries` | No qualifying queries | Lower `minCalls` or wait for traffic |\n\n---\n\n## Best Practices\n\n1. All tools are read-only. Never use `pg_run_query` for INSERT, UPDATE, DELETE, or DDL.\n2. Do not drop indexes without DBA confirmation — always present findings first.\n3. Treat `idle in transaction` as urgent — it holds locks and blocks other queries.\n4. `VACUUM FULL` locks the table exclusively — prefer `VACUUM ANALYZE` unless bloat is extreme.\n5. Run the health check workflow on a daily schedule to catch issues early.\n",{"name":5,"license":15,"version":24,"metadata":25,"description":7},"1.0.0",{"apply-to":26,"category":27,"difficulty":28},"pg_run_query pg_table_stats pg_slow_queries pg_index_health pg_active_connections pg_vacuum_status","Database","intermediate","main","3ace42f8c811a205651ca8cf53bc2608abffc266","typescript\u002Fexamples\u002Fmcp\u002Fmatimo-tools\u002Fskills\u002Fpostgres-dba",1,"https:\u002F\u002Fgithub.com\u002Freview-bench\u002Ftallclub_matimo","https:\u002F\u002Fgithub.com\u002Freview-bench","https:\u002F\u002Freview-bench.ai","An open benchmark for AI code review.","2026-10-27 08:01:51",{"source":8,"skillName":5,"commands":39,"prompt":49,"zipAvailable":50},[40,43,46],{"tool":41,"command":42},"npx","npx skills add review-bench\u002Ftallclub_matimo --skill postgres-dba",{"tool":44,"command":45},"bunx","bunx skills add review-bench\u002Ftallclub_matimo --skill postgres-dba",{"tool":47,"command":48},"pnpm","pnpm dlx skills add review-bench\u002Ftallclub_matimo --skill postgres-dba","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Freview-bench\u002Ftallclub_matimo\u002Fblob\u002Fmain\u002Ftypescript\u002Fexamples\u002Fmcp\u002Fmatimo-tools\u002Fskills\u002Fpostgres-dba\u002FSKILL.md",true,[],[53,60,67,74,81,88],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":19},"01M752QFT5TGZZ68013YTNW8J3","twilio","Complete guide to all Twilio tools — text, media, delivery tracking, E.164 formatting, and message management.","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Ftallclub_matimo\u002Fblob\u002Fmain\u002Ftypescript\u002Fpackages\u002Ftwilio\u002Fskills\u002Ftwilio\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M752QAKQFZKM84MN9R5334VX","slack","Complete guide to all Slack tools — messaging, channels, users, search, files, reactions, and threads.","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Ftallclub_matimo\u002Fblob\u002Fmain\u002Ftypescript\u002Fpackages\u002Fslack\u002Fskills\u002Fslack\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M752Q60H6SQAHAH9BB2MZQN6","postgres","Complete guide to all PostgreSQL tools — parameterized queries, schema navigation, data retrieval, and safe database interaction patterns.","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Ftallclub_matimo\u002Fblob\u002Fmain\u002Ftypescript\u002Fpackages\u002Fpostgres\u002Fskills\u002Fpostgres\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M752Q2700VY1QWPACWX8AVFQ","notion","Complete guide to all Notion tools — databases, pages, blocks, queries, and content management.","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Ftallclub_matimo\u002Fblob\u002Fmain\u002Ftypescript\u002Fpackages\u002Fnotion\u002Fskills\u002Fnotion\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M752PZ82SCVF6H1GPKQ54JWR","mailchimp","Complete guide to all Mailchimp tools — campaigns, audiences, lists, templates, segments, and email marketing.","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Ftallclub_matimo\u002Fblob\u002Fmain\u002Ftypescript\u002Fpackages\u002Fmailchimp\u002Fskills\u002Fmailchimp\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":19},"01M752PQW4F1SP8DXQMFMYKDBK","hubspot","Complete guide to all HubSpot CRM tools — contacts, companies, deals, tickets, products, line items, pipelines, and entity management.","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Ftallclub_matimo\u002Fblob\u002Fmain\u002Ftypescript\u002Fpackages\u002Fhubspot\u002Fskills\u002Fhubspot\u002FSKILL.md",[],[]]