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

sql-insight

Skill by zebbern

Translates natural language into SQL and checks queries for slow patterns. It also interprets EXPLAIN plans for SQLite and PostgreSQL. It is aimed at people who write or tune queries against those databases.

  • Score 91
  • 4.7k stars
  • MIT
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install sql-insight

Built from the published package, never by AI.

git clone --depth 1 https://github.com/zebbern/claude-code-guide /tmp/claude-code-guide && mkdir -p ~/.claude/skills && cp -r /tmp/claude-code-guide/skills/sql-insight ~/.claude/skills/sql-insight

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

Step-by-step: install sql-insight in Claude Code

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

About

sql-insight is an agent skill that helps an AI assistant work with SQLite and PostgreSQL databases. It extracts table structure, including columns, types, indexes, foreign keys and optional sample rows, to give the assistant context for turning questions into SQL. A rule-based optimize command checks a query against 13 anti-patterns, such as SELECT *, leading wildcard LIKE and functions on columns in WHERE. It needs no database connection.

The explain command runs EXPLAIN on a query and flags issues such as full table scans, auto temporary indexes and disk sorts. For PostgreSQL it also supports EXPLAIN ANALYZE. The skill runs as a Python script and is aimed at developers and analysts who write, review or tune SQL queries.

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

What it can do

  • Schema extractionExtracts table columns, types, indexes, foreign keys and sample rows for context.
  • Natural language to SQLTranslates natural language requests into SQL using the extracted schema as context.
  • Query optimization analysisDetects SQL anti-patterns using 13 rules and suggests improvements without a database connection.
  • EXPLAIN interpretationRuns EXPLAIN and interprets the plan, including full table scans and missing indexes.

What you need

  • Python 3.8 or later
  • psycopg2-binary for PostgreSQL support
  • A SQLite database file or a PostgreSQL connection string

Try asking

  • Turn this question into SQL using the schema in my SQLite file data.db.
  • Check this query for optimization issues: SELECT * FROM orders o, users u WHERE o.user_id = u.id
  • Explain the execution plan for this PostgreSQL query and flag any full table scans.

Good to know

  • Only SELECT, WITH and EXPLAIN statements are allowed.
  • Connections are read-only: SQLite uses mode=ro and PostgreSQL uses SET SESSION READ ONLY.
  • EXPLAIN ANALYZE is PostgreSQL only and actually executes the query.
  • Supports SQLite and PostgreSQL only.

Security check

A

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

Checked automatically: skills/sql-insight/SKILL.md, skills/sql-insight/scripts/sql_query_helper.py. This looks for known risky patterns and is not a full audit. How grades work

Inside the skill

  • LICENSE1 KB
  • SKILL.md8 KB
  • scripts/sql_query_helper.py33 KB

Alternatives to sql-insight

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

sql-insight: common questions

Does sql-insight modify my database?

No. The source says connections are read-only, and statements such as INSERT, UPDATE, DELETE and DROP are blocked. Multi-statement SQL is also rejected.

Do I need a database connection to check a query?

No. The optimize command uses pure rule-based detection and has no external dependencies. Only schema and explain need a database.

Which databases are supported?

The source lists SQLite and PostgreSQL. SQLite uses a file path and PostgreSQL uses a DSN connection string.

How do I install sql-insight?

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

Is sql-insight free?

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

Is sql-insight safe to use?

It scores 91 of 100. Grades: maintenance A, 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 sql-insight?

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

sql-insight Install

Add to stack

Loading.