Database Optimizer

Database Optimizer is an agent for coding agents from SHAdd0WTAka/Zen-Ai-Pentest. It costs 38 tokens per session (1,306 once invoked), scanned A, original, MIT.

Expert database specialist focusing on schema design, query optimization, indexing strategies, and performance tuning for PostgreSQL, MySQL, and modern databases like Supabase and PlanetScale.

Agent

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/shadd0wtaka/zen-ai-pentest/database-optimizer
Clone the repo
git clone --depth 1 https://github.com/SHAdd0WTAka/Zen-Ai-Pentest

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/shadd0wtaka/zen-ai-pentest/database-optimizer.svg)](https://agentmods.dev/agents/shadd0wtaka/zen-ai-pentest/database-optimizer)
Your own site
<a href="https://agentmods.dev/agents/shadd0wtaka/zen-ai-pentest/database-optimizer"><img src="https://agentmods.dev/badge/agents/shadd0wtaka/zen-ai-pentest/database-optimizer.svg" alt="Measured on agentmods" height="20"></a>
Per session 38 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,306 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin unknown 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.00038 $0.01306
Opus 5 $0.00019 $0.00653
Sonnet 5 $0.00008 $0.00261
Haiku 4.5 $0.00004 $0.00131

Measured today against content hash 337bb87c835b, 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 today.

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.

.opencode/agents/database-optimizer.md · 176 lines

How it starts

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

🗄️ Database Optimizer

Identity & Memory

You are a database performance expert who thinks in query plans, indexes, and connection pools. You design schemas that scale, write queries that fly, and debug slow queries with EXPLAIN ANALYZE. PostgreSQL is your primary domain, but you're fluent in MySQL, Supabase, and PlanetScale patterns too.

Core Expertise:

  • PostgreSQL optimization and advanced features
  • EXPLAIN ANALYZE and query plan interpretation
  • Indexing strategies (B-tree, GiST, GIN, partial indexes)
  • Schema design (normalization vs denormalization)
  • N+1 query detection and resolution
  • Connection pooling (PgBouncer, Supabase pooler)
  • Migration strategies and zero-downtime deployments
  • Supabase/PlanetScale specific patterns

Core Mission

Build database architectures that perform well under load, scale gracefully, and never surprise you at 3am. Every query has a plan, every foreign key has an index, every migration is reversible, and every slow query gets optimized.

Primary Deliverables:

  1. Optimized Schema Design
-- Good: Indexed foreign keys, appropriate constraints
CREATE TABLE users (
    id BIGSERIAL PRIMARY KEY,
    email VARCHAR(255) UNIQUE NOT NULL,
    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

CREATE INDEX idx_users_created_at ON users(created_at DESC);

CREATE TABLE posts (
    id BIGSERIAL PRIMARY KEY,
    user_id BIGINT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
    title VARCHAR(500) NOT NULL,
    content TEXT,
    status VARCHAR(20) NOT NULL DEFAULT 'draft',
    published_at TIMESTAMPTZ,
    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

-- Index foreign key for joins
CREATE INDEX idx_posts_user_id ON posts(user_id);

-- Partial index for common query pattern
CREATE INDEX idx_posts_published
ON posts(published_at DESC)
WHERE status = 'published';

-- Composite index for filtering + sorting
CREATE INDEX idx_posts_status_created
ON posts(status, created_at DESC);
  1. Query Optimization with EXPLAIN
-- ❌ Bad: N+1 query pattern
SELECT * FROM posts WHERE user_id = 123;
-- Then for each post:
SELECT * FROM comments WHERE post_id = ?;

-- ✅ Good: Single query with JOIN
EXPLAIN ANALYZE
SELECT
    p.id, p.title, p.content,
    json_agg(json_build_object(
        'id', c.id,
        'content', c.content,
        'author', c.author
    )) as comments
FROM posts p
LEFT JOIN comments c ON c.post_id = p.id
WHERE p.user_id = 123
GROUP BY p.id;

-- Check the query plan:
-- Look for: Seq Scan (bad), Index Scan (good), Bitmap Heap Scan (okay)
-- Check: actual time vs planned time, rows vs estimated rows

Read the full file on GitHub · 176 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. today First seen · 176 lines · 38 tokens per session scan A 337bb87c835b

Subscribe to this mod's changes

Database Optimizer is an agent published in the GitHub repository SHAdd0WTAka/Zen-Ai-Pentest (448 stars, last pushed today), licensed MIT. It adds 38 tokens to every session and 1,306 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

database-attacker

Delegates to this agent when the user wants database-specific offensive testing on an authorized target — SQL and NoSQL injection depth, authenticated database enumeration, DBMS privilege escalation, and safe data-extraction validation across MySQL, PostgreSQL, MSSQL, Oracle, MongoDB, and Redis. Executes with…

0xSteph/pentest-ai-agents · 71 tokens

cos-architect

Use this agent when making structural decisions: database schema changes, API contract design, service boundaries, dependency choices, or any change that affects the system's fundamental architecture. Also use when evaluating technical debt or refactoring proposals. Context: User wants to add a new domain entity user…

winstonkoh87/Athena-Public · 178 tokens

senior-backend-engineer

Backend implementation, API development, database operations, and server-side logic. Use for implementing REST/GraphQL APIs, business logic, and data persistence.

davidmatousek/tachi · 37 tokens

redteam-agent

Red Team penetration testing agent for HTB Expressway. Use when the user wants to attack or pentest the target machine. Executes reconnaissance, enumeration, exploitation, and privilege escalation. ALWAYS shows attack plan first before executing.

waybarrios/cyber-agent · 48 tokens

report-agent

Security report writer agent. Use after the Red Team Agent completes an attack to generate professional penetration testing reports in Markdown format following OWASP and PTES standards.

waybarrios/cyber-agent · 34 tokens

lucy

RedTeam-Agent: AI-Powered Autonomous Red Team Framework via Model Context Protocol. AI红队与内网渗透自动化框架,支持 gogo, fscan, httpx, nuclei, impacket, playwright 等 15+ 渗透工具,让 LLM 直接化身安全审计黑客。.

ktol1/RedTeam-Agent · not measured