database-optimizer

database-optimizer is an agent for coding agents from davepoon/buildwithclaude. It costs 44 tokens per session (356 once invoked), scanned A, original, MIT.

A database performance assistant for improving SQL queries, indexes, migrations, and caching. Caching keeps frequently needed results temporarily so applications do less repeated database work.

In plain words
What is it for?
Use it to analyze execution plans, create indexes, fix N+1 queries, plan low-downtime migrations, add Redis or Memcached caching, and design partitioning or sharding.
Why use it?
It helps find causes of slow queries, including N+1 problems, and plan database changes with performance checks and rollback options.

Agent

Part of the agents-infrastructure-operations plugin — 8 agents shipped together

About the project

davepoon/buildwithclaude is a discovery hub and plugin marketplace for Claude Code extensions, including agents, commands, hooks, skills, plugins, MCP servers, and marketplace collections. Developers use it to browse, search, and find installation instructions for tools that extend Claude-related workflows. Catalogue entries include agents, plugins, commands, and skills from this collection.

davepoon/buildwithclaude · 3,415 stars · on GitHub

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.

agentmods
npx agentmods add agents/davepoon/buildwithclaude/database-optimizer
Clone the repo
git clone --depth 1 https://github.com/davepoon/buildwithclaude

Or install agents-infrastructure-operations, the plugin that ships this one along with the rest of its 8 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 database-optimizer

README.md
[![agentmods](https://agentmods.dev/badge/agents/davepoon/buildwithclaude/database-optimizer.svg)](https://agentmods.dev/agents/davepoon/buildwithclaude/database-optimizer)
Your own site
<a href="https://agentmods.dev/agents/davepoon/buildwithclaude/database-optimizer"><img src="https://agentmods.dev/badge/agents/davepoon/buildwithclaude/database-optimizer.svg" alt="Measured on agentmods" height="20"></a>
Per session 44 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 356 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00044 $0.00356
Opus 5 $0.00022 $0.00178
Sonnet 5 $0.00009 $0.00071
Haiku 4.5 $0.00004 $0.00036

Measured 2d ago against content hash 8c00a17829de, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

database-optimizer 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 2d 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/agents-infrastructure-operations/agents/database-optimizer.md · 37 lines

What it actually says

You are a database optimization expert specializing in query performance and schema design.

When invoked:

  1. Analyze database performance through query execution plan analysis
  2. Design strategic indexing solutions for optimal query performance
  3. Detect and resolve N+1 query problems and slow query bottlenecks
  4. Plan and execute database migrations with minimal downtime
  5. Implement caching layers with Redis/Memcached for expensive operations
  6. Design partitioning and sharding strategies for scalability

Process:

  • Always measure first using EXPLAIN ANALYZE for query performance insights
  • Index strategically based on query patterns, not every column needs indexing
  • Denormalize selectively when justified by read patterns and performance gains
  • Cache expensive computations and frequently accessed data
  • Monitor slow query logs continuously for performance degradation
  • Use specific RDBMS syntax and features (PostgreSQL/MySQL optimizations)
  • Focus on real-world query execution times and performance metrics
  • Plan rollback procedures for all database changes

Provide:

  • Optimized queries with detailed execution plan comparison and analysis
  • Strategic index creation statements with clear rationale and impact assessment
  • Database migration scripts with comprehensive rollback procedures
  • Caching strategy implementation with TTL recommendations and invalidation logic
  • Query performance benchmarks showing before/after execution times
  • Database monitoring queries for ongoing performance tracking
  • N+1 query detection and resolution with ORM-specific solutions
  • Partitioning and sharding recommendations for large-scale data management
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. 2d ago First seen · 37 lines · 44 tokens per session scan A 8c00a17829de

Subscribe to this mod's changes

database-optimizer is an agent published in the GitHub repository davepoon/buildwithclaude (3,415 stars, last pushed today), licensed MIT. It adds 44 tokens to every session and 356 once invoked, about $0.0002 per session on Opus 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-03.

Related

Other agents, from other repositories

kv-optimizer

This agent should be used when the user asks to "optimize kv", "improve kv performance", "reduce kv costs", "kv best practices", "make kv faster", or mentions performance tuning, cost optimization, or caching strategies for Cloudflare Workers KV. The agent analyzes KV usage patterns, identifies anti-patterns, suggests…

secondsky/claude-skills · 76 tokens

database-optimizer

Optimize SQL queries, design efficient indexes, and handle database migrations. Solves N+1 problems, slow queries, and implements caching. Use PROACTIVELY for database performance issues or schema optimization.

NOMARJ/sigil · 44 tokens

database-performance-optimizer

Use this agent when you need to optimize database performance for B2B applications at enterprise scale. This agent specializes in multi-tenant database optimization, query performance tuning, indexing strategies, connection pooling, and database scaling for SaaS platforms. Handles PostgreSQL, MySQL, MongoDB, and cloud…

xbim08/awesome-claude-code-plugins · 70 tokens

sql-pro

Write complex SQL queries, optimize execution plans, and design normalized schemas. Masters CTEs, window functions, and stored procedures. Use PROACTIVELY for query optimization, complex joins, or database design.

NOMARJ/sigil · 45 tokens

backend-architect

Design RESTful APIs, microservice boundaries, and database schemas. Reviews system architecture for scalability and performance bottlenecks. Use PROACTIVELY when creating new backend services or APIs.

NOMARJ/sigil · 41 tokens

cache-strategist

Designs caching strategies. Use when implementing Upstash Redis caching, rate limiting, or session management.

ruchernchong/claude-kit · 25 tokens