sql-database-assistant
하는 일
이 스킬은 데이터베이스 쿼리와 스키마 변경을 쓰고 개선하도록 돕습니다. 매일 SQL 데이터베이스로 일하는 개발자와 분석가에게 맞습니다.
사용하는 경우
- ✓원하는 내용을 평범한 말로 설명하고 SQL 쿼리가 필요할 때.
- ✓쿼리가 느려서 이유와 개선 방법을 알고 싶을 때.
- ✓데이터베이스 변경을 위한 마이그레이션 스크립트가 필요할 때.
스킬 링크
https://github.com/alirezarezvani/claude-skills/blob/main/engineering/skills/sql-database-assistant/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“지난달 고객별 총매출을 보여 주는 SQL 쿼리를 작성하고, 더 빠르게 만들어 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
스킬은 요청을 쿼리로 바꾸고, 기존 쿼리에서 느린 패턴을 찾아 인덱스를 제안하며, 롤백 단계가 있는 마이그레이션 파일을 만들 수 있습니다.
기술 내용 (원본 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용 패턴을 다룹니다.
실제 데이터베이스를 볼 수 있나요?
내부 구조 조회 쿼리로 스키마를 살펴보고, 그 결과로 문서를 만들 수 있습니다.
상세 정보
작성자의 원본 설명
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
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
agent-launcher-orchestrator
29k하나의 명확한 목표에서 시작해 내 계정의 Claude 관리형 에이전트를 계획하고, 만들고, 테스트하고, 예약하도록 돕습니다.
grade-iterate
29k에이전트가 채점 기준표에 따라 관리형 AI 에이전트의 결과물을 평가하고, 정해진 횟수 안에서 개선하도록 돕습니다. 끝없이 반복하지 않습니다.
interview
29kAI 에이전트 아이디어에 대해 질문하고, 답변을 간단한 빌드 계획으로 바꿔 어떤 것도 출시하기 전에 정리하도록 돕습니다.
run-without-you
29k에이전트가 관리형 AI 에이전트를 예약 또는 이벤트에 따라 실행되도록 설정하고, 출시 전에 cron 시간을 확인하도록 돕습니다.
비슷한 스킬
discrawl
394k에이전트가 저장된 로컬 Discord 메시지 보관본을 검색하고 요약하며, 최신 상태를 확인하고 다이렉트 메시지를 읽도록 돕습니다.
clickhouse-io
280k에이전트가 ClickHouse 데이터베이스의 쿼리와 스키마를 최적화하도록 돕습니다. 고성능 분석 작업의 모범 사례를 적용합니다. 분석 쿼리가 느릴 때 씁니다.
scientific-db-pubmed-database
280k생의학 분야의 과학 논문을 에이전트가 검색하도록 돕습니다. 특정 의학 정보가 필요한 연구에 유용합니다.