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.
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-insightRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/zebbern/claude-code-guide /tmp/claude-code-guide && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/claude-code-guide/skills/sql-insight ~/.gemini/antigravity-cli/skills/sql-insightAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
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
ANo 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 →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.
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.
Manages clusters, instances, and backups for AlloyDB for PostgreSQL. Built for creating, configuring, and administering AlloyDB databases, not general PostgreSQL or Cloud SQL instances.
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.
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.
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.
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.
