supabase-query-performance-tuner

supabase-query-performance-tuner is an agent for Claude Code from luanpdd/kit-mcp. It costs 59 tokens per session (4,923 once invoked), scanned A, original, MIT.

A Supabase and PostgreSQL assistant for finding why database queries are slow. It examines query plans, database activity, and performance advice, then prepares an audit and index migration.

In plain words
What is it for?
It audits frequently used queries with PostgreSQL’s execution analysis, identifies common performance problems, and writes a scored report plus concurrent index-creation migration.
Why use it?
It helps detect full-table scans, missing indexes, and N+1 queries before growing data causes higher latency or database load.

Agent for Claude Code

Written for Claude Code: a Claude Code subagent (agents/*.md). Also seen: positional $N argument; mentions Claude Code; mentions Codex.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is fora do escopo deste agent. Invocar [`multi-tenant-isolation-auditor`](../agents/multi-tenant-isolation-auditor.md):.

Good fit It audits frequently used queries with PostgreSQL’s execution analysis, identifies common performance…

Compare 6 agents from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/luanpdd/kit-mcp
agentmods
npx agentmods add agents/luanpdd/kit-mcp/supabase-query-performance-tuner

Made for: Claude Code.

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 supabase-query-performance-tuner

README.md
[![agentmods](https://agentmods.dev/badge/agents/luanpdd/kit-mcp/supabase-query-performance-tuner.svg)](https://agentmods.dev/agents/luanpdd/kit-mcp/supabase-query-performance-tuner)
Your own site
<a href="https://agentmods.dev/agents/luanpdd/kit-mcp/supabase-query-performance-tuner"><img src="https://agentmods.dev/badge/agents/luanpdd/kit-mcp/supabase-query-performance-tuner.svg" alt="Measured on agentmods" height="20"></a>
Per session 59 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 4,923 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.00059 $0.04923
Opus 5 $0.00030 $0.02462
Sonnet 5 $0.00012 $0.00985
Haiku 4.5 $0.00006 $0.00492

Measured 3d ago against content hash a870ce2813e5, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

supabase-query-performance-tuner 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 3d 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.

kit/agents/supabase-query-performance-tuner.md · 336 lines

How it starts

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

Você é o supabase-query-performance-tuner — agent da Suíte Supabase. Audita performance de queries em Postgres/Supabase consultando pg_stat_statements e mcp__supabase__get_advisors(type=performance), roda EXPLAIN (ANALYZE, BUFFERS) nas queries mais quentes, detecta os 3 anti-patterns canônicos (sequential scans em tabela grande, índices faltantes em colunas de filtro/JOIN, N+1) e produz dois artefatos: (1) PERF-AUDIT.md scored P0/P1/P2 e (2) uma migration de indexes PRONTA com CREATE INDEX CONCURRENTLY. A knowledge-base é a skill multi-tenant-performance-scaling — você aplica as regras dela, não as reescreve.

Compat: Full em Claude Code + Cursor (precisa de Supabase MCP). Partial em Codex + Gemini CLI; Offline-only fallback usa apenas heurísticas estáticas (greps em supabase/migrations/). Veja COMPATIBILITY.md.

Por que existe

Query lenta em Supabase é silenciosa até virar incident: o plano degrada de index scan para seq scan quando a tabela cresce, um JOIN sem índice escala O(n×m), e um loop de N requests vira N+1 que estoura o connection pool. Sem auditoria ativa, o operador só descobre quando a fatura de Compute sobe ou o P99 dispara. Este agent automatiza a detecção:

  1. Seq scan em tabela grande — RLS/filtro força full scan porque a coluna não tem índice; custo cresce linear com n_live_tup.
  2. Índice faltante em coluna de filtro/JOINWHERE/ON em coluna sem índice → seq scan; partial index em hot path (skill REGRA #3) reduz tamanho 10×.
  3. N+1 — mesma query parametrizada chamada milhares de vezes (calls alto + query idêntico módulo o literal) — sintoma de loop no app que deveria ser 1 query com IN/JOIN.

O agent não corrige RLS: a checagem de helper VOLATILE (deve ser STABLE, skill REGRA #2) e de partial-index em policy é delegada ao multi-tenant-isolation-auditor — ele é a fonte de verdade de gaps de isolamento/RLS. Aqui o foco é o plano de execução e os índices que faltam.

Read the full file on GitHub · 336 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. 3d ago First seen · 336 lines · 59 tokens per session scan A a870ce2813e5

Subscribe to this mod's changes

supabase-query-performance-tuner is an agent published in the GitHub repository luanpdd/kit-mcp (1 stars, last pushed 6d ago), licensed MIT. It adds 59 tokens to every session and 4,923 once invoked, about $0.0003 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

PostgreSQL Database Administrator

Work with PostgreSQL databases using the PostgreSQL extension.

github/awesome-copilot · 17 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

database-reviewer

PostgreSQL specialist for query performance, schema design, security/RLS, and migration safety. Use PROACTIVELY when writing SQL, creating migrations, designing schemas, or troubleshooting database performance.

sjarmak/coding-agent-workflows · 43 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

dba

A read-only database expert for SQL Server, SQLite, and PostgreSQL, with guidance on table design, SQL differences, migrations, indexes, and query performance.

SatoruoGojoo/octopus · 70 tokens

neon-drizzle-expert

Expert in Neon PostgreSQL (v17), Drizzle ORM (v0.44.4), and Zod (v4.0.17) schema validation for production memory systems. Specializes in serverless PostgreSQL patterns with @neondatabase/serverless (v1.0.1), type-safe database operations, and migration strategies.

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