[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M72ZC34AQH2J91TSJ78HTZ15":3,"skill-same:01M72ZC34AQH2J91TSJ78HTZ15":75},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":32,"commitSha":33,"skillDirectory":34,"forksCount":35,"repositoryHtmlUrl":36,"repositoryHomepageUrl":6,"ownerHtmlUrl":37,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":38,"install":39,"resources":52},"01M72ZC34AQH2J91TSJ78HTZ15","postgres-pro",null,"Use when optimizing PostgreSQL queries, configuring replication, or implementing advanced database features. Invoke for EXPLAIN analysis, JSONB operations, extension usage, VACUUM tuning, performance monitoring.","enigmaicon-eng\u002FAI-Enterprise-OS","enigmaicon-eng","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F269773191?v=4","01M72YXXYN7Q7BYRHV8RAVYNWD","01M72YXXZPW35H56D6F1XSK84D",2,"MIT","https:\u002F\u002Fgithub.com\u002Fenigmaicon-eng\u002FAI-Enterprise-OS\u002Fblob\u002Fmain\u002Fexamples\u002Fclaude-skills\u002Fskills\u002Fpostgres-pro\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: postgres-pro\ndescription: Use when optimizing PostgreSQL queries, configuring replication, or implementing advanced database features. Invoke for EXPLAIN analysis, JSONB operations, extension usage, VACUUM tuning, performance monitoring.\nlicense: MIT\nmetadata:\n  author: https:\u002F\u002Fgithub.com\u002FJeffallan\n  version: \"1.1.0\"\n  domain: infrastructure\n  triggers: PostgreSQL, Postgres, EXPLAIN ANALYZE, pg_stat, JSONB, streaming replication, logical replication, VACUUM, PostGIS, pgvector\n  role: specialist\n  scope: implementation\n  output-format: code\n  related-skills: database-optimizer, devops-engineer, sre-engineer\n---\n\n# PostgreSQL Pro\n\nSenior PostgreSQL expert with deep expertise in database administration, performance optimization, and advanced PostgreSQL features.\n\n## When to Use This Skill\n\n- Analyzing and optimizing slow queries with EXPLAIN\n- Implementing JSONB storage and indexing strategies\n- Setting up streaming or logical replication\n- Configuring and using PostgreSQL extensions\n- Tuning VACUUM, ANALYZE, and autovacuum\n- Monitoring database health with pg_stat views\n- Designing indexes for optimal performance\n\n## Core Workflow\n\n1. **Analyze performance** — Run `EXPLAIN (ANALYZE, BUFFERS)` to identify bottlenecks\n2. **Design indexes** — Choose B-tree, GIN, GiST, or BRIN based on workload; verify with `EXPLAIN` before deploying\n3. **Optimize queries** — Rewrite inefficient queries, run `ANALYZE` to refresh statistics\n4. **Setup replication** — Streaming or logical based on requirements; monitor lag continuously\n5. **Monitor and maintain** — Track VACUUM, bloat, and autovacuum via `pg_stat` views; verify improvements after each change\n\n### End-to-End Example: Slow Query → Fix → Verification\n\n```sql\n-- Step 1: Identify slow queries\nSELECT query, mean_exec_time, calls\nFROM pg_stat_statements\nORDER BY mean_exec_time DESC\nLIMIT 10;\n\n-- Step 2: Analyze a specific slow query\nEXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT)\nSELECT * FROM orders WHERE customer_id = 42 AND status = 'pending';\n-- Look for: Seq Scan (bad on large tables), high Buffers hit, nested loops on large sets\n\n-- Step 3: Create a targeted index\nCREATE INDEX CONCURRENTLY idx_orders_customer_status\n  ON orders (customer_id, status)\n  WHERE status = 'pending';  -- partial index reduces size\n\n-- Step 4: Verify the index is used\nEXPLAIN (ANALYZE, BUFFERS)\nSELECT * FROM orders WHERE customer_id = 42 AND status = 'pending';\n-- Confirm: Index Scan on idx_orders_customer_status, lower actual time\n\n-- Step 5: Update statistics if needed after bulk changes\nANALYZE orders;\n```\n\n## Reference Guide\n\nLoad detailed guidance based on context:\n\n| Topic | Reference | Load When |\n|-------|-----------|-----------|\n| Performance | `references\u002Fperformance.md` | EXPLAIN ANALYZE, indexes, statistics, query tuning |\n| JSONB | `references\u002Fjsonb.md` | JSONB operators, indexing, GIN indexes, containment |\n| Extensions | `references\u002Fextensions.md` | PostGIS, pg_trgm, pgvector, uuid-ossp, pg_stat_statements |\n| Replication | `references\u002Freplication.md` | Streaming replication, logical replication, failover |\n| Maintenance | `references\u002Fmaintenance.md` | VACUUM, ANALYZE, pg_stat views, monitoring, bloat |\n\n## Common Patterns\n\n### JSONB — GIN Index and Query\n\n```sql\n-- Create GIN index for containment queries\nCREATE INDEX idx_events_payload ON events USING GIN (payload);\n\n-- Efficient JSONB containment query (uses GIN index)\nSELECT * FROM events WHERE payload @> '{\"type\": \"login\", \"success\": true}';\n\n-- Extract nested value\nSELECT payload->>'user_id', payload->'meta'->>'ip'\nFROM events\nWHERE payload @> '{\"type\": \"login\"}';\n```\n\n### VACUUM and Bloat Monitoring\n\n```sql\n-- Check tables with high dead tuple counts\nSELECT relname, n_dead_tup, n_live_tup,\n       round(n_dead_tup::numeric \u002F NULLIF(n_live_tup + n_dead_tup, 0) * 100, 2) AS dead_pct,\n       last_autovacuum\nFROM pg_stat_user_tables\nORDER BY n_dead_tup DESC\nLIMIT 20;\n\n-- Manually vacuum a high-churn table and verify\nVACUUM (ANALYZE, VERBOSE) orders;\n```\n\n### Replication Lag Monitoring\n\n```sql\n-- On primary: check standby lag\nSELECT client_addr, state, sent_lsn, write_lsn, flush_lsn, replay_lsn,\n       (sent_lsn - replay_lsn) AS replication_lag_bytes\nFROM pg_stat_replication;\n```\n\n## Constraints\n\n### MUST DO\n- Use `EXPLAIN (ANALYZE, BUFFERS)` for query optimization\n- Verify indexes are actually used with `EXPLAIN` before and after creation\n- Use `CREATE INDEX CONCURRENTLY` to avoid table locks in production\n- Run `ANALYZE` after bulk data changes to refresh statistics\n- Monitor autovacuum; tune `autovacuum_vacuum_scale_factor` for high-churn tables\n- Use connection pooling (pgBouncer, pgPool)\n- Monitor replication lag via `pg_stat_replication`\n- Use prepared statements to prevent SQL injection\n- Use `uuid` type for UUIDs, not `text`\n\n### MUST NOT DO\n- Disable autovacuum globally\n- Create indexes without first analyzing query patterns\n- Use `SELECT *` in production queries\n- Ignore replication lag alerts\n- Skip VACUUM on high-churn tables\n- Store large BLOBs in the database (use object storage)\n- Deploy index changes without verifying the planner uses them\n\n## Output Templates\n\nWhen implementing PostgreSQL solutions, provide:\n1. Query with `EXPLAIN (ANALYZE, BUFFERS)` output and interpretation\n2. Index definitions with rationale and pre\u002Fpost verification\n3. Configuration changes with before\u002Fafter values\n4. Monitoring queries for ongoing health checks\n5. Brief explanation of performance impact\n\n## Knowledge Reference\n\nPostgreSQL 12-16, EXPLAIN ANALYZE, B-tree\u002FGIN\u002FGiST\u002FBRIN indexes, JSONB operators, streaming replication, logical replication, VACUUM\u002FANALYZE, pg_stat views, PostGIS, pgvector, pg_trgm, WAL archiving, PITR\n\n[Documentation](https:\u002F\u002Fjeffallan.github.io\u002Fclaude-skills\u002Fskills\u002Finfrastructure\u002Fpostgres-pro\u002F)\n","# PostgreSQL Pro\n\nSenior PostgreSQL expert with deep expertise in database administration, performance optimization, and advanced PostgreSQL features.\n\n## When to Use This Skill\n\n- Analyzing and optimizing slow queries with EXPLAIN\n- Implementing JSONB storage and indexing strategies\n- Setting up streaming or logical replication\n- Configuring and using PostgreSQL extensions\n- Tuning VACUUM, ANALYZE, and autovacuum\n- Monitoring database health with pg_stat views\n- Designing indexes for optimal performance\n\n## Core Workflow\n\n1. **Analyze performance** — Run `EXPLAIN (ANALYZE, BUFFERS)` to identify bottlenecks\n2. **Design indexes** — Choose B-tree, GIN, GiST, or BRIN based on workload; verify with `EXPLAIN` before deploying\n3. **Optimize queries** — Rewrite inefficient queries, run `ANALYZE` to refresh statistics\n4. **Setup replication** — Streaming or logical based on requirements; monitor lag continuously\n5. **Monitor and maintain** — Track VACUUM, bloat, and autovacuum via `pg_stat` views; verify improvements after each change\n\n### End-to-End Example: Slow Query → Fix → Verification\n\n```sql\n-- Step 1: Identify slow queries\nSELECT query, mean_exec_time, calls\nFROM pg_stat_statements\nORDER BY mean_exec_time DESC\nLIMIT 10;\n\n-- Step 2: Analyze a specific slow query\nEXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT)\nSELECT * FROM orders WHERE customer_id = 42 AND status = 'pending';\n-- Look for: Seq Scan (bad on large tables), high Buffers hit, nested loops on large sets\n\n-- Step 3: Create a targeted index\nCREATE INDEX CONCURRENTLY idx_orders_customer_status\n  ON orders (customer_id, status)\n  WHERE status = 'pending';  -- partial index reduces size\n\n-- Step 4: Verify the index is used\nEXPLAIN (ANALYZE, BUFFERS)\nSELECT * FROM orders WHERE customer_id = 42 AND status = 'pending';\n-- Confirm: Index Scan on idx_orders_customer_status, lower actual time\n\n-- Step 5: Update statistics if needed after bulk changes\nANALYZE orders;\n```\n\n## Reference Guide\n\nLoad detailed guidance based on context:\n\n| Topic | Reference | Load When |\n|-------|-----------|-----------|\n| Performance | `references\u002Fperformance.md` | EXPLAIN ANALYZE, indexes, statistics, query tuning |\n| JSONB | `references\u002Fjsonb.md` | JSONB operators, indexing, GIN indexes, containment |\n| Extensions | `references\u002Fextensions.md` | PostGIS, pg_trgm, pgvector, uuid-ossp, pg_stat_statements |\n| Replication | `references\u002Freplication.md` | Streaming replication, logical replication, failover |\n| Maintenance | `references\u002Fmaintenance.md` | VACUUM, ANALYZE, pg_stat views, monitoring, bloat |\n\n## Common Patterns\n\n### JSONB — GIN Index and Query\n\n```sql\n-- Create GIN index for containment queries\nCREATE INDEX idx_events_payload ON events USING GIN (payload);\n\n-- Efficient JSONB containment query (uses GIN index)\nSELECT * FROM events WHERE payload @> '{\"type\": \"login\", \"success\": true}';\n\n-- Extract nested value\nSELECT payload->>'user_id', payload->'meta'->>'ip'\nFROM events\nWHERE payload @> '{\"type\": \"login\"}';\n```\n\n### VACUUM and Bloat Monitoring\n\n```sql\n-- Check tables with high dead tuple counts\nSELECT relname, n_dead_tup, n_live_tup,\n       round(n_dead_tup::numeric \u002F NULLIF(n_live_tup + n_dead_tup, 0) * 100, 2) AS dead_pct,\n       last_autovacuum\nFROM pg_stat_user_tables\nORDER BY n_dead_tup DESC\nLIMIT 20;\n\n-- Manually vacuum a high-churn table and verify\nVACUUM (ANALYZE, VERBOSE) orders;\n```\n\n### Replication Lag Monitoring\n\n```sql\n-- On primary: check standby lag\nSELECT client_addr, state, sent_lsn, write_lsn, flush_lsn, replay_lsn,\n       (sent_lsn - replay_lsn) AS replication_lag_bytes\nFROM pg_stat_replication;\n```\n\n## Constraints\n\n### MUST DO\n- Use `EXPLAIN (ANALYZE, BUFFERS)` for query optimization\n- Verify indexes are actually used with `EXPLAIN` before and after creation\n- Use `CREATE INDEX CONCURRENTLY` to avoid table locks in production\n- Run `ANALYZE` after bulk data changes to refresh statistics\n- Monitor autovacuum; tune `autovacuum_vacuum_scale_factor` for high-churn tables\n- Use connection pooling (pgBouncer, pgPool)\n- Monitor replication lag via `pg_stat_replication`\n- Use prepared statements to prevent SQL injection\n- Use `uuid` type for UUIDs, not `text`\n\n### MUST NOT DO\n- Disable autovacuum globally\n- Create indexes without first analyzing query patterns\n- Use `SELECT *` in production queries\n- Ignore replication lag alerts\n- Skip VACUUM on high-churn tables\n- Store large BLOBs in the database (use object storage)\n- Deploy index changes without verifying the planner uses them\n\n## Output Templates\n\nWhen implementing PostgreSQL solutions, provide:\n1. Query with `EXPLAIN (ANALYZE, BUFFERS)` output and interpretation\n2. Index definitions with rationale and pre\u002Fpost verification\n3. Configuration changes with before\u002Fafter values\n4. Monitoring queries for ongoing health checks\n5. Brief explanation of performance impact\n\n## Knowledge Reference\n\nPostgreSQL 12-16, EXPLAIN ANALYZE, B-tree\u002FGIN\u002FGiST\u002FBRIN indexes, JSONB operators, streaming replication, logical replication, VACUUM\u002FANALYZE, pg_stat views, PostGIS, pgvector, pg_trgm, WAL archiving, PITR\n\n[Documentation](https:\u002F\u002Fjeffallan.github.io\u002Fclaude-skills\u002Fskills\u002Finfrastructure\u002Fpostgres-pro\u002F)\n",{"name":5,"license":14,"metadata":23,"description":7},{"role":24,"scope":25,"author":26,"domain":27,"version":28,"triggers":29,"output-format":30,"related-skills":31},"specialist","implementation","https:\u002F\u002Fgithub.com\u002FJeffallan","infrastructure","1.1.0","PostgreSQL, Postgres, EXPLAIN ANALYZE, pg_stat, JSONB, streaming replication, logical replication, VACUUM, PostGIS, pgvector","code","database-optimizer, devops-engineer, sre-engineer","main","a4b48842f3e48549adf3dc335a8837c66da99497","examples\u002Fclaude-skills\u002Fskills\u002Fpostgres-pro",0,"https:\u002F\u002Fgithub.com\u002Fenigmaicon-eng\u002FAI-Enterprise-OS","https:\u002F\u002Fgithub.com\u002Fenigmaicon-eng","2026-05-17 16:00:01",{"source":8,"skillName":5,"commands":40,"prompt":50,"zipAvailable":51},[41,44,47],{"tool":42,"command":43},"npx","npx skills add enigmaicon-eng\u002FAI-Enterprise-OS --skill postgres-pro",{"tool":45,"command":46},"bunx","bunx skills add enigmaicon-eng\u002FAI-Enterprise-OS --skill postgres-pro",{"tool":48,"command":49},"pnpm","pnpm dlx skills add enigmaicon-eng\u002FAI-Enterprise-OS --skill postgres-pro","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fenigmaicon-eng\u002FAI-Enterprise-OS\u002Fblob\u002Fmain\u002Fexamples\u002Fclaude-skills\u002Fskills\u002Fpostgres-pro\u002FSKILL.md",true,[53,59,63,67,71],{"path":54,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":57,"sourceHtmlUrl":58},"references\u002Fextensions.md","REFERENCE","参考文档",9587,"https:\u002F\u002Fgithub.com\u002Fenigmaicon-eng\u002FAI-Enterprise-OS\u002Fblob\u002Fmain\u002Fexamples\u002Fclaude-skills\u002Fskills\u002Fpostgres-pro\u002Freferences\u002Fextensions.md",{"path":60,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":61,"sourceHtmlUrl":62},"references\u002Fjsonb.md",8152,"https:\u002F\u002Fgithub.com\u002Fenigmaicon-eng\u002FAI-Enterprise-OS\u002Fblob\u002Fmain\u002Fexamples\u002Fclaude-skills\u002Fskills\u002Fpostgres-pro\u002Freferences\u002Fjsonb.md",{"path":64,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":65,"sourceHtmlUrl":66},"references\u002Fmaintenance.md",12114,"https:\u002F\u002Fgithub.com\u002Fenigmaicon-eng\u002FAI-Enterprise-OS\u002Fblob\u002Fmain\u002Fexamples\u002Fclaude-skills\u002Fskills\u002Fpostgres-pro\u002Freferences\u002Fmaintenance.md",{"path":68,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":69,"sourceHtmlUrl":70},"references\u002Fperformance.md",7085,"https:\u002F\u002Fgithub.com\u002Fenigmaicon-eng\u002FAI-Enterprise-OS\u002Fblob\u002Fmain\u002Fexamples\u002Fclaude-skills\u002Fskills\u002Fpostgres-pro\u002Freferences\u002Fperformance.md",{"path":72,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":73,"sourceHtmlUrl":74},"references\u002Freplication.md",9991,"https:\u002F\u002Fgithub.com\u002Fenigmaicon-eng\u002FAI-Enterprise-OS\u002Fblob\u002Fmain\u002Fexamples\u002Fclaude-skills\u002Fskills\u002Fpostgres-pro\u002Freferences\u002Freplication.md",[76,83,90,97,104,111],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":18},"01M72ZGWW03JSE1T3TKK5NZ11Y","writing-skills","Use when creating new skills, editing existing skills, or verifying skills work before deployment","https:\u002F\u002Fgithub.com\u002Fenigmaicon-eng\u002FAI-Enterprise-OS\u002Fblob\u002Fmain\u002Fexamples\u002Fsuperpowers\u002Fskills\u002Fwriting-skills\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":18},"01M72ZGT3FJT7QRM1VNQRKR0XD","writing-plans","Use when you have a spec or requirements for a multi-step task, before touching code","https:\u002F\u002Fgithub.com\u002Fenigmaicon-eng\u002FAI-Enterprise-OS\u002Fblob\u002Fmain\u002Fexamples\u002Fsuperpowers\u002Fskills\u002Fwriting-plans\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":18},"01M72ZGQ69DCF0SBP9JXFPWKJS","verification-before-completion","Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always","https:\u002F\u002Fgithub.com\u002Fenigmaicon-eng\u002FAI-Enterprise-OS\u002Fblob\u002Fmain\u002Fexamples\u002Fsuperpowers\u002Fskills\u002Fverification-before-completion\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":18},"01M72ZGNF126QT0MQ2D3DNGZRN","using-superpowers","Use when starting any conversation - establishes how to find and use skills, requiring Skill tool invocation before ANY response including clarifying questions","https:\u002F\u002Fgithub.com\u002Fenigmaicon-eng\u002FAI-Enterprise-OS\u002Fblob\u002Fmain\u002Fexamples\u002Fsuperpowers\u002Fskills\u002Fusing-superpowers\u002FSKILL.md",[],[],{"skillNo":105,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":18},"01M72ZGHVJ9S0YXMNBHQGQ95BY","using-git-worktrees","Use when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback","https:\u002F\u002Fgithub.com\u002Fenigmaicon-eng\u002FAI-Enterprise-OS\u002Fblob\u002Fmain\u002Fexamples\u002Fsuperpowers\u002Fskills\u002Fusing-git-worktrees\u002FSKILL.md",[],[],{"skillNo":112,"name":113,"nameZh":6,"description":114,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":115,"categories":116,"keywords":117,"publishedAt":18},"01M72ZGFNZCHFY2FS3ZD9MCYV9","test-driven-development","Use when implementing any feature or bugfix, before writing implementation code","https:\u002F\u002Fgithub.com\u002Fenigmaicon-eng\u002FAI-Enterprise-OS\u002Fblob\u002Fmain\u002Fexamples\u002Fsuperpowers\u002Fskills\u002Ftest-driven-development\u002FSKILL.md",[],[]]