Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

database-optimization

Skill by rohitg00

Guides query optimization, indexing, and performance tuning for PostgreSQL and MySQL databases. Covers EXPLAIN analysis, index types, N+1 detection, connection pooling, read replicas, and partitioning.

  • Score 71
  • 2.9k stars
  • Apache-2.0
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install database-optimization

Built from the published package, never by AI.

git clone --depth 1 https://github.com/rohitg00/awesome-claude-code-toolkit /tmp/awesome-claude-code-toolkit && mkdir -p ~/.claude/skills && cp -r /tmp/awesome-claude-code-toolkit/skills/database-optimization ~/.claude/skills/database-optimization

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install database-optimization in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

This skill gives an AI assistant a reference for database optimization on PostgreSQL and MySQL. It starts with EXPLAIN ANALYZE to read query plans and then covers index strategies such as B-tree, partial, GIN, GiST and covering indexes. It also covers N+1 query detection, connection pooling, read replica routing, and partitioning.

The guide includes SQL and code examples in Python and JavaScript, along with a query optimization checklist and a list of dangerous patterns to avoid. Advice includes replacing SELECT *, adding LIMIT, batching inserts and updates in groups of 500 to 1000 rows, and using keyset pagination instead of OFFSET. It suits developers who want to diagnose slow queries and tune indexes and connections.

Written from the project's SKILL.md and checked against it.

What it can do

  • EXPLAIN analysisExplains how to run EXPLAIN ANALYZE and which plan metrics to watch.
  • Index strategiesCovers B-tree, partial, GIN, GiST and covering indexes with example SQL.
  • N+1 query detectionShows bad and good code patterns for N+1 queries and how to count queries per request.
  • Connection poolingGives pool sizing guidance and PgBouncer and ProxySQL notes.
  • Read replicasDescribes routing SELECT queries to replicas and writes to the primary, with a SQLAlchemy example.
  • PartitioningShows range and hash partitioning examples for PostgreSQL tables.
  • Query optimization checklistLists ten steps to review slow queries, indexes and batch sizes.
  • Dangerous patternsLists SQL patterns to avoid, such as LIKE with leading wildcards and deep OFFSET pagination.

What you need

  • PostgreSQL or MySQL database

Try asking

  • Run EXPLAIN ANALYZE advice on my slow orders query and explain the plan
  • Suggest a composite index for my users and orders tables
  • Find N+1 queries in my ORM code and show how to eager load them

Good to know

  • Some index types and partitioning examples are PostgreSQL only.
  • Pooling and replica advice is written for specific database setups.

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: skills/database-optimization/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work

Inside the skill

  • SKILL.md5 KB

Alternatives to database-optimization

All alternatives →
hugging-face-datasetssickn33
94

Creates, configures and manages datasets on the Hugging Face Hub, including SQL-based querying and transformation. Built for people who edit dataset content and metadata directly, alongside the HF MCP server.

AAA Skill 50k
db-repairgarrytan
94

Diagnoses and repairs gbrain's Postgres access when a command or MCP result shows a GBRAIN_DB_ACCESS marker, or when the operator reports the brain database is down. It runs the hardcoded gbrain db-repair ladder and verifies the result with a re-probe.

AAA Skill 34k
alloydb-basicsgoogle
94

Manages clusters, instances, and backups for AlloyDB for PostgreSQL. Built for creating, configuring, and administering AlloyDB databases, not general PostgreSQL or Cloud SQL instances.

AAA Skill 26k
clickhouse-logs-queriessupabase
94

Writes, reviews and migrates Supabase logs queries against the ClickHouse logs table served by the logs.all.otel endpoint. Built for developers who write Logs Explorer SQL or convert older BigQuery logs queries.

AAA Skill 116k
fix-slow-queriespaperclipai
94

Diagnoses and fixes slow Paperclip PostgreSQL queries using Cloud and Neon evidence, local benchmarks, regression tests, and a pull request with passing checks. Built for engineers working on Paperclip.

AAA Skill 119k
prisma-8prisma
94

Guides AI assistants through Prisma 8 projects built on @prisma/orm-postgres, @prisma/orm-sqlite, or @prisma/orm-mongo. It covers data contracts, migrations, typed queries and runtime setup for developers on Prisma 8.

AAA Skill 48k

Compare with hugging-face-datasets, db-repair or alloydb-basics

database-optimization: common questions

Does this skill work with MySQL as well as PostgreSQL?

Yes, the source covers both. Several index types, such as partial, GIN and GiST, are labeled PostgreSQL only.

How does the skill help find slow queries?

It explains how to read EXPLAIN ANALYZE output, look for sequential scans and check statistics. It also suggests monitoring the slow query log.

What does it say about read replicas?

It advises routing SELECT queries to replicas and writes to the primary. It warns about replication lag and recommends the primary for reads that must be consistent.

How do I install database-optimization?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is database-optimization free?

The code is published under the Apache-2.0 licence. The service it connects to may have its own pricing.

Is database-optimization safe to use?

It scores 71 of 100. Grades: maintenance D, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to database-optimization?

Similar skills: hugging-face-datasets, db-repair, alloydb-basics, clickhouse-logs-queries.

database-optimization Install

Add to stack

Loading.