sql
/sql
Write, run, and explain SQL queries, and do quick local analysis of CSV/SQLite data with the sqlite3 CLI. Use when users want a SQL query written or fixed, want to query a .db/.sqlite file, or want to analyze a CSV with SQL (joins, group by, window functions). Triggers on mentions of SQL, query, SELECT, JOIN, GROUP BY, sqlite, database table, 查询, 数据库, 写个 sql, 联表, 分组.
- Author
- microclaw ↗
- Repository
- microclaw ↗
- Licence
- MIT
- Last repository change
- 26.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 26.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Write, run, and explain SQL queries, and do quick local analysis of CSV/SQLite data with the sqlite3 CLI. Use when users want a SQL query written or fixed, want to query a .db/.sqlite file, or want to analyze a CSV with SQL (joins, group by, window functions). Triggers on mentions of SQL, query, SELECT, JOIN, GROUP BY, sqlite, database table, 查询, 数据库, 写个 sql, 联表, 分组.
Original author description
Write, run, and explain SQL queries, and do quick local analysis of CSV/SQLite data with the sqlite3 CLI. Use when users want a SQL query written or fixed, want to query a .db/.sqlite file, or want to analyze a CSV with SQL (joins, group by, window functions). Triggers on mentions of SQL, query, SELECT, JOIN, GROUP BY, sqlite, database table, 查询, 数据库, 写个 sql, 联表, 分组.
How it works
- Inspect a SQLite database
- Query CSV directly with SQL (no schema setup)
- Common patterns
- Guidance
SKILL.md preview
---
name: sql
description: "Write, run, and explain SQL queries, and do quick local analysis of CSV/SQLite data with the sqlite3 CLI. Use when users want a SQL query written or fixed, want to query a .db/.sqlite file, or want to analyze a CSV with SQL (joins, group by, window functions). Triggers on mentions of SQL, query, SELECT, JOIN, GROUP BY, sqlite, database table, 查询, 数据库, 写个 sql, 联表, 分组."
license: Proprietary. LICENSE.txt has complete terms
compatibility: "Requires sqlite3 for execution (query writing works without it). Works on macOS, Linux, and Windows."
---
# SQL
Write standard, readable SQL; when a database is available, run it to verify rather than
guessing the result. Check `command -v sqlite3` before executing.
## Inspect a SQLite database
```bash
sqlite3 app.db ".tables"
sqlite3 app.db ".schema users"
sqlite3 -header -column app.db "SELECT * FROM users LIMIT 5;"
```
## Query CSV directly with SQL (no schema setup)
```bash
sqlite3 :memory: -cmd ".mode csv" -cmd ".import data.csv t" \
"SELECT region, COUNT(*) n, ROUND(AVG(amount),2) avg FROM t GROUP BY region ORDER BY n DESC;"
```
## Common patterns
```sql
-- Join + aggregate
SELECT u.name, COUNT(o.id) AS orders, SUM(o.total) AS spent
FROM users u LEFT JOIN orders o ON o.user_id = u.id
GROUP BY u.id
HAVING orders > 0
ORDER BY spent DESC;
-- Window function: rank within group
SELECT name, dept, salary,
RANK() OVER (PARTITION BY dept ORDER BY salary DESC) AS rank_in_dept
FROM employees;
-- Upsert (SQLite / Postgres)
INSERT INTO kv(k, v) VALUES('x', 1)
ON CONFLICT(k) DO UPDATE SET v = excluded.v;
```
## Guidance
- Prefer explicit column lists over `SELECT *` in anything reused.
- Use `LEFT JOIN` when you must keep unmatched rows; `WHERE` on a left-joined table silently turns it into an inner join.
- `GROUP BY` every non-aggregated selected column.
- Note the dialect if it's not SQLite (Postgres/MySQL differ on quoting, `LIMIT`/`TOP`, upsert).
- Always test destructive statements (`UPDATE`/`DELETE`) first with a matching `SELECT`.
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · microclaw/microclaw | 100 | MIT |
| ericrisco/rsc-harness | 100 | MIT |
| redpanda-data/skills | 100 | Apache-2.0 |
| nimadorostkar/Claude-Skills-collection | 100 | MIT |
| analyticalmid/data-workflow | 100 | MIT |
| G1Joshi/Agent-Skills | 100 | MIT |
| olehsvyrydov/AI-development-team | 100 | MIT |
| dkbnull/hello-skill | 96 | MIT |
| minerval-ai/minerval | 92 | Apache-2.0 |
Database snapshot: 13.11.2026 · package version 1d2e1e4bfade (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100sql-optimizer
Analyze and optimize SQL queries for performance. Use when a user asks to optimize a query, speed up a slow query, analyze a query plan, add indexes, fix N+1 queries, reduce query time, tune database performance, or rewrite SQL for efficiency. Supports PostgreSQL, MySQL, and SQLite. - 86database-query
当用户要连接外部数据库(SQLite / MySQL / PostgreSQL)编写 SQL、查询数据、导出结果或分析库表结构时使用。 - 100sql-query-generation
Generate SQL queries from natural-language requirements using SELECT, JOIN, GROUP BY, window functions, CTEs, and subqueries. Use when the user needs a new query from a business question or schema; use query-optimization when an existing query or execution plan is slow. - 100sql-insight
Translate natural language to SQL, optimize query performance, and interpret EXPLAIN plans for SQLite and PostgreSQL. Triggered when users ask to convert questions into SQL, improve slow queries, tune indexes, analyze execution plans, or mention keywords like NL2SQL, query… - 95sql-optimization
SQL query optimization patterns including EXPLAIN plan analysis, index strategies, query rewriting, and N+1 query prevention. Use when optimizing slow database queries, analyzing query performance, designing indexes, or debugging database bottlenecks. Works with PostgreSQL,… - 80hsql
Run SQL against any database from the command line with hsql, Harlequin's headless SQL client — execute a query or a .sql file, inspect a database's schemas, tables and columns, read the history of queries run against it, export results as CSV/JSON/Parquet, and read or write…