analyze-db-performance

analyze-db-performance is a skill for Claude Code from sgaunet/claude-plugins. It costs 14 tokens per session (1,672 once invoked), scanned A, original, MIT.

A PostgreSQL performance analyzer that examines query statistics, slow-query logs, table sizes, indexes, and system metrics. PostgreSQL is a database system, and indexes are structures that can help it find rows faster.

In plain words
What is it for?
Use it to investigate PostgreSQL speed problems from a database connection or slow-query log and obtain query and index findings.
Why use it?
It helps identify slow queries, large tables, and indexes that may be underused or missing. This replaces manually gathering and comparing several kinds of database performance data.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: positional $N argument.

Part of the devops-infrastructure plugin — 1 skill, 5 agents shipped together

Good fit Use it to investigate PostgreSQL speed problems from a database connection or slow-query log and obtain query and index findings.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/sgaunet/claude-plugins/analyze-db-performance
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add sgaunet/claude-plugins --skill analyze-db-performance
Clone the repo
git clone --depth 1 https://github.com/sgaunet/claude-plugins

Made for: Claude Code.

Or install devops-infrastructure, the plugin that ships this one along with the rest of its 1 skill, 5 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for analyze-db-performance

README.md
[![agentmods](https://agentmods.dev/badge/skills/sgaunet/claude-plugins/analyze-db-performance/github.svg)](https://agentmods.dev/skills/sgaunet/claude-plugins/analyze-db-performance)
Your own site
<a href="https://agentmods.dev/skills/sgaunet/claude-plugins/analyze-db-performance"><img src="https://agentmods.dev/badge/skills/sgaunet/claude-plugins/analyze-db-performance/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for analyze-db-performance

Your own site · 80×15
<a href="https://agentmods.dev/skills/sgaunet/claude-plugins/analyze-db-performance"><img src="https://agentmods.dev/badge/skills/sgaunet/claude-plugins/analyze-db-performance.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 14 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,672 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00014 $0.01672
Opus 5.5 $0.00006 $0.00669
Sonnet 5.5 $0.00003 $0.00334
Haiku 4.5 $0.00001 $0.00167

Measured 21d ago against content hash 2f6daf9d6bc3, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

analyze-db-performance scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 21d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/devops-infrastructure/skills/analyze-db-performance/SKILL.md · 191 lines

How it starts

The opening of the file, as written. The whole thing — 191 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Analyze Database Performance

Analyze PostgreSQL database performance using pg_stat_statements, slow query logs, and system metrics.

Process

  1. Validate Input: Check if argument is:

    • Database connection string (postgres://...)
    • Path to slow query log file
    • None (will look for local log files)
  2. Gather Performance Data: Launch 3 parallel Haiku agents to collect database metrics concurrently:

    Agent #1: Slow Query Analyzer

    • If connection string: Execute query against pg_stat_statements
      SELECT query, calls, total_exec_time, mean_exec_time, max_exec_time
      FROM pg_stat_statements
      ORDER BY mean_exec_time DESC
      LIMIT 20;
      
    • If log file: Parse slow query log and extract patterns
    • Return: list of top 20 slowest queries with execution stats

    Agent #2: Table Size Analyzer

    • If connection string: Execute table size query
      SELECT schemaname, tablename,
             pg_size_pretty(pg_total_relation_size(schemaname||'.'||tablename))
      FROM pg_tables
      ORDER BY pg_total_relation_size(schemaname||'.'||tablename) DESC;
      
    • Return: list of tables sorted by size

    Agent #3: Index Usage Analyzer

    • If connection string: Execute index usage query
      SELECT schemaname, tablename, indexname, idx_scan
      FROM pg_stat_user_indexes
      WHERE idx_scan = 0
      ORDER BY pg_relation_size(indexrelid) DESC;
      
    • Return: list of unused indexes (candidates for removal)
  3. Launch 2 parallel Sonnet agents to analyze performance data:

    Agent #4: PostgreSQL Specialist (postgresql-specialist agent)

    • Analyze slow queries from Agent #1
    • Review table sizes from Agent #2
    • Evaluate index usage from Agent #3
    • Generate optimization recommendations specific to PostgreSQL
    • Return: PostgreSQL-specific findings (indexes, query rewrites, config tuning)

    Agent #5: General Database Specialist (database-specialist agent)

    • Perform cross-platform analysis of performance patterns
    • Identify anti-patterns (N+1 queries, missing indexes, bloat)
    • Suggest architectural improvements
    • Return: general database optimization recommendations

Read the full file on GitHub · 191 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 21d ago First seen · 191 lines · 14 tokens per session scan A 2f6daf9d6bc3

Subscribe to this mod's changes

analyze-db-performance is a skill published in the GitHub repository sgaunet/claude-plugins (16 stars, last pushed 7d ago), licensed MIT. It adds 14 tokens to every session and 1,672 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-25.

Related

Other skills, from other repositories

sql-queries

Generate SQL queries from natural language descriptions. Supports BigQuery, PostgreSQL, MySQL, and other dialects. Reads database schemas from uploaded diagrams or documentation. Use when writing SQL, building data reports, exploring databases, or translating business questions into queries.

phuryn/pm-skills · 55 tokens

cloudflare-hyperdrive

Cloudflare Hyperdrive for Workers-to-database connections with pooling and caching. Use for PostgreSQL/MySQL, Drizzle/Prisma, or encountering pool errors, TLS issues, connection refused.

secondsky/claude-skills · 45 tokens

migration-check

Validate SQL migration safety, ORM-to-migration alignment, or schema drift between the DB and Zod/DTO types. NOT for deployment config (use deployment) or IaC drift (use infrastructure-as-code).

atretyak1985/swarmery · 45 tokens

postgres-operator-best-practices

Run, configure, upgrade and troubleshoot the Zalando postgres-operator (acid.zalan.do postgresql CRs, Spilo, Patroni, WAL-G) on Kubernetes. Core knowledge: the v1.x -> v2.x major upgrade and its three changed defaults that bite silently (kubernetesuseconfigmaps true, spilo-17 -> spilo-18, scram-sha-256 password…

air-gapped/skills · 166 tokens

postgres-operator-cloudnative-pg-migration

Migrate PostgreSQL clusters from the Zalando postgres-operator (acid.zalan.do postgresql CRs, Spilo/Patroni, WAL-G) to CloudNativePG (CNPG) on Kubernetes, incl. fully air-gapped clusters. Core knowledge: the two walls (Spilo↔CNPG glibc/collation divergence that corrupts physically-copied indexes; WAL-G↔Barman archive…

air-gapped/skills · 224 tokens

elasticsearch

Interact with Elasticsearch and Kibana via REST API using curl. Use when querying, indexing, managing indices, checking cluster health, writing aggregations, deploying dashboards, or troubleshooting Elasticsearch. Requires cluster URL and API key. Covers: search (Query DSL), CRUD operations, index management…

NikiforovAll/claude-code-rules · 97 tokens