PostgreSQL Diagnostics and Review Skills
English | 日本語
Five agent skills for investigating PostgreSQL performance, reviewing configuration, schema design and security, and validating changes under a representative workload. Each skill turns observations into findings, missing evidence, proposed changes, and verification steps.
Start with the English examples or 日本語の利用例. Skill instructions and detailed reference documents are currently primarily in Japanese; the use-case examples are available in both languages.
Install as a Claude Code plugin
This repository is a Claude Code plugin and its own marketplace. In Claude Code, run:
/plugin marketplace add soudai/postgresql-use-improve-agents-skill
/plugin install postgresql-skills@postgresql-use-improve-agents-skill
All five skills are installed together. Describe the task and Claude selects the matching skill from its description, or name the skill as a command:
/postgresql-skills:postgres-performance-diagnostics Review before.json and after.json.
The affected API has a p95 target of 200 ms. Rank candidates by user impact and
include verification and rollback steps.
| Task | Command |
|---|
| Update to the latest version | /plugin marketplace update postgresql-use-improve-agents-skill |
| Uninstall | /plugin uninstall postgresql-skills@postgresql-use-improve-agents-skill |
| Try a local checkout without installing | claude --plugin-dir /path/to/postgresql-use-improve-agents-skill |
Requirements: the bundled scripts run on the machine where Claude Code runs and need Python 3.10 or later. Collectors that connect to PostgreSQL also need psql, or an existing container selected with --docker-container. Connection settings come from libpq environment variables or a service file; never put passwords in a prompt.
For other agents, see Use a skill with your agent.
Choose a skill
| Task | Skill | Main inputs |
|---|
| Slow SQL, waits, I/O, locks, vacuum, WAL or replication | postgres-performance-diagnostics | Two statistics snapshots, wait samples, plans, logs or application traces |
| Memory, connections, checkpoints, autovacuum, planner or JIT settings | postgres-config-tuning | Current settings, available resources, workload and interval report |
| Missing constraints, naming, lifecycle, responsibilities or contention-prone tables | postgres-schema-review | Catalog snapshot, business contract and operational evidence |
| Roles, RLS, authentication, TLS, runtime privileges or security updates | postgres-security-review | Catalog snapshot, access contract and evidence for each connection route |
| Correctness, latency, throughput and resource use before and after a change | postgres-workload-validation | Repeated run logs, matching conditions, SLOs and a validation policy |
Use the skills together when needed: diagnose a symptom, prepare a scoped change, then validate it. A schema or security review can also start independently from an existing snapshot.
Try an offline example
Python 3.10 or later is sufficient for this example. Use python3 in place of python if that is your interpreter's command name. From the repository root, run:
python skills/postgres-workload-validation/scripts/compare_runs.py example/inputs/workload/baseline.json example/inputs/workload/candidate.json --p95-ms 20 --min-tps 4 --max-loss-rate 0 --metric-max oom_kills=0
The JSON result includes "decision": "rollback_candidate": the candidate returns a different result, even though its synthetic latency values are lower. Missing resource metrics and insufficient trials remain visible in the report. The command analyzes local files and does not connect to PostgreSQL or perform a rollback.
These tiny fixtures demonstrate the decision logic; they are not benchmark measurements or sufficient evidence of performance. See the complete prompt and result.
Use a skill with your agent
For Claude Code, install the plugin as described in Install as a Claude Code plugin. For other agents:
Copy the complete folder for each skill you need from skills/ into your agent's configured skill discovery directory. Keep its SKILL.md, scripts/, sql/, references/ and assets/ together where present. Check existing installations before replacing them. The discovery path and invocation syntax depend on your agent.
The examples use $skill-name invocation. For an agent that accepts it: