SQL

Write SQL queries, optimize database performance, design schemas, and debug SQL issues. Use for database operations, query optimization, and schema design.

9 starsDatabases

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add thechandanbhagat/claude-skills --skill sql
Manual install
git clone --depth 1 https://github.com/thechandanbhagat/claude-skills.git /tmp/claude-skills
mkdir -p ~/.claude/skills
cp -r /tmp/claude-skills/skills/sql ~/.claude/skills/sql

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# SQL Skill

Comprehensive SQL assistance for database operations.

## 1. Query Writing

**Basic Queries:**
```sql
-- SELECT with WHERE
SELECT name, email FROM users WHERE active = true;

-- JOIN operations
SELECT u.name, o.total
FROM users u
INNER JOIN orders o ON u.id = o.user_id;

-- Aggregate functions
SELECT category, COUNT(*), AVG(price)
FROM products
GROUP BY category
HAVING COUNT(*) > 5;

-- Subqueries
SELECT * FROM users
WHERE id IN (SELECT user_id FROM orders WHERE total > 1000);
```

## 2. Query Optimization

**Use EXPLAIN:**
```sql
EXPLAIN ANALYZE
SELECT * FROM users WHERE email = 'test@example.com';

-- Look for:
-- - Sequential scans (add indexes)
-- - High cost values
-- - Nested loops on large tables
```

**Add Indexes:**
```sql
-- Single column index
CREATE INDEX idx_users_email ON users(email);

-- Multi-column index
CREATE INDEX idx_orders_user_date ON orders(user_id, created_at);

-- Unique index
CREATE UNIQUE INDEX idx_users_username ON users(username);

-- Partial index
CREATE INDEX idx_active_users ON users(email) WHERE active = true;
```

## 3. Schema Design

**Tables:**
Read the full skill on GitHub

Details

Skill name
sql
Path
skills/sql/SKILL.md
Repo updated
22 January 2026

FAQ

What does the SQL skill do?

Write SQL queries, optimize database performance, design schemas, and debug SQL issues. Use for database operations, query optimization, and schema design.

How do I install the SQL skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add thechandanbhagat/claude-skills --skill sql. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is SQL popular?

It lives in thechandanbhagat/claude-skills, which has 9 GitHub stars and 0 forks.

Related skills

Code Review

9

thechandanbhagat/claude-skills

Perform automated code reviews with best practices, security checks, and refactoring suggestions. Use when reviewing code, checking for vulnerabilities, or analyzing code quality.

Software Development

CSV

9

thechandanbhagat/claude-skills

Parse, analyze, transform, and manipulate CSV files. Use for data processing, cleaning, and CSV operations.

Data & Analytics

Debug

9

thechandanbhagat/claude-skills

Debug code, analyze errors, interpret stack traces, find root causes, and suggest fixes. Use when troubleshooting bugs, analyzing crashes, or investigating unexpected behavior.

Software Development

Cheat Status

9

miaqu766520-a11y/ai-line-skills

cheat-on-content 的状态看板。显示当前模式 / rubric 版本 / 校准进度 / 待复盘 / pool 状态 / 是否该升级 SQLite / 是否该 bump rubric。**任何时候都可调,无副作用**。触发词:"状态"/"看板"/"status"/"我现在该做什么"/"进度怎么样"。

Databases

SQL Federated Queries

9

redpanda-data/skills

Query Redpanda topics as SQL tables through Redpanda catalogs in Redpanda SQL on Redpanda Cloud BYOC, including the Iceberg history of Iceberg-enabled topics in the same query. Use when mapping a topic with CREATE TABLE default_redpanda_catalog=>name, choosing schema subject, error handling, struct mapping, or key and header decoding options, reading the redpanda metadata column, querying nested fields, querying live and Iceberg records together through a catalog linked with USING CATALOG, running REFRESH after a schema change, fixing Iceberg queries after a REST catalog secret rotates, or ins

Databases

D1

9

zllovesuki/cloudflare-agent-skills

Write Cloudflare D1 code and schemas for SQLite-backed relational data, prepared statements, bindings, migrations, typed queries, tenant boundaries, indexes, pagination, and idempotent writes. Use when Workers need SQL data on Cloudflare.

Databases

Browse the most popular Claude skills, all databases skills, or write your own with the skills generator.