pg-health-check — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited pg-health-check (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
This skill guides a comprehensive health assessment of a PostgreSQL database using pgtuner-mcp tools, producing a scored report with prioritized action items.
Use this skill when the user:
Before running full tool scans, the agent can use targeted resources:
pgtuner://health/{check_type} -- Targeted health checks: connections, cache, locks, replication, bloat, all (lightweight, avoids running the full health tool)pgtuner://settings/{category} -- Settings by category: memory, checkpoint, wal, autovacuum, connectionspgtuner://docs/workflows -- Recommended workflow patternsSmart resource usage: After the full health check in Step 1, use targeted resources for follow-up instead of re-running the full tool. For example, if the locks dimension scores low, read pgtuner://health/locks for quick re-checks after remediation.
This skill corresponds to the `health_check` MCP Prompt. If the user triggers that prompt, follow this skill's workflow.
DATABASE_URIpg_stat_statements extensionpg_stat_activity, pg_stat_bgwriter, pg_locksUser asks for health check
|
+--> Quick check or full check?
| QUICK --> Read pgtuner://health/all resource (fast, no tool call)
| FULL --> Start with Step 1 (check_database_health)
|
+--> After Step 1, which dimensions scored low?
|
+--> Connections < 90 --> Prioritize Step 2, then pg-connection-analysis skill
+--> Cache < 90 --> Prioritize Step 5 (I/O), then pg-io-deep-dive skill
+--> Locks < 90 --> Prioritize Step 2 + Step 3, then pg-lock-diagnosis skill
+--> Wraparound < 90 --> URGENT: check pg-vacuum-tuning skill
+--> Checkpoints < 90 --> Prioritize Step 5, then pg-config-tuning skill
+--> All >= 90 --> Summary report, suggest pg-performance-baselineTool: check_database_health
Parameters:
include_recommendations: true
verbose: trueWhat this checks (8 health dimensions):
max_connectionsshared_buffers effectivenessInterpret the scores:
Record the overall score and any dimensions scoring below 90.
Tool: get_active_queries
Parameters:
include_idle: true # Include idle-in-transaction
include_system: false
min_duration_seconds: 0 # Show all active queriesWhat to look for:
| Condition | Severity | Action |
|---|---|---|
| Query running > 5 minutes | Warning | Investigate the query, may need optimization |
| Query running > 30 minutes | Critical | Consider canceling unless it's a known batch job |
| idle in transaction > 60s | Warning | Application not closing transactions properly |
| idle in transaction > 5 min | Critical | Leaking connections, blocks vacuum |
| Blocked queries waiting on locks | Critical | Identify the blocker and resolve |
| Connection count > 80% of max | Warning | Add connection pooling (PgBouncer) |
Tool: analyze_wait_events
Parameters:
active_only: trueInterpret wait event types:
| Wait Type | Meaning | Common Solutions |
|---|---|---|
| Lock | Row-level or table-level contention | Optimize transactions, reduce lock duration |
| IO/DataFileRead | Reading data from disk | Increase shared_buffers, add RAM, or optimize queries |
| IO/WALWrite | WAL write bottleneck | Use faster disk for pg_wal, tune wal_buffers |
| BufferPin | Buffer contention | Reduce concurrent access to hot pages |
| LWLock/buffer_mapping | Shared buffer contention | Increase shared_buffers or reduce concurrent access |
| Client/ClientRead | Waiting for client response | Network latency or slow application |
| Activity/WalSenderMain | Replication sender idle | Normal for streaming replication |
Tool: review_settings
Parameters:
category: "all"
include_all_settings: falseKey settings to validate:
| Setting | Rule of Thumb | Red Flag |
|---|---|---|
shared_buffers | 25% of RAM | < 128 MB |
effective_cache_size | 50-75% of RAM | < 1 GB |
work_mem | 32-256 MB depending on max_connections | < 4 MB |
maintenance_work_mem | 256 MB - 2 GB | < 64 MB |
checkpoint_completion_target | 0.9 | < 0.7 |
random_page_cost | 1.1 for SSD, 4.0 for HDD | Default 4.0 on SSD |
effective_io_concurrency | 200 for SSD, 2 for HDD | Default 1 on SSD |
max_connections | Based on actual need | > 200 without pooler |
autovacuum | on | off |
wal_level | replica or logical | minimal (can't do replication) |
max_wal_size | 2-8 GB | < 1 GB (frequent checkpoints) |
Use targeted analysis types based on which health dimension scored low:
For cache-related issues:
Tool: analyze_disk_io_patterns
Parameters:
analysis_type: "buffer_pool"
top_n: 20For checkpoint-related issues:
Tool: analyze_disk_io_patterns
Parameters:
analysis_type: "checkpoints"
top_n: 10For a comprehensive I/O overview:
Tool: analyze_disk_io_patterns
Parameters:
analysis_type: "all"
top_n: 20What to look for:
heap_blks_read relative to heap_blks_hitmax_wal_size)Tool: get_bloat_summary
Parameters:
schema_name: "public"
top_n: 10What to look for:
| Dimension | Score | Status | Key Finding |
|---|---|---|---|
| Connections | 95 | Healthy | 23/100 connections used |
| Cache | 99.8 | Healthy | Cache hit ratio: 99.8% |
| Locks | 85 | Warning | 2 blocking locks detected |
| Replication | 100 | Healthy | No replication configured |
| Wraparound | 92 | Healthy | Oldest XID age: 450M |
| Disk | 78 | Warning | /data at 82% capacity |
| Background Writer | 88 | Warning | High buffer allocation rate |
| Checkpoints | 65 | Critical | 40% requested checkpoints |
| Overall | 88 | Warning |
Numbered list with specific remediation steps and SQL commands.
Issues that should be addressed within days/weeks.
Things that are currently OK but worth watching.
-- Present as ALTER SYSTEM commands with explanations
ALTER SYSTEM SET shared_buffers = '4GB'; -- Currently 128MB, server has 16GB RAM
ALTER SYSTEM SET max_wal_size = '4GB'; -- Reduce checkpoint frequency
-- Requires restart: shared_buffers
-- Reload only: max_wal_size (SELECT pg_reload_conf();)pg_terminate_backend() for idle connectionsshared_buffers or work_mem(restart) in pg_settings)After applying remediation for any health dimension:
pgtuner://health/{check_type} for the specific dimension to verify improvementSHOW setting_name after pg_reload_conf()get_active_queries with include_idle: true to confirmshared_buffers change requires a PostgreSQL restart. When is your next maintenance window?"pg-connection-analysis skillpg-lock-diagnosis skillpg-io-deep-dive skillpg-config-tuning skillpg-vacuum-tuning skillpg-bloat-analysis skillpg-performance-baseline skill| Feature | Version |
|---|---|
pg_stat_io (detailed I/O stats) | PG16+ |
pg_stat_wal (WAL statistics) | PG14+ |
pg_stat_progress_vacuum | PG9.6+ |
idle_in_transaction_session_timeout | PG9.6+ |
client_connection_check_interval | PG14+ |
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.