Skip to main content
command

supabase-performance-optimizer — Claude Code command: what it does

A Claude slash command that inspects a Supabase database for slow queries and wasted indexes, then hands back an optimization plan.

Install into Claude Code · claude-code-templates All methods and platforms ↓
npx claude-code-templates@latest --command database/supabase-performance-optimizer
Open on GitHub

What supabase-performance-optimizer does

Run the command with a focus flag — --queries, --indexes, --storage, --rls or --functions — and it works through that area only. Leave the argument off and it walks the whole list.

The framework has six stages: query execution analysis, index review, application query cleanup, storage strategy, Row Level Security policy check, and database function tuning. It also scans your project for SQL, TypeScript and JavaScript files that touch the database, so the review is based on your actual query patterns rather than a generic checklist. Supabase metrics arrive through an MCP integration, which you need to set up first; without it the performance data side is thin.

You get back a plan covering index recommendations, query rewrites and monitoring setup. The command can write and edit files, so some changes land on disk directly. Worth reading the diff before you commit, especially in a project that already manages its own migrations.

What it helps with

  • track down slow queries in a Supabase database
  • drop redundant indexes
  • read the execution plan for a heavy query
  • simplify Row Level Security policies
  • decide which tables to archive

Example prompts for the agent

  • /supabase-performance-optimizer --queries
  • /supabase-performance-optimizer --indexes
  • /supabase-performance-optimizer --rls

How to install supabase-performance-optimizer

1claude-code-templates

npx claude-code-templates@latest --command database/supabase-performance-optimizer

2Manually: put the files in place

.claude/commands/supabase-performance-optimizer.md

Call it with /supabase-performance-optimizer. For all projects use ~/.claude/commands/

Questions about supabase-performance-optimizer

How do I install supabase-performance-optimizer in Claude?

Use the templates CLI: npx claude-code-templates@latest --command database/supabase-performance-optimizer. The command file lands at .claude/commands/supabase-performance-optimizer.md.

What does supabase-performance-optimizer do?

It analyzes Supabase database performance and returns an optimization plan covering indexes, queries, storage, RLS policies and functions. A flag narrows it to one area.

What does the command need to run?

A configured MCP integration with Supabase, since that is where the performance metrics come from. It also reads your project files to find the queries in use.

Source text

supabase-performance-optimizer.md · MIT
---
allowed-tools: Read, Write, Edit, Bash
argument-hint: "[optimization-type] | --queries | --indexes | --storage | --rls | --functions"
description: Optimize Supabase database performance with intelligent analysis and recommendations
---

# Supabase Performance Optimizer

Optimize Supabase database performance with intelligent analysis and automated improvements: **$ARGUMENTS**

## Current Performance Context

- Supabase metrics: Database performance data via MCP integration
- Query patterns: !`find . -name "*.sql" -o -name "*.ts" -o -name "*.js" | xargs grep -l "from\|select\|insert\|update" 2>/dev/null | head -5` application queries
- Schema analysis: Current table structures and relationship complexity
- Performance logs: Recent query execution times and resource usage patterns

## Task

Execute comprehensive performance optimization with intelligent analysis and automated improvements:

**Optimization Focus**: Use $ARGUMENTS to focus on query optimization, index management, storage optimization, RLS policies, or database functions

**Performance Optimization Framework**:
1. **Performance Analysis** - Analyze query execution times, identify slow operations, assess resource utilization, evaluate bottlenecks
2. **Index Optimization** - Analyze index usage, recommend new indexes, identify redundant indexes, optimize index strategies
3. **Query Optimization** - Review application queries, suggest query improvements, implement query caching, optimize join operations
4. **Storage Optimization** - Analyze storage patterns, recommend archival strategies, optimize data types, implement compression
5. **RLS Policy Review** - Analyze Row Level Security policies, optimize policy performance, reduce policy complexity, improve security efficiency
6. **Function Optimization** - Review database functions, optimize function performance, implement caching strategies, improve execution plans

**Advanced Features**: Automated index recommendations, query plan analysis, performance trend monitoring, cost optimization, scaling recommendations.

**Monitoring Integration**: Real-time performance tracking, alert configuration, performance regression detection, optimization impact measurement.

**Output**: Comprehensive optimization plan with performance improvements, index recommendations, query optimizations, and monitoring setup.

© davila7 · MIT · davila7/claude-code-templates

Similar slash commands

All slash commands for Data and databases →

From the same set205

The whole set →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor