[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7A7BNERVWPE3Z2MNJDETXQX":3,"skill-same:01M7A7BNERVWPE3Z2MNJDETXQX":93},{"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":6,"ownerDescription":35,"updatedAt":36,"install":37,"resources":50},"01M7A7BNERVWPE3Z2MNJDETXQX","postgres-database-expert",null,"Design and manage PostgreSQL databases with proper schema design, query optimization, GORM\u002Fpgx patterns, and Redis caching. Use when designing schemas, writing or optimizing SQL queries, analyzing EXPLAIN plans, managing indexes, implementing connection pooling, or setting up Redis caching layers. For zero-downtime migration strategies (expand-contract, backfills, rollbacks), consult the postgres references directory for migration guidance. Trigger: PostgreSQL, SQL, migration, query optimization, pgx, GORM, EXPLAIN ANALYZE. Do NOT trigger for: NoSQL databases, MongoDB, DynamoDB design, application-level caching strategies, N+1 query optimization in application code (use performance-expert).","ronsilver\u002Fagent-covenant","ronsilver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F46677526?v=4","01M7A719H1DVMZSKNAESAC82DA","Jorge Maturana","01M7A719J5GP33TM303CB8NN00",1,"MIT","https:\u002F\u002Fgithub.com\u002Fronsilver\u002Fagent-covenant\u002Fblob\u002Fmain\u002Fcontent\u002Fskills\u002Fpostgres-database-expert\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: postgres-database-expert\ndescription: \"Design and manage PostgreSQL databases with proper schema design, query optimization, GORM\u002Fpgx patterns, and Redis caching. Use when designing schemas, writing or optimizing SQL queries, analyzing EXPLAIN plans, managing indexes, implementing connection pooling, or setting up Redis caching layers. For zero-downtime migration strategies (expand-contract, backfills, rollbacks), consult the postgres references directory for migration guidance. Trigger: PostgreSQL, SQL, migration, query optimization, pgx, GORM, EXPLAIN ANALYZE. Do NOT trigger for: NoSQL databases, MongoDB, DynamoDB design, application-level caching strategies, N+1 query optimization in application code (use performance-expert).\"\nlicense: MIT\nmetadata:\n  author: Community\n  version: \"1.1\"\n  category: data\n  status: stable\n---\n\n# PostgreSQL Database Expert\n\n**Design and manage PostgreSQL databases with proper schema, migrations, query optimization, and caching.**\n\n**See [references\u002Foverview.md](references\u002Foverview.md)**\n\n## Core Stack\n\n**See [references\u002Fstack.md](references\u002Fstack.md)**\n\n- Database: PostgreSQL 16\n- Go: GORM + pgx\u002Fv5\n- Migrations: golang-migrate\n- Caching: Redis\n\n## Naming Conventions\n\n**See [references\u002Fnaming.md](references\u002Fnaming.md)**\n\n- Tables: `snake_case`, plural\n- Columns: `snake_case`\n- PKs: `id` (UUID)\n- FKs: `{table}_id`\n- Indexes: `idx_{table}_{columns}`\n\n## Schema Rules\n- UUIDs for PKs | BIGINT for value amounts (NEVER FLOAT) | ALWAYS TIMESTAMPTZ\n- Soft deletes with `deleted_at` | NOT NULL by default\n\n→ [references\u002Fschema-design.md](references\u002Fschema-design.md) | [references\u002Fnaming.md](references\u002Fnaming.md)\n\n## Migrations\n- Safe: `ADD COLUMN`, `CREATE INDEX CONCURRENTLY`\n- Dangerous: `ALTER TYPE`, `CREATE INDEX`(without CONCURRENTLY)\n- EXPLAIN red flags: `Seq Scan` | high cost `Sort` | `Nested Loop`\n\n→ [references\u002Fmigrations.md](references\u002Fmigrations.md) | [references\u002Fperformance.md](references\u002Fperformance.md)\n\n## Workflow\n\n**See [references\u002Fworkflow.md](references\u002Fworkflow.md)**\n\n1. Schema design (UUIDs, BIGINT, TIMESTAMPTZ)\n2. Safe migrations (up + down, CONCURRENTLY)\n3. Index strategy (B-tree, composite, GIN)\n4. Query optimization (EXPLAIN ANALYZE)\n5. ORM patterns (GORM, pgx)\n6. Redis caching (cache-aside, TTL)\n\n## Security\nParameterized queries only | NEVER plaintext passwords | dedicated roles per service\nParameterized queries prevent SQL injection (OWASP 2025 A05) — see the OWASP SQL Injection Prevention Cheat Sheet\n→ [references\u002Fsecurity.md](references\u002Fsecurity.md) | [references\u002Fcode-patterns.md](references\u002Fcode-patterns.md) | https:\u002F\u002Fcheatsheetseries.owasp.org\u002Fcheatsheets\u002FSQL_Injection_Prevention_Cheat_Sheet.html\n\n## Constraints\n- NEVER `FLOAT` for value → `BIGINT` in units\n- NEVER `TIMESTAMP` without zone → `TIMESTAMPTZ`\n- NEVER `OFFSET` on large tables → cursor-based pagination\n- NEVER `SELECT *` in production → explicit columns\n- NEVER `CREATE INDEX` without `CONCURRENTLY` on production\n- ALWAYS write `up` + `down` migrations\n- ALWAYS `EXPLAIN ANALYZE` before optimizing\n- ALWAYS parameterized queries (NEVER string concat)\n- ALWAYS set connection pool limits\n- ALWAYS invalidate cache on data mutation\n\n## Overview\n\nPostgreSQL 16 schema design with UUID primary keys, `BIGINT` for value amounts, `TIMESTAMPTZ` for temporal data, and `snake_case` naming conventions. Paired with Redis cache-aside patterns and safe migrations using `CREATE INDEX CONCURRENTLY` and expand-contract for breaking changes.\n\n## Quick Reference\n\n| Concept | Rule | Example |\n|---------|------|--------|\n| PKs | UUID (not serial) | `id UUID PRIMARY KEY DEFAULT gen_random_uuid()` |\n| Value | BIGINT in units | `value BIGINT NOT NULL` |\n| Timestamps | TIMESTAMPTZ always | `created_at TIMESTAMPTZ NOT NULL DEFAULT now()` |\n| Indexes | CONCURRENTLY on production | `CREATE INDEX CONCURRENTLY idx_items_status ON items(status)` |\n| Migrations | Up + Down always | `golang-migrate` with separate up\u002Fdown files |\n| Pagination | Cursor-based (no OFFSET) | `WHERE id > $1 ORDER BY id LIMIT 50` |\n| Soft Deletes | `deleted_at TIMESTAMPTZ` | `WHERE deleted_at IS NULL` |\n\n## Workflow\n\n1. Design schema: UUID PKs, `BIGINT` for value, `TIMESTAMPTZ`, `snake_case` naming, NOT NULL by default\n2. Write safe migrations: `ADD COLUMN` is safe, `ALTER TYPE` needs caution — always write up + down\n3. Index strategy: B-tree for equality, composite for multi-column filters, GIN for full-text search; always `CONCURRENTLY` on production\n4. Optimize queries: run `EXPLAIN ANALYZE`, watch for `Seq Scan` (needs index), high-cost `Sort`, or `Nested Loop` on large tables\n5. Implement caching: cache-aside pattern with Redis, 5min default TTL, invalidate on mutation\n6. Connection pooling: `pgx` pool with `MaxConns: 20` and statement timeout\n\n## Anti-patterns\n\nFAIL: Using FLOAT for value\n```sql\n-- BAD\namount DECIMAL(10,2) -- rounding errors\n```\nPASS: Use BIGINT in units\n```sql\n-- GOOD\nvalue BIGINT NOT NULL CHECK (value >= 0)\n```\n\nFAIL: TIMESTAMP without timezone\n```sql\n-- BAD\ndeleted_at TIMESTAMP -- ambiguous across timezones\n```\nPASS: Always use TIMESTAMPTZ\n```sql\n-- GOOD\ndeleted_at TIMESTAMPTZ\n```\n\nFAIL: OFFSET pagination on large tables\n```sql\n-- BAD — scans all skipped rows\nSELECT * FROM items ORDER BY id LIMIT 50 OFFSET 10000;\n```\nPASS: Cursor-based pagination\n```sql\n-- GOOD — constant time per page\nSELECT * FROM items WHERE id > $1 ORDER BY id LIMIT 50;\n```\n\nFAIL: SELECT * in production code\n```sql\n-- BAD — fetches unused columns, breaks if schema changes\nSELECT * FROM items WHERE id = $1;\n```\nPASS: Explicit column list\n```sql\n-- GOOD\nSELECT id, value, status, created_at FROM items WHERE id = $1;\n```\n\nFAIL: Creating index without CONCURRENTLY\n```sql\n-- BAD — blocks writes\nCREATE INDEX idx_items_tenant ON items(tenant_id);\n```\nPASS: Safe with CONCURRENTLY\n```sql\n-- GOOD — non-blocking\nCREATE INDEX CONCURRENTLY idx_items_tenant ON items(tenant_id);\n```\n\nFAIL: N+1 query — fetching related entities in a loop\n```go\nitems, _ := db.Items.FindAll()\nfor _, item := range items {\n    subitems, _ := db.SubItems.FindByItemID(item.ID)  \u002F\u002F N queries!\n}\n```\nPASS: Eager loading with Preload\n```go\nitems, _ := db.Items.Preload(\"SubItems\").FindAll()  \u002F\u002F 2 queries total\n```\n```sql\n-- Single query with JOIN\nSELECT i.*, s.* FROM items i\nLEFT JOIN item_subitems s ON s.item_id = i.id\nWHERE i.id = ANY($1);\n```\n\nFAIL: ORDER BY on unindexed column causing Seq Scan + Sort\n```sql\n-- BAD: Seq Scan + Sort on 1M rows\nSELECT id, value, created_at\nFROM items\nWHERE tenant_id = $1\nORDER BY created_at DESC;\n```\nPASS: Add composite index matching ORDER BY\n```sql\nCREATE INDEX CONCURRENTLY idx_items_tenant_created\nON items(tenant_id, created_at DESC);\n-- NOW: Index Scan Backward — constant-time\n```\n\n## References\n\n- [PostgreSQL 16 Documentation](https:\u002F\u002Fwww.postgresql.org\u002Fdocs\u002F16\u002F) · last_verified: 2025-05\n- [Use the Index, Luke — PostgreSQL Indexing Guide](https:\u002F\u002Fuse-the-index-luke.com\u002F) · last_verified: 2025-05\n- [golang-migrate Documentation](https:\u002F\u002Fgithub.com\u002Fgolang-migrate\u002Fmigrate) · last_verified: 2025-05\n\n## Verification Checklist\n\n- [ ] All value columns use `BIGINT` in units (never FLOAT\u002FDECIMAL)\n- [ ] All timestamp columns use `TIMESTAMPTZ` (never TIMESTAMP without zone)\n- [ ] Production indexes created with `CONCURRENTLY` (never blocking writes)\n- [ ] Migrations have both `up` and `down` files\n- [ ] Pagination uses cursor-based pattern, not `OFFSET`\n- [ ] Queries use parameterized inputs (no string concatenation)\n- [ ] `EXPLAIN ANALYZE` run on new\u002Fmodified query paths\n- [ ] Parameterized queries verified against SQL Injection Prevention Cheat Sheet (no string concat)\n\n## Troubleshooting\n\n| Symptom | Likely cause | Fix |\n|---------|-------------|-----|\n| Query slow despite index | Wrong index type or column order | Run `EXPLAIN ANALYZE`; verify index matches filter + sort columns |\n| Migration blocks writes on production | `CREATE INDEX` without `CONCURRENTLY` | Drop index; re-create with `CREATE INDEX CONCURRENTLY` |\n| Connection pool exhausted | `MaxConns` too low or slow queries holding connections | Increase pool size; add statement timeout; check for long-running queries |\n| Cache returns stale data | Cache not invalidated on write path | Add cache invalidation in the mutation code path |\n| Index created CONCURRENTLY but not used by query planner (known issue: statistics stale) | Table statistics not updated after index creation | Run `ANALYZE` after `CREATE INDEX CONCURRENTLY` to refresh planner statistics |\n| MVCC bloat causes table size to grow unbounded (autovacuum can't keep up) | Long-running transactions prevent vacuum from reclaiming dead tuples | Set `idle_in_transaction_session_timeout`; monitor `pg_stat_user_tables.n_dead_tup`; tune autovacuum scale_factor |\n| Parameter sniffing: same plan used for different parameter values, causing slow queries on some inputs | PostgreSQL caches plan from first execution with specific params | Use `SET plan_cache_mode = 'force_custom_plan'` for skewed data; or use dynamic SQL with literals |\n\n| [WARN] `VACUUM FULL` blocks writes and causes replication lag | VACUUM FULL takes ACCESS EXCLUSIVE lock; triggers WAL burst on replicas | Use `pg_repack` instead of VACUUM FULL; schedule during maintenance window with application drain |\n| GORM AutoMigrate creates a constraint with a name that conflicts with an existing FK | AutoMigrate generates constraint names dynamically; name collision on concurrent migration | Disable AutoMigrate in production; use explicit migration with named ALTER TABLE ADD CONSTRAINT |\n| Limitation: pg_stat_statements resets on server restart, losing long-term query performance history | pg_stat_statements is in-memory; restart or failover resets all accumulated statistics | Snapshot pg_stat_statements to a logging table every hour via pg_cron; monitor trends not absolute values |\n","# PostgreSQL Database Expert\n\n**Design and manage PostgreSQL databases with proper schema, migrations, query optimization, and caching.**\n\n**See [references\u002Foverview.md](references\u002Foverview.md)**\n\n## Core Stack\n\n**See [references\u002Fstack.md](references\u002Fstack.md)**\n\n- Database: PostgreSQL 16\n- Go: GORM + pgx\u002Fv5\n- Migrations: golang-migrate\n- Caching: Redis\n\n## Naming Conventions\n\n**See [references\u002Fnaming.md](references\u002Fnaming.md)**\n\n- Tables: `snake_case`, plural\n- Columns: `snake_case`\n- PKs: `id` (UUID)\n- FKs: `{table}_id`\n- Indexes: `idx_{table}_{columns}`\n\n## Schema Rules\n- UUIDs for PKs | BIGINT for value amounts (NEVER FLOAT) | ALWAYS TIMESTAMPTZ\n- Soft deletes with `deleted_at` | NOT NULL by default\n\n→ [references\u002Fschema-design.md](references\u002Fschema-design.md) | [references\u002Fnaming.md](references\u002Fnaming.md)\n\n## Migrations\n- Safe: `ADD COLUMN`, `CREATE INDEX CONCURRENTLY`\n- Dangerous: `ALTER TYPE`, `CREATE INDEX`(without CONCURRENTLY)\n- EXPLAIN red flags: `Seq Scan` | high cost `Sort` | `Nested Loop`\n\n→ [references\u002Fmigrations.md](references\u002Fmigrations.md) | [references\u002Fperformance.md](references\u002Fperformance.md)\n\n## Workflow\n\n**See [references\u002Fworkflow.md](references\u002Fworkflow.md)**\n\n1. Schema design (UUIDs, BIGINT, TIMESTAMPTZ)\n2. Safe migrations (up + down, CONCURRENTLY)\n3. Index strategy (B-tree, composite, GIN)\n4. Query optimization (EXPLAIN ANALYZE)\n5. ORM patterns (GORM, pgx)\n6. Redis caching (cache-aside, TTL)\n\n## Security\nParameterized queries only | NEVER plaintext passwords | dedicated roles per service\nParameterized queries prevent SQL injection (OWASP 2025 A05) — see the OWASP SQL Injection Prevention Cheat Sheet\n→ [references\u002Fsecurity.md](references\u002Fsecurity.md) | [references\u002Fcode-patterns.md](references\u002Fcode-patterns.md) | https:\u002F\u002Fcheatsheetseries.owasp.org\u002Fcheatsheets\u002FSQL_Injection_Prevention_Cheat_Sheet.html\n\n## Constraints\n- NEVER `FLOAT` for value → `BIGINT` in units\n- NEVER `TIMESTAMP` without zone → `TIMESTAMPTZ`\n- NEVER `OFFSET` on large tables → cursor-based pagination\n- NEVER `SELECT *` in production → explicit columns\n- NEVER `CREATE INDEX` without `CONCURRENTLY` on production\n- ALWAYS write `up` + `down` migrations\n- ALWAYS `EXPLAIN ANALYZE` before optimizing\n- ALWAYS parameterized queries (NEVER string concat)\n- ALWAYS set connection pool limits\n- ALWAYS invalidate cache on data mutation\n\n## Overview\n\nPostgreSQL 16 schema design with UUID primary keys, `BIGINT` for value amounts, `TIMESTAMPTZ` for temporal data, and `snake_case` naming conventions. Paired with Redis cache-aside patterns and safe migrations using `CREATE INDEX CONCURRENTLY` and expand-contract for breaking changes.\n\n## Quick Reference\n\n| Concept | Rule | Example |\n|---------|------|--------|\n| PKs | UUID (not serial) | `id UUID PRIMARY KEY DEFAULT gen_random_uuid()` |\n| Value | BIGINT in units | `value BIGINT NOT NULL` |\n| Timestamps | TIMESTAMPTZ always | `created_at TIMESTAMPTZ NOT NULL DEFAULT now()` |\n| Indexes | CONCURRENTLY on production | `CREATE INDEX CONCURRENTLY idx_items_status ON items(status)` |\n| Migrations | Up + Down always | `golang-migrate` with separate up\u002Fdown files |\n| Pagination | Cursor-based (no OFFSET) | `WHERE id > $1 ORDER BY id LIMIT 50` |\n| Soft Deletes | `deleted_at TIMESTAMPTZ` | `WHERE deleted_at IS NULL` |\n\n## Workflow\n\n1. Design schema: UUID PKs, `BIGINT` for value, `TIMESTAMPTZ`, `snake_case` naming, NOT NULL by default\n2. Write safe migrations: `ADD COLUMN` is safe, `ALTER TYPE` needs caution — always write up + down\n3. Index strategy: B-tree for equality, composite for multi-column filters, GIN for full-text search; always `CONCURRENTLY` on production\n4. Optimize queries: run `EXPLAIN ANALYZE`, watch for `Seq Scan` (needs index), high-cost `Sort`, or `Nested Loop` on large tables\n5. Implement caching: cache-aside pattern with Redis, 5min default TTL, invalidate on mutation\n6. Connection pooling: `pgx` pool with `MaxConns: 20` and statement timeout\n\n## Anti-patterns\n\nFAIL: Using FLOAT for value\n```sql\n-- BAD\namount DECIMAL(10,2) -- rounding errors\n```\nPASS: Use BIGINT in units\n```sql\n-- GOOD\nvalue BIGINT NOT NULL CHECK (value >= 0)\n```\n\nFAIL: TIMESTAMP without timezone\n```sql\n-- BAD\ndeleted_at TIMESTAMP -- ambiguous across timezones\n```\nPASS: Always use TIMESTAMPTZ\n```sql\n-- GOOD\ndeleted_at TIMESTAMPTZ\n```\n\nFAIL: OFFSET pagination on large tables\n```sql\n-- BAD — scans all skipped rows\nSELECT * FROM items ORDER BY id LIMIT 50 OFFSET 10000;\n```\nPASS: Cursor-based pagination\n```sql\n-- GOOD — constant time per page\nSELECT * FROM items WHERE id > $1 ORDER BY id LIMIT 50;\n```\n\nFAIL: SELECT * in production code\n```sql\n-- BAD — fetches unused columns, breaks if schema changes\nSELECT * FROM items WHERE id = $1;\n```\nPASS: Explicit column list\n```sql\n-- GOOD\nSELECT id, value, status, created_at FROM items WHERE id = $1;\n```\n\nFAIL: Creating index without CONCURRENTLY\n```sql\n-- BAD — blocks writes\nCREATE INDEX idx_items_tenant ON items(tenant_id);\n```\nPASS: Safe with CONCURRENTLY\n```sql\n-- GOOD — non-blocking\nCREATE INDEX CONCURRENTLY idx_items_tenant ON items(tenant_id);\n```\n\nFAIL: N+1 query — fetching related entities in a loop\n```go\nitems, _ := db.Items.FindAll()\nfor _, item := range items {\n    subitems, _ := db.SubItems.FindByItemID(item.ID)  \u002F\u002F N queries!\n}\n```\nPASS: Eager loading with Preload\n```go\nitems, _ := db.Items.Preload(\"SubItems\").FindAll()  \u002F\u002F 2 queries total\n```\n```sql\n-- Single query with JOIN\nSELECT i.*, s.* FROM items i\nLEFT JOIN item_subitems s ON s.item_id = i.id\nWHERE i.id = ANY($1);\n```\n\nFAIL: ORDER BY on unindexed column causing Seq Scan + Sort\n```sql\n-- BAD: Seq Scan + Sort on 1M rows\nSELECT id, value, created_at\nFROM items\nWHERE tenant_id = $1\nORDER BY created_at DESC;\n```\nPASS: Add composite index matching ORDER BY\n```sql\nCREATE INDEX CONCURRENTLY idx_items_tenant_created\nON items(tenant_id, created_at DESC);\n-- NOW: Index Scan Backward — constant-time\n```\n\n## References\n\n- [PostgreSQL 16 Documentation](https:\u002F\u002Fwww.postgresql.org\u002Fdocs\u002F16\u002F) · last_verified: 2025-05\n- [Use the Index, Luke — PostgreSQL Indexing Guide](https:\u002F\u002Fuse-the-index-luke.com\u002F) · last_verified: 2025-05\n- [golang-migrate Documentation](https:\u002F\u002Fgithub.com\u002Fgolang-migrate\u002Fmigrate) · last_verified: 2025-05\n\n## Verification Checklist\n\n- [ ] All value columns use `BIGINT` in units (never FLOAT\u002FDECIMAL)\n- [ ] All timestamp columns use `TIMESTAMPTZ` (never TIMESTAMP without zone)\n- [ ] Production indexes created with `CONCURRENTLY` (never blocking writes)\n- [ ] Migrations have both `up` and `down` files\n- [ ] Pagination uses cursor-based pattern, not `OFFSET`\n- [ ] Queries use parameterized inputs (no string concatenation)\n- [ ] `EXPLAIN ANALYZE` run on new\u002Fmodified query paths\n- [ ] Parameterized queries verified against SQL Injection Prevention Cheat Sheet (no string concat)\n\n## Troubleshooting\n\n| Symptom | Likely cause | Fix |\n|---------|-------------|-----|\n| Query slow despite index | Wrong index type or column order | Run `EXPLAIN ANALYZE`; verify index matches filter + sort columns |\n| Migration blocks writes on production | `CREATE INDEX` without `CONCURRENTLY` | Drop index; re-create with `CREATE INDEX CONCURRENTLY` |\n| Connection pool exhausted | `MaxConns` too low or slow queries holding connections | Increase pool size; add statement timeout; check for long-running queries |\n| Cache returns stale data | Cache not invalidated on write path | Add cache invalidation in the mutation code path |\n| Index created CONCURRENTLY but not used by query planner (known issue: statistics stale) | Table statistics not updated after index creation | Run `ANALYZE` after `CREATE INDEX CONCURRENTLY` to refresh planner statistics |\n| MVCC bloat causes table size to grow unbounded (autovacuum can't keep up) | Long-running transactions prevent vacuum from reclaiming dead tuples | Set `idle_in_transaction_session_timeout`; monitor `pg_stat_user_tables.n_dead_tup`; tune autovacuum scale_factor |\n| Parameter sniffing: same plan used for different parameter values, causing slow queries on some inputs | PostgreSQL caches plan from first execution with specific params | Use `SET plan_cache_mode = 'force_custom_plan'` for skewed data; or use dynamic SQL with literals |\n\n| [WARN] `VACUUM FULL` blocks writes and causes replication lag | VACUUM FULL takes ACCESS EXCLUSIVE lock; triggers WAL burst on replicas | Use `pg_repack` instead of VACUUM FULL; schedule during maintenance window with application drain |\n| GORM AutoMigrate creates a constraint with a name that conflicts with an existing FK | AutoMigrate generates constraint names dynamically; name collision on concurrent migration | Disable AutoMigrate in production; use explicit migration with named ALTER TABLE ADD CONSTRAINT |\n| Limitation: pg_stat_statements resets on server restart, losing long-term query performance history | pg_stat_statements is in-memory; restart or failover resets all accumulated statistics | Snapshot pg_stat_statements to a logging table every hour via pg_cron; monitor trends not absolute values |\n",{"name":5,"license":15,"metadata":24,"description":7},{"author":25,"status":26,"version":27,"category":28},"Community","stable","1.1","data","main","6692ee5cbe39d4533b824e1c55d7d4fc01c4dde7","content\u002Fskills\u002Fpostgres-database-expert",0,"https:\u002F\u002Fgithub.com\u002Fronsilver\u002Fagent-covenant","https:\u002F\u002Fgithub.com\u002Fronsilver",":v","2026-08-27 05:49:26",{"source":8,"skillName":5,"commands":38,"prompt":48,"zipAvailable":49},[39,42,45],{"tool":40,"command":41},"npx","npx skills add ronsilver\u002Fagent-covenant --skill postgres-database-expert",{"tool":43,"command":44},"bunx","bunx skills add ronsilver\u002Fagent-covenant --skill postgres-database-expert",{"tool":46,"command":47},"pnpm","pnpm dlx skills add ronsilver\u002Fagent-covenant --skill postgres-database-expert","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fronsilver\u002Fagent-covenant\u002Fblob\u002Fmain\u002Fcontent\u002Fskills\u002Fpostgres-database-expert\u002FSKILL.md",true,[51,57,61,65,69,73,77,81,85,89],{"path":52,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":55,"sourceHtmlUrl":56},"evals\u002Fevals.json","REFERENCE","参考文档",2359,"https:\u002F\u002Fgithub.com\u002Fronsilver\u002Fagent-covenant\u002Fblob\u002Fmain\u002Fcontent\u002Fskills\u002Fpostgres-database-expert\u002Fevals\u002Fevals.json",{"path":58,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":59,"sourceHtmlUrl":60},"references\u002Fcode-patterns.md",13398,"https:\u002F\u002Fgithub.com\u002Fronsilver\u002Fagent-covenant\u002Fblob\u002Fmain\u002Fcontent\u002Fskills\u002Fpostgres-database-expert\u002Freferences\u002Fcode-patterns.md",{"path":62,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":63,"sourceHtmlUrl":64},"references\u002Fmigrations.md",3422,"https:\u002F\u002Fgithub.com\u002Fronsilver\u002Fagent-covenant\u002Fblob\u002Fmain\u002Fcontent\u002Fskills\u002Fpostgres-database-expert\u002Freferences\u002Fmigrations.md",{"path":66,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":67,"sourceHtmlUrl":68},"references\u002Fnaming.md",2959,"https:\u002F\u002Fgithub.com\u002Fronsilver\u002Fagent-covenant\u002Fblob\u002Fmain\u002Fcontent\u002Fskills\u002Fpostgres-database-expert\u002Freferences\u002Fnaming.md",{"path":70,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":71,"sourceHtmlUrl":72},"references\u002Foverview.md",2119,"https:\u002F\u002Fgithub.com\u002Fronsilver\u002Fagent-covenant\u002Fblob\u002Fmain\u002Fcontent\u002Fskills\u002Fpostgres-database-expert\u002Freferences\u002Foverview.md",{"path":74,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":75,"sourceHtmlUrl":76},"references\u002Fperformance.md",3743,"https:\u002F\u002Fgithub.com\u002Fronsilver\u002Fagent-covenant\u002Fblob\u002Fmain\u002Fcontent\u002Fskills\u002Fpostgres-database-expert\u002Freferences\u002Fperformance.md",{"path":78,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":79,"sourceHtmlUrl":80},"references\u002Fschema-design.md",4301,"https:\u002F\u002Fgithub.com\u002Fronsilver\u002Fagent-covenant\u002Fblob\u002Fmain\u002Fcontent\u002Fskills\u002Fpostgres-database-expert\u002Freferences\u002Fschema-design.md",{"path":82,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":83,"sourceHtmlUrl":84},"references\u002Fsecurity.md",3505,"https:\u002F\u002Fgithub.com\u002Fronsilver\u002Fagent-covenant\u002Fblob\u002Fmain\u002Fcontent\u002Fskills\u002Fpostgres-database-expert\u002Freferences\u002Fsecurity.md",{"path":86,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":87,"sourceHtmlUrl":88},"references\u002Fstack.md",4115,"https:\u002F\u002Fgithub.com\u002Fronsilver\u002Fagent-covenant\u002Fblob\u002Fmain\u002Fcontent\u002Fskills\u002Fpostgres-database-expert\u002Freferences\u002Fstack.md",{"path":90,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":91,"sourceHtmlUrl":92},"references\u002Fworkflow.md",3219,"https:\u002F\u002Fgithub.com\u002Fronsilver\u002Fagent-covenant\u002Fblob\u002Fmain\u002Fcontent\u002Fskills\u002Fpostgres-database-expert\u002Freferences\u002Fworkflow.md",[94,101,108,115,122,129],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":19},"01M7A7HYVYNZ60GNGWAV51ZQ52","web-browsing-agent-expert","Web browsing for AI agents: driving a headless browser (Playwright, Puppeteer) from agent tooling, navigation and page-state grounding, DOM extraction and structured data capture, form interaction, session and cookie management, anti-bot mitigation awareness, and safe browsing rules (no PII exfiltration, respect robots and terms). Use when building a browsing tool or MCP server for an agent, teaching an agent to navigate and read web pages, extracting structured content from dynamic sites, or handling login walls and pagination in agent workflows. Trigger: web browsing agent, headless browser, Playwright MCP, Puppeteer, browser automation for agents, DOM extraction, page navigation, session management. Do NOT trigger for: end-to-end UI testing of an application (use playwright-expert); writing standalone scraping scripts for data pipelines (use python-expert); fetching a single public URL (use the fetch tool).","https:\u002F\u002Fgithub.com\u002Fronsilver\u002Fagent-covenant\u002Fblob\u002Fmain\u002Fcontent\u002Fskills\u002Fweb-browsing-agent-expert\u002FSKILL.md",[],[],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":19},"01M7A7HRC6951BAJ9NHBZA2M7Y","vector-databases","Design and operate vector databases for cloud-native AI features. Use when selecting between pgvector, Pinecone, or Weaviate for AI context layer or integration-hub; designing embedding schemas and index parameters; implementing ANN search with metadata filtering; managing embedding model versions; optimizing query latency; or debugging low retrieval quality. Pairs with rag-architecture for pipeline design and postgres-database-expert for pgvector specifics. Trigger: vector database, pgvector, Pinecone, Weaviate, embedding, ANN search, HNSW, cosine similarity. Do NOT trigger for: relational SQL optimization, standard PostgreSQL schema design, Redis caching.","https:\u002F\u002Fgithub.com\u002Fronsilver\u002Fagent-covenant\u002Fblob\u002Fmain\u002Fcontent\u002Fskills\u002Fvector-databases\u002FSKILL.md",[],[],{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":19},"01M7A7HGHGWE7NZ5A08HQZJXDN","typescript-expert","Full-stack TypeScript stack for modern projects: frontend SSR\u002FCSR with Next.js 14 App Router and React, backend APIs with Node.js (Express\u002FFastify), state management with Zustand\u002FRedux Toolkit, unit and integration testing with Vitest\u002FJest + React Testing Library + MSW, and static analysis with ESLint\u002FPrettier\u002Ftsc. Use when building React components or hooks, implementing Next.js App Router or Server Components, writing Node.js REST API handlers, implementing middleware (auth, rate-limit, logging), managing client state (Zustand\u002FRTK), writing frontend\u002Fbackend tests, or running TypeScript linting\u002Ftype checks. Trigger: TypeScript, Next.js, React, Zustand, Node.js, Express, Fastify, MSW, Vitest. Do NOT trigger for: Python backend development, Go microservices, iOS\u002Fmobile development.","https:\u002F\u002Fgithub.com\u002Fronsilver\u002Fagent-covenant\u002Fblob\u002Fmain\u002Fcontent\u002Fskills\u002Ftypescript-expert\u002FSKILL.md",[],[],{"skillNo":116,"name":117,"nameZh":6,"description":118,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":119,"categories":120,"keywords":121,"publishedAt":19},"01M7A7H83JK9SENNYAPTTB6B4A","tool-usage","Guide correct tool selection, design, and orchestration for AI agents. Use when choosing between dedicated vs Bash tools, designing MCP tool interfaces, naming tool parameters, handling tool response limits, orchestrating parallel vs sequential calls, evaluating tool accuracy, applying ACI design principles, selecting workflow patterns, or reading\u002Ffiltering\u002Ftransforming\u002Fgenerating structured data (JSON, YAML, CSV, TOML, XML). Trigger: tool selection, MCP tool design, orchestration, ACI, parallel execution, composite tool, structured data, jq, yq, dasel, mlr, csvkit. Do NOT trigger for: writing application business logic, domain-specific development (route to domain skill), database migrations.","https:\u002F\u002Fgithub.com\u002Fronsilver\u002Fagent-covenant\u002Fblob\u002Fmain\u002Fcontent\u002Fskills\u002Ftool-usage\u002FSKILL.md",[],[],{"skillNo":123,"name":124,"nameZh":6,"description":125,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":126,"categories":127,"keywords":128,"publishedAt":19},"01M7A7GZ9A2VA9T7BJ07VV3PD5","token-efficiency","Enforce token-efficient output, compression, caching, and model routing. Use when calibrating response verbosity, applying compression strategies to logs or RAG chunks, routing tasks to the right model tier, setting thinking budgets, enforcing word limits, compressing context before reinitiation, applying KV-cache ordering, masking tool output observations, or applying clarification-first protocol before irreversible actions. Trigger: token efficiency, compression, model routing, thinking budget, KV-cache, clarification protocol. Do NOT trigger for: non-agent tooling, CI\u002FCD pipeline scripting, infrastructure provisioning.","https:\u002F\u002Fgithub.com\u002Fronsilver\u002Fagent-covenant\u002Fblob\u002Fmain\u002Fcontent\u002Fskills\u002Ftoken-efficiency\u002FSKILL.md",[],[],{"skillNo":130,"name":131,"nameZh":6,"description":132,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":133,"categories":134,"keywords":135,"publishedAt":19},"01M7A7GQFTY8GWVN4Z66Q4J52V","time-series-db","Time-series database patterns for cloud-native metrics and analytics: TimescaleDB, InfluxDB, and Amazon Timestream selection; continuous aggregates, retention policies, downsampling, and integration with Prometheus\u002FGrafana. Use when storing business metrics over time, building custom business dashboards, designing high-frequency event storage, or querying time-bucketed aggregations. Trigger: time-series, TimescaleDB, InfluxDB, Prometheus, Grafana, hypertable, continuous aggregate, retention policy. Do NOT trigger for: relational PostgreSQL schema design, NoSQL document stores, Kafka event streaming.","https:\u002F\u002Fgithub.com\u002Fronsilver\u002Fagent-covenant\u002Fblob\u002Fmain\u002Fcontent\u002Fskills\u002Ftime-series-db\u002FSKILL.md",[],[]]