[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M74G6ZJEC0S43JS8Q77B9V4E":3,"skill-same:01M74G6ZJEC0S43JS8Q77B9V4E":44},{"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":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M74G6ZJEC0S43JS8Q77B9V4E","audit-pg-config",null,"Audit Postgres server config — shared_buffers, work_mem, max_connections vs pgbouncer pool, autovacuum tuning, WAL retention.","MohammadBafkar\u002Fpolymath","MohammadBafkar","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F34940462?v=4","01M74G540TQFZWK6KVAPKFVGNR","Mohammad Bafkar","01M74G541HG19QP9V5DQCJVKYE",0,"MIT","https:\u002F\u002Fgithub.com\u002FMohammadBafkar\u002Fpolymath\u002Fblob\u002Fmain\u002Fplugins\u002Fpolymath-backend\u002Fskills\u002Faudit-pg-config\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: audit-pg-config\ndescription: Audit Postgres server config — shared_buffers, work_mem, max_connections vs pgbouncer pool, autovacuum tuning, WAL retention.\n---\n\n# audit-pg-config\n\n> Sanity-check a Postgres config against the workload. Output: parameter-by-parameter findings + concrete change suggestions.\n\n**Mode:** analytical — judgment inside a fixed frame. Keep the output shape; every verdict cites its evidence; unknowns are marked `[TBD]` or `[VERIFY]`, never filled in.\n\n## When to use\n\n- A Postgres instance is slow, OOMing, bloating, or lagging replicas and the config is a suspect.\n- Before a traffic step-up, or after migrating to a new host \u002F managed tier.\n\n## Inputs\n\n- The effective settings — not the config file you *think* is deployed:\n  `SELECT name, setting, unit, source FROM pg_settings WHERE source \u003C> 'default';` plus `SELECT version();`.\n- Host RAM and CPU, whether a pooler (pgbouncer) sits in front, the workload shape (OLTP \u002F analytics \u002F mixed), and whether it is managed (RDS\u002FAurora\u002FCloud SQL\u002FAzure — some parameters are fixed or set through parameter groups).\n- Missing an input? Say which finding it blocks and continue with the rest; don't guess RAM or workload.\n\n**Read-only.** Gather with `SELECT`\u002F`SHOW` only. Never run `ALTER SYSTEM`, change a parameter group, or reload\u002Frestart — recommend; the owner applies.\n\n## Procedure\n\n1. **Memory.**\n   - `shared_buffers` — 25% of RAM is a common starting point; over 40% and you start fighting the OS page cache.\n   - `work_mem` — per-operation, *per-connection*. `work_mem × max_connections × parallel_workers` can OOM a host. Lean on the smaller side; raise per-session for ETL.\n   - `maintenance_work_mem` — for autovacuum + CREATE INDEX. 1-2GB on hosts with > 32GB RAM is reasonable.\n2. **Connections.**\n   - `max_connections` — high values (> 200) waste memory; pair with `pgbouncer` in `transaction` mode and let the bouncer hold the pool.\n   - Hard floor: enough headroom for `pg_stat_statements`, monitoring agents, and admin sessions.\n3. **WAL + checkpoints.**\n   - `wal_compression = on` — cheap CPU for less WAL bytes (helps replicas).\n   - `max_wal_size` \u002F `min_wal_size` — too small triggers checkpoints too often (latency spikes).\n   - `checkpoint_completion_target = 0.9` — spreads checkpoint IO over time.\n4. **Autovacuum.**\n   - `autovacuum_vacuum_scale_factor` — default 0.2 means vacuum kicks in at 20% dead tuples; large tables benefit from a much lower per-table setting (e.g. 0.05).\n   - `autovacuum_max_workers` — raise above the default 3 for many-tabled clusters.\n   - `autovacuum_analyze_scale_factor` — analyze runs less than vacuum; on hot tables, tune down.\n5. **Statistics.**\n   - `default_statistics_target` — 100 is the default; 500-1000 for skew-y joins where the planner makes bad row-estimates.\n   - `track_io_timing = on` — needed for `pg_stat_statements` to show meaningful IO numbers.\n6. **Replication.**\n   - `hot_standby_feedback = on` if long-running replica reads exist (prevents query cancellations on the replica — at the cost of bloat on the primary while those queries run).\n   - `wal_keep_size` (PG 13+) replaces `wal_keep_segments`; ensure replicas can catch up without falling off.\n   - Replication slots retain WAL until consumed — an abandoned slot fills the disk. Set `max_slot_wal_keep_size` (PG 13+) and check `pg_replication_slots` for inactive slots.\n7. **Logging.**\n   - `log_min_duration_statement = '500ms'` (or workload-specific). Cheaper than waiting for a customer ticket.\n   - `log_lock_waits = on` — diagnose lock-storm incidents.\n\n## Output\n\n```text\naudit-pg-config\n\nHost:    db.refund-prod\nVersion: 16.3\nRAM:     64GB\n\nMemory\n  ✓ shared_buffers = 16GB (25% of RAM).\n  ✗ work_mem = 256MB; with max_connections=300 worst-case 75GB. Lower to 64MB\n    (per-session bump for ETL).\n\nConnections\n  ✗ max_connections = 300 without a pgbouncer. Add pgbouncer in transaction mode;\n    drop max_connections to ~120.\n\nAutovacuum\n  ✓ autovacuum on.\n  ⚠ refunds table dead-tuple ratio 38% (per pg_stat_user_tables). Per-table\n    autovacuum_vacuum_scale_factor = 0.05; consider HOT-only tuning.\n\nWAL\n  ✓ max_wal_size = 4GB.\n\nLogging\n  ✗ log_min_duration_statement = -1 (off). Recommend 500ms.\n\nRecommendation: 4 changes; mem + connections are the highest leverage.\n```\n\n## Anti-patterns to avoid\n\n- Raising `max_connections` without `pgbouncer`. Linear memory cost per backend.\n- Turning autovacuum off \"for now\". You will not turn it back on; bloat will eat you.\n- Setting `fsync = off` on production. Data loss on crash.\n- Cargo-culted `shared_buffers = 4GB` on a 256GB host. Match the workload, not the wiki.\n\n## Related skills\n\n- `polymath-database:postgres-performance` — runtime tuning from `pg_stat_*` evidence (bloat, HOT, index types, locks, pooling); this skill audits the settings, that one diagnoses the workload.\n- `polymath-database:db-performance-triage` — start there when the bottleneck isn't known.\n","# audit-pg-config\n\n> Sanity-check a Postgres config against the workload. Output: parameter-by-parameter findings + concrete change suggestions.\n\n**Mode:** analytical — judgment inside a fixed frame. Keep the output shape; every verdict cites its evidence; unknowns are marked `[TBD]` or `[VERIFY]`, never filled in.\n\n## When to use\n\n- A Postgres instance is slow, OOMing, bloating, or lagging replicas and the config is a suspect.\n- Before a traffic step-up, or after migrating to a new host \u002F managed tier.\n\n## Inputs\n\n- The effective settings — not the config file you *think* is deployed:\n  `SELECT name, setting, unit, source FROM pg_settings WHERE source \u003C> 'default';` plus `SELECT version();`.\n- Host RAM and CPU, whether a pooler (pgbouncer) sits in front, the workload shape (OLTP \u002F analytics \u002F mixed), and whether it is managed (RDS\u002FAurora\u002FCloud SQL\u002FAzure — some parameters are fixed or set through parameter groups).\n- Missing an input? Say which finding it blocks and continue with the rest; don't guess RAM or workload.\n\n**Read-only.** Gather with `SELECT`\u002F`SHOW` only. Never run `ALTER SYSTEM`, change a parameter group, or reload\u002Frestart — recommend; the owner applies.\n\n## Procedure\n\n1. **Memory.**\n   - `shared_buffers` — 25% of RAM is a common starting point; over 40% and you start fighting the OS page cache.\n   - `work_mem` — per-operation, *per-connection*. `work_mem × max_connections × parallel_workers` can OOM a host. Lean on the smaller side; raise per-session for ETL.\n   - `maintenance_work_mem` — for autovacuum + CREATE INDEX. 1-2GB on hosts with > 32GB RAM is reasonable.\n2. **Connections.**\n   - `max_connections` — high values (> 200) waste memory; pair with `pgbouncer` in `transaction` mode and let the bouncer hold the pool.\n   - Hard floor: enough headroom for `pg_stat_statements`, monitoring agents, and admin sessions.\n3. **WAL + checkpoints.**\n   - `wal_compression = on` — cheap CPU for less WAL bytes (helps replicas).\n   - `max_wal_size` \u002F `min_wal_size` — too small triggers checkpoints too often (latency spikes).\n   - `checkpoint_completion_target = 0.9` — spreads checkpoint IO over time.\n4. **Autovacuum.**\n   - `autovacuum_vacuum_scale_factor` — default 0.2 means vacuum kicks in at 20% dead tuples; large tables benefit from a much lower per-table setting (e.g. 0.05).\n   - `autovacuum_max_workers` — raise above the default 3 for many-tabled clusters.\n   - `autovacuum_analyze_scale_factor` — analyze runs less than vacuum; on hot tables, tune down.\n5. **Statistics.**\n   - `default_statistics_target` — 100 is the default; 500-1000 for skew-y joins where the planner makes bad row-estimates.\n   - `track_io_timing = on` — needed for `pg_stat_statements` to show meaningful IO numbers.\n6. **Replication.**\n   - `hot_standby_feedback = on` if long-running replica reads exist (prevents query cancellations on the replica — at the cost of bloat on the primary while those queries run).\n   - `wal_keep_size` (PG 13+) replaces `wal_keep_segments`; ensure replicas can catch up without falling off.\n   - Replication slots retain WAL until consumed — an abandoned slot fills the disk. Set `max_slot_wal_keep_size` (PG 13+) and check `pg_replication_slots` for inactive slots.\n7. **Logging.**\n   - `log_min_duration_statement = '500ms'` (or workload-specific). Cheaper than waiting for a customer ticket.\n   - `log_lock_waits = on` — diagnose lock-storm incidents.\n\n## Output\n\n```text\naudit-pg-config\n\nHost:    db.refund-prod\nVersion: 16.3\nRAM:     64GB\n\nMemory\n  ✓ shared_buffers = 16GB (25% of RAM).\n  ✗ work_mem = 256MB; with max_connections=300 worst-case 75GB. Lower to 64MB\n    (per-session bump for ETL).\n\nConnections\n  ✗ max_connections = 300 without a pgbouncer. Add pgbouncer in transaction mode;\n    drop max_connections to ~120.\n\nAutovacuum\n  ✓ autovacuum on.\n  ⚠ refunds table dead-tuple ratio 38% (per pg_stat_user_tables). Per-table\n    autovacuum_vacuum_scale_factor = 0.05; consider HOT-only tuning.\n\nWAL\n  ✓ max_wal_size = 4GB.\n\nLogging\n  ✗ log_min_duration_statement = -1 (off). Recommend 500ms.\n\nRecommendation: 4 changes; mem + connections are the highest leverage.\n```\n\n## Anti-patterns to avoid\n\n- Raising `max_connections` without `pgbouncer`. Linear memory cost per backend.\n- Turning autovacuum off \"for now\". You will not turn it back on; bloat will eat you.\n- Setting `fsync = off` on production. Data loss on crash.\n- Cargo-culted `shared_buffers = 4GB` on a 256GB host. Match the workload, not the wiki.\n\n## Related skills\n\n- `polymath-database:postgres-performance` — runtime tuning from `pg_stat_*` evidence (bloat, HOT, index types, locks, pooling); this skill audits the settings, that one diagnoses the workload.\n- `polymath-database:db-performance-triage` — start there when the bottleneck isn't known.\n",{"name":5,"description":7},"main","23f6e21841a39580c9da2b5ec941f39dda17cd86","plugins\u002Fpolymath-backend\u002Fskills\u002Faudit-pg-config","https:\u002F\u002Fgithub.com\u002FMohammadBafkar\u002Fpolymath","https:\u002F\u002Fgithub.com\u002FMohammadBafkar","2026-10-29 18:34:59",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add MohammadBafkar\u002Fpolymath --skill audit-pg-config",{"tool":36,"command":37},"bunx","bunx skills add MohammadBafkar\u002Fpolymath --skill audit-pg-config",{"tool":39,"command":40},"pnpm","pnpm dlx skills add MohammadBafkar\u002Fpolymath --skill audit-pg-config","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMohammadBafkar\u002Fpolymath\u002Fblob\u002Fmain\u002Fplugins\u002Fpolymath-backend\u002Fskills\u002Faudit-pg-config\u002FSKILL.md",true,[],[45,52,59,66,73,80],{"skillNo":46,"name":47,"nameZh":6,"description":48,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":19},"01M74GN87EBRHM9N87M7AP1HDD","runbook","Write or refresh an operational runbook for an alert\u002Fsymptom; structured as TL;DR + Pre-checks + Steps + Verification + Rollback + Escalation.","https:\u002F\u002Fgithub.com\u002FMohammadBafkar\u002Fpolymath\u002Fblob\u002Fmain\u002Fplugins\u002Fpolymath-writing\u002Fskills\u002Frunbook\u002FSKILL.md",[],[],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":19},"01M74GN5GPKEC1JEKP2DFQNEQJ","rfc","Draft a lightweight design RFC to docs\u002Frfcs\u002F\u003Cslug>.md; Summary, Motivation, Detailed design, Drawbacks, Alternatives, Unresolved questions. A proposal to debate, not a recorded decision (adr).","https:\u002F\u002Fgithub.com\u002FMohammadBafkar\u002Fpolymath\u002Fblob\u002Fmain\u002Fplugins\u002Fpolymath-writing\u002Fskills\u002Frfc\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M74GN2F4CWPMV4X09TG4E304","editorial-pass","Review and tighten prose in a Markdown artifact for a target tone (terse, formal, friendly) without dropping information; preserve quotations and load-bearing constraints.","https:\u002F\u002Fgithub.com\u002FMohammadBafkar\u002Fpolymath\u002Fblob\u002Fmain\u002Fplugins\u002Fpolymath-writing\u002Fskills\u002Feditorial-pass\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M74GMZWGYMZ37C4DYGT6P23G","architecture-review-facilitation","Run an architecture review as a process — entry criteria, reviewer checklist, decision log, and follow-up actions — pairing the design artifact with a red-team pass.","https:\u002F\u002Fgithub.com\u002FMohammadBafkar\u002Fpolymath\u002Fblob\u002Fmain\u002Fplugins\u002Fpolymath-writing\u002Fskills\u002Farchitecture-review-facilitation\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M74GMXVX0YX3ETDXS527XDGM","architecture-doc","Write a C4-style architecture document; System Context + Containers (+ Components when interesting) with mermaid diagrams. Describes structure, not a decision (adr) or proposal (rfc).","https:\u002F\u002Fgithub.com\u002FMohammadBafkar\u002Fpolymath\u002Fblob\u002Fmain\u002Fplugins\u002Fpolymath-writing\u002Fskills\u002Farchitecture-doc\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M74GMVG1WSMCK066S3KE6V5K","adr","Write an Architecture Decision Record (Michael Nygard format) to docs\u002Fadrs\u002FNNNN-\u003Cslug>.md; frontmatter validated by the ADR artifact schema. Records a made decision, not a proposal to debate (rfc).","https:\u002F\u002Fgithub.com\u002FMohammadBafkar\u002Fpolymath\u002Fblob\u002Fmain\u002Fplugins\u002Fpolymath-writing\u002Fskills\u002Fadr\u002FSKILL.md",[],[]]