Zen-Ai-Pentest: Agent for Claude Code

.opencode/agents/database-optimizer.md

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

A database specialist for designing schemas, improving SQL queries, choosing indexes, and investigating slow PostgreSQL, MySQL, Supabase, and PlanetScale databases.

In plain words
What is it for?
Use it to review schemas, read EXPLAIN ANALYZE query plans, fix N+1 queries, tune connection pools, and plan safer database migrations.
Why use it?
It helps find database bottlenecks and make data access faster and more reliable as an application grows.

Agent for Claude CodeOpenCode

Written for OpenCode and Claude Code: installed under .opencode/, but also a Claude Code subagent (agents/*.md). Also seen: mentions subagents; positional $N argument.

This is SHAdd0WTAka/Zen-Ai-Pentest's own configuration. It tells Claude Code and OpenCode how to work on Zen-Ai-Pentest itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything Zen-Ai-Pentest configures →

Reuse

Borrowing it

Nothing to install: this file belongs to SHAdd0WTAka/Zen-Ai-Pentest. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/SHAdd0WTAka/Zen-Ai-Pentest/main/.opencode/agents/database-optimizer.md
Clone the repo
git clone --depth 1 https://github.com/SHAdd0WTAka/Zen-Ai-Pentest

Made for: Claude Code, OpenCode.

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/github.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/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 Database Optimizer

Your own site · 80×15
<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="Reviewed on agentmods" width="80" 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. 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.00038 $0.01306
Opus 5.5 $0.00015 $0.00522
Sonnet 5.5 $0.00008 $0.00261
Haiku 4.5 $0.00004 $0.00131

Measured 1mo ago against content hash 337bb87c835b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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.

Origin

Copies of this mod

2 near-identical copies found in the catalogue:

.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. 1mo ago 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 (475 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.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

schema-checker

Valida FKs/colunas/tabelas referenciadas em migration SQL antes de aplicar em prod — devolve veredito GO/NO-GO/NEEDS-REVIEW. Use antes de rodar supabase db push ou applymigration.

luanpdd/kit-mcp · 57 tokens

supabase-substrate-explorer

Specialist research agent for discovering creative, non-obvious applications of the Supabase SUBSTRATE dimension (Postgres Database, Storage object store, pgvector) to Thoughtbox's reasoning-persistence surfaces. Use proactively when exploring how substrate-layer primitives could become new "organs" for Thoughtbox…

Kastalien-Research/thoughtbox · 117 tokens

doctor-strange

Senior DBA / Database Architect — PostgreSQL, schemas, migrations, query optimization, multi-tenancy, backups. Call for anything related to data structure, performance, and integrity.

CohesiumAI/assemble · 39 tokens

pgvector-advanced

Expert in advanced pgvector v0.8.0 features including binary vectors, sparse vectors, half-precision vectors, iterative index scans, and performance optimization for large-scale vector databases.

Matt-Dionis/claude-code-configs · 42 tokens

postgres-expert

Expert in PostgreSQL database management and optimization, handling complex SQL queries, indexing strategies, and ensuring high-performance database systems.

0xfurai/claude-code-subagents · 28 tokens

sql-pro

Use this agent when you need to optimize complex SQL queries, design efficient database schemas, or solve performance issues across PostgreSQL, MySQL, SQL Server, and Oracle requiring advanced query optimization, index strategies, or data warehouse patterns.

alexmmatos/essentials-claude-code · 49 tokens