sql-database-assistant
यह क्या करती है
यह स्किल डेटाबेस क्वेरी और स्कीमा बदलाव लिखने और सुधारने में मदद करती है। यह उन डेवलपर्स और विश्लेषकों के लिए है जो रोज़ SQL डेटाबेस के साथ काम करते हैं।
कब इस्तेमाल करें
- ✓जब आपको सादे वर्णन से SQL क्वेरी लिखनी हो।
- ✓जब कोई क्वेरी धीमी हो और आप जानना चाहें कि क्यों और उसे कैसे तेज़ करें।
- ✓जब आपके डेटाबेस बदलाव के लिए माइग्रेशन स्क्रिप्ट चाहिए।
Skill का लिंक
https://github.com/alirezarezvani/claude-skills/blob/main/engineering/skills/sql-database-assistant/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“एक SQL क्वेरी लिखिए जो पिछले महीने हर ग्राहक की कुल बिक्री दिखाए, और उसे तेज़ बनाइए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
यह आपके अनुरोध को क्वेरी में बदलती है, मौजूदा क्वेरी में धीमे पैटर्न जाँचती है और indexes सुझाती है, और रोलबैक कदमों वाली माइग्रेशन फ़ाइलें बना सकती है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
SQL Database Assistant - POWERFUL Tier Skill
Overview
The operational companion to database design. While database-designer focuses on schema architecture and database-schema-designer handles ERD modeling, this skill covers the day-to-day: writing queries, optimizing performance, generating migrations, and bridging the gap between application code and database engines.
Core Capabilities
- Natural Language to SQL — translate requirements into correct, performant queries
- Schema Exploration — introspect live databases across PostgreSQL, MySQL, SQLite, SQL Server
- Query Optimization — EXPLAIN analysis, index recommendations, N+1 detection, rewrite patterns
- Migration Generation — up/down scripts, zero-downtime strategies, rollback plans
- ORM Integration — Prisma, Drizzle, TypeORM, SQLAlchemy patterns and escape hatches
- Multi-Database Support — dialect-aware SQL with compatibility guidance
Tools
| Script | Purpose |
|---|---|
scripts/query_optimizer.py |
Static analysis of SQL queries for performance issues |
scripts/migration_generator.py |
Generate migration file templates from change descriptions |
scripts/schema_explorer.py |
Generate schema documentation from introspection queries |
Natural Language to SQL
Translation Patterns
When converting requirements to SQL, follow this sequence:
- Identify entities — map nouns to tables
- Identify relationships — map verbs to JOINs or subqueries
- Identify filters — map adjectives/conditions to WHERE clauses
- Identify aggregations — map "total", "average", "count" to GROUP BY
- Identify ordering — map "top", "latest", "highest" to ORDER BY + LIMIT
Common Query Templates
Top-N per group (window function)
SELECT * FROM (
SELECT *, ROW_NUMBER() OVER (PARTITION BY department_id ORDER BY salary DESC) AS rn
FROM employees
) ranked WHERE rn <= 3;
Running totals
SELECT date, amount,
SUM(amount) OVER (ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS running_total
FROM transactions;
Gap detection
SELECT curr.id, curr.seq_num, prev.seq_num AS prev_seq
FROM records curr
LEFT JOIN records prev ON prev.seq_num = curr.seq_num - 1
WHERE prev.id IS NULL AND curr.seq_num > 1;
UPSERT (PostgreSQL)
INSERT INTO settings (key, value, updated_at)
VALUES ('theme', 'dark', NOW())
ON CONFLICT (key) DO UPDATE SET value = EXCLUDED.value, updated_at = EXCLUDED.updated_at;
UPSERT (MySQL)
INSERT INTO settings (key_name, value, updated_at)
VALUES ('theme', 'dark', NOW())
ON DUPLICATE KEY UPDATE value = VALUES(value), updated_at = VALUES(updated_at);
See references/query_patterns.md for JOINs, CTEs, window functions, JSON operations, and more.
Schema Exploration
Introspection Queries
PostgreSQL — list tables and columns
SELECT table_name, column_name, data_type, is_nullable, column_default
FROM information_schema.columns
WHERE table_schema = 'public'
ORDER BY table_name, ordinal_position;
PostgreSQL — foreign keys
SELECT tc.table_name, kcu.column_name,
ccu.table_name AS foreign_table, ccu.column_name AS foreign_column
FROM information_schema.table_constraints tc
JOIN information_schema.key_column_usage kcu ON tc.constraint_name = kcu.constraint_name
JOIN information_schema.constraint_column_usage ccu ON tc.constraint_name = ccu.constraint_name
WHERE tc.constraint_type = 'FOREIGN KEY';
MySQL — table sizes
SELECT table_name, table_rows,
ROUND(data_length / 1024 / 1024, 2) AS data_mb,
ROUND(index_length / 1024 / 1024, 2) AS index_mb
FROM information_schema.tables
WHERE table_schema = DATABASE()
ORDER BY data_length DESC;
SQLite — schema dump
SELECT name, sql FROM sqlite_master WHERE type = 'table' ORDER BY name;
SQL Server — columns with types
SELECT t.name AS table_name, c.name AS column_name,
ty.name AS data_type, c.max_length, c.is_nullable
FROM sys.columns c
JOIN sys.tables t ON c.object_id = t.object_id
JOIN sys.types ty ON c.user_type_id = ty.user_type_id
ORDER BY t.name, c.column_id;
Generating Documentation from Schema
Use scripts/schema_explorer.py to produce markdown or JSON documentation:
python scripts/schema_explorer.py --dialect postgres --tables all --format md
python scripts/schema_explorer.py --dialect mysql --tables users,orders --format json --json
अक्सर पूछे जाने वाले सवाल
यह कौन से डेटाबेस सपोर्ट करती है?
PostgreSQL, MySQL, SQLite और SQL Server।
क्या यह ORM टूल के साथ काम करती है?
हाँ, यह Prisma, Drizzle, TypeORM और SQLAlchemy के पैटर्न कवर करती है।
क्या यह मेरे लाइव डेटाबेस को देख सकती है?
यह introspection क्वेरी से स्कीमा खंगाल सकती है और उससे दस्तावेज़ बना सकती है।
जानकारी
लेखक का मूल विवरण
Use for writing or optimizing SQL, exploring a schema, generating migrations or working with Prisma, Drizzle, TypeORM or SQLAlchemy. Analyzes queries with query_optimizer.py and schemas with schema_explorer.py.
लोकप्रियता
- GitHub स्टार
- 29k
- रैंकिंग में स्थान
- #9606
- लाइसेंस
- MIT
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
agent-launcher-orchestrator
29kआपके एजेंट को एक साफ़ लक्ष्य से शुरू करके, अपने खाते में Claude मैनेज्ड एजेंट की योजना बनाने, बनाने, जांचने और शेड्यूल करने में चरण-दर-चरण मदद करती है।
grade-iterate
29kआपके एजेंट को किसी मैनेज्ड AI एजेंट के काम को रूब्रिक से आंकने और तय संख्या के दौरों में सुधारने देती है, ताकि वह कभी अनंत चक्र में न फंसे।
interview
29kआपके एजेंट को AI एजेंट के विचार पर आपसे इंटरव्यू लेने और कुछ भी लॉन्च होने से पहले आपके जवाबों को सरल निर्माण योजना में बदलने देती है।
run-without-you
29kआपके एजेंट को मैनेज्ड AI एजेंट शेड्यूल पर या किसी घटना पर चलाने में मदद करती है, लॉन्च से पहले cron समय की जांच के साथ।
मिलती-जुलती skills
discrawl
394kयह आपके एजेंट को Discord संदेशों के सेव किए गए स्थानीय आर्काइव में खोजने, उसका सारांश बनाने और उसकी ताज़गी जांचने में मदद करती है।
clickhouse-io
280kआपके एजेंट को ClickHouse databases में queries और schemas optimize करने में मदद करता है। high-performance analytical workloads के लिए best practices लागू करता है। जब analytical queries बहुत धीमी हों, तब इसका उपयोग करें।
scientific-db-pubmed-database
280kआपके एजेंट को बायोमेडिकल क्षेत्र के वैज्ञानिक लेख खोजने में मदद करता है। जिस रिसर्च में खास मेडिकल जानकारी चाहिए, उसके लिए यह काम का है।