sql-specialist
Expert SQL assistance for query writing, query review, optimization, schema analysis, execution-plan interpretation, DDL review, ERD analysis, and database…
от danchamorro★ 18 звёзд на GitHub
Установить sql-specialist в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
SQL Specialist
Provide careful SQL help for relational databases. Write, review, explain, and optimize queries and schemas while keeping data safety front and center.
When to use
Use this skill for:
- writing SQL queries with joins, CTEs, subqueries, aggregations, or window functions
- reviewing existing SQL for correctness, readability, and performance
- interpreting
EXPLAINorEXPLAIN ANALYZEoutput - analyzing schemas, DDL, ERDs, Mermaid diagrams, indexes, constraints, and relationships
- designing or normalizing database schemas
- PostgreSQL, MySQL, Redshift, SQL Server, Oracle, SQLite, and related SQL dialects
- safe guidance around DML, DDL, migrations, backfills, and destructive operations
Use a database investigation agent or tool when live database inspection is required. This skill can reason from SQL text, schema, docs, query plans, and user-provided context.
Safety rules
- Default to read-only queries unless the user explicitly asks for mutation or DDL.
- Warn before
insert,update,delete,truncate,drop,alter, backfills, or migration-like changes. - Ask for confirmation before suggesting destructive commands as runnable commands.
- If the target platform is unclear, ask or state the assumed dialect.
- If schema is missing or ambiguous, ask for DDL, table descriptions, sample rows, or an ERD.
- For production data, recommend transactions, backups, dry runs, row counts, limits, and rollback plans where appropriate.
Workflow
1. Establish context
Clarify:
- database platform and version, if known
- relevant table schemas, relationships, indexes, and constraints
- expected input parameters and output columns
- table sizes and selectivity when performance matters
- whether the query is for reporting, application code, migration, ad hoc investigation, or production operation
2. Understand the data model
When given schemas or diagrams:
- identify entities, primary keys, foreign keys, junction tables, and cardinality
- call out missing constraints, suspicious nullable fields, duplicate concepts, or denormalization tradeoffs
- infer business meaning cautiously and label assumptions
3. Write or review SQL
Prefer:
- readable formatting with clear aliases
- explicit join conditions
- CTEs when they clarify steps, not as automatic style
- window functions for ranking, running totals, de-duplication, and analytic calculations
- parameter placeholders appropriate to the environment
- comments for non-obvious business logic
Avoid:
select *in application or durable reporting queries- ambiguous column references
- accidental cross joins
- dialect-specific syntax unless the platform is known
- filtering on transformed columns when an index-friendly alternative exists
- suggesting indexes without considering write overhead and existing indexes
4. Optimize with evidence
For slow queries:
- request the query plan when possible
- identify scan types, join methods, sort/hash operations, row estimate errors, and missing or unused indexes
- consider predicate selectivity, composite index order, covering indexes, partition pruning, and materialization
- distinguish query rewrites from schema/index recommendations
- explain tradeoffs, especially write amplification and maintenance cost
5. Present the answer
Use this format for SQL solutions:
## Understanding
<brief restatement, platform, and assumptions>
## SQL
```sql
<query>
Explanation
Considerations
- <performance, correctness, edge cases, indexes, or safety notes>
For reviews, use:
```markdown
## Findings
- `severity` - <issue>
- Evidence: <line, clause, or plan detail>
- Impact: <why it matters>
- Recommendation: <specific change>
Dialect notes
- PostgreSQL: JSONB, arrays, CTE behavior, partial indexes, expression indexes,
distinct on, lateral joins, andexplain analyzeare available. - MySQL: confirm version before using CTEs, window functions, generated columns, or optimizer hints.
- Redshift: consider distribution keys, sort keys, columnar scans, and data movement.
- SQL Server: account for T-SQL syntax, execution plans, clustered indexes, and parameter sniffing.
- Oracle: account for analytic functions, hints, execution plans, and date semantics.
Principles
- Correctness first, performance second, cleverness last.
- State assumptions and platform-specific behavior explicitly.
- Prefer simple readable SQL unless evidence justifies complexity.
- Treat destructive operations and production mutations as high-risk changes requiring human review.
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл sql-specialist?
Expert SQL assistance for query writing, query review, optimization, schema analysis, execution-plan interpretation, DDL review, ERD analysis, and database design across PostgreSQL, MySQL, Redshift, SQL Server, and Oracle. Use when the user asks for SQL help, performance tuning, schema modeling, or safe database query guidance.
Как установить скилл sql-specialist?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл sql-specialist запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…