sql-database-assistant
Review SQL queries for index and scan problems, document schemas from DDL, and generate migrations with rollback and destructive-change flags
Install / Use
npx skills add borghei/Claude-Skills --skill sql-database-assistantInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
Data & AnalyticsSupported Platforms
Our assessment of sql-database-assistant
sql-database-assistant scores 86/100 on our quality scale, 441st of 608 Data & Analytics skills we index.
Its SKILL.md is 5.7 KB long, well organised into 25 sections with 2 code examples: a solid amount of guidance for an agent.
It has 817 GitHub stars, a meaningful sign that others use it.
Maintenance, license and trust
- The repository was last updated about 2 months ago, so sql-database-assistant is actively maintained.
- Our last check on 2026-11-03 found the source still online.
- No license is declared. By default that means all rights are reserved: you can read it, but reusing or redistributing it is not clearly permitted. Ask the author before building on it commercially.
- Its trust signals score 88/100, with 1 caution from licensing, adoption, age or documentation. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful.
AI review by kimi-k2.7-code on 2026-10-07. Automated pattern scan on 2026-10-07. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.
sql-database-assistant compared with similar skills
All 4 of these similar skills score higher than sql-database-assistant; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| sql-database-assistant (this skill)by borghei | 86 | 817 | 57d ago | SKILL.md |
| claude-memby thedotmack | 100 | 117.9k | today | CLAUDE.md |
| Claude-Code-Game-Studiosby Donchitos | 100 | 39.9k | 8d ago | CLAUDE.md |
| x402by browser-use | 100 | 121.0k | 4d ago | SKILL.md |
| algorithmic-artby anthropics | 100 | 177.9k | 56d ago | SKILL.md |
Frequently asked questions
- How do I install sql-database-assistant?
- Run
npx skills add borghei/Claude-Skills --skill sql-database-assistant. The install tabs above show the steps for each supported agent. - Which AI agents does sql-database-assistant work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is sql-database-assistant safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful. It declares no license and scores 88/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is sql-database-assistant still maintained?
- The repository was last updated about 2 months ago, so sql-database-assistant is actively maintained.
Skill content
View source on GitHubname: sql-database-assistant description: > This skill should be used when the user asks to "optimize SQL queries", "explore database schemas", "generate migration SQL", "analyze query performance", or "document database structure". license: MIT + Commons Clause metadata: version: 1.0.0 author: borghei category: engineering domain: databases updated: 2026-04-02 tags: [sql, database, optimization, migration, schema]
SQL Database Assistant
Category: Engineering Domain: Database Development & Optimization
Overview
The SQL Database Assistant skill provides tools for analyzing SQL query performance, exploring database schemas from DDL files, and generating migration SQL from schema differences. It helps teams write efficient queries, maintain clean schemas, and manage database evolution safely.
Clarify First
Before analyzing or generating, confirm these inputs. If any is unknown or vague, ASK — do not assume:
- [ ] Task — query optimization / schema documentation / migration generation (selects the script)
- [ ] SQL input — the query, the DDL file, or the from/to schema pair to operate on (the script's actual input)
- [ ] Target database / dialect — Postgres / MySQL / etc. (changes index recommendations and migration SQL syntax)
Stop rule: ask only the 2-3 that most change the output. If the user says "just draft it," proceed and list your assumptions at the top of the artifact.
Quick Start
# Analyze a SQL query for performance issues
python scripts/query_optimizer.py --file slow_query.sql
# Analyze inline SQL
python scripts/query_optimizer.py --query "SELECT * FROM users WHERE name LIKE '%john%'"
# Explore schema from DDL file
python scripts/schema_explorer.py --file schema.sql
# Generate migration from schema diff
python scripts/migration_generator.py --from old_schema.sql --to new_schema.sql
# JSON output
python scripts/query_optimizer.py --file query.sql --format json
Tools Overview
query_optimizer.py
Analyzes SQL queries for performance issues and optimization opportunities.
| Feature | Description | |---------|-------------| | SELECT * detection | Flags queries selecting all columns | | Missing index hints | Identifies WHERE/JOIN columns likely needing indexes | | N+1 detection | Flags correlated subquery patterns | | Full table scan | Detects queries without WHERE clauses on large tables | | JOIN analysis | Checks join conditions and types | | LIKE optimization | Flags leading wildcard LIKE patterns |
schema_explorer.py
Generates documentation from SQL DDL (CREATE TABLE) files.
| Feature | Description | |---------|-------------| | Table catalog | Lists all tables with column counts | | Column details | Documents types, nullability, defaults | | Index listing | Catalogs indexes and their columns | | Relationship mapping | Identifies foreign key relationships | | Markdown output | Generates schema documentation |
migration_generator.py
Generates migration SQL by comparing two schema DDL files.
| Feature | Description | |---------|-------------| | Column additions | ALTER TABLE ADD COLUMN for new columns | | Column removals | ALTER TABLE DROP COLUMN for removed columns | | Type changes | ALTER TABLE ALTER COLUMN for type modifications | | New tables | CREATE TABLE for entirely new tables | | Dropped tables | DROP TABLE for removed tables | | Index changes | CREATE/DROP INDEX for index differences |
Workflows
Query Optimization Workflow
- Identify slow queries - Collect queries from slow query log
- Analyze - Run query_optimizer.py on each query
- Review findings - Prioritize by estimated impact
- Optimize - Apply suggested improvements
- Verify - Re-analyze to confirm optimization
Schema Documentation Workflow
- Export DDL - Dump schema from database
- Explore - Run schema_explorer.py to generate docs
- Review - Check relationships and data types
- Publish - Include in project documentation
Migration Workflow
- Capture current - Export current schema DDL
- Define target - Write desired schema DDL
- Generate migration - Run migration_generator.py
- Review SQL - Check generated migration for safety
- Test - Apply to staging database first
- Deploy - Apply to production with rollback plan
CI Integration
# Lint SQL queries
python scripts/query_optimizer.py --file queries/ --format json --strict
# Generate schema docs
python scripts/schema_explorer.py --file schema.sql --format markdown > SCHEMA.md
Reference Documentation
- SQL Optimization - Index strategies, query patterns, anti-patterns
Common Patterns Quick Reference
Query Anti-Patterns
| Pattern | Issue | Fix |
|---------|-------|-----|
| SELECT * | Fetches unnecessary data | List specific columns |
| LIKE '%term%' | Cannot use index | Use full-text search |
| Correlated subquery | N+1 query pattern | Rewrite as JOIN |
| No WHERE clause | Full table scan | Add filtering conditions |
| OR in WHERE | Poor index usage | Use UNION or IN |
| Functions on indexed columns | Prevents index use | Apply to value side |
Index Guidelines
| Query Pattern | Index Type |
|--------------|------------|
| WHERE col = value | B-tree on col |
| WHERE col1 = v AND col2 = v | Composite (col1, col2) |
| ORDER BY col | B-tree on col |
| WHERE col LIKE 'prefix%' | B-tree on col |
| WHERE col IN (...) | B-tree on col |
| Full-text search | Full-text index |
Migration Safety
- Always generate rollback SQL alongside forward migration
- Test migrations against a copy of production data
- Add columns as nullable first, then backfill, then add constraints
- Never rename columns directly; add new, migrate data, drop old
Related Skills
claude-mem
117.9kPersistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
Claude-Code-Game-Studios
39.9kTurn Claude Code into a full game dev studio — 49 AI agents, 75 workflow skills, and a complete coordination system mirroring real studio hierarchy.
x402
121.0kSet up Browser Use Cloud payments with x402 — pay per request from a crypto wallet (USDC on Base mainnet), no signup or API key.
algorithmic-art
177.9kCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
