원클릭으로
sql
Master relational databases with SQL. Schema design, queries, performance, migrations for PostgreSQL, MySQL, SQLite, SQL Server.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Master relational databases with SQL. Schema design, queries, performance, migrations for PostgreSQL, MySQL, SQLite, SQL Server.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Review code changes for bugs, regressions, security issues, maintainability problems, and cleanup opportunities. Use when the user asks for a code review, refactor pass, cleanup pass, review comments, or a merge-readiness check on changed code.
Create test plans and focused automated tests that cover happy paths, edge cases, failures, and state transitions. Use when the user asks for QA planning, test cases, edge-case coverage, unit or integration tests, or a release-readiness check on feature behavior.
Debug a failing feature from evidence, isolate the cause, propose the smallest safe fix, and verify the result. Use when the user shares an error, stack trace, failing behavior, terminal output, logs, or asks for root-cause analysis and a targeted fix.
Turn a rough product idea into a usable PRD with problem statement, users, scope, flows, metrics, acceptance criteria, risks, and open questions. Use when the user asks for a PRD, product spec, feature definition, discovery write-up, or planning document before UX, architecture, or coding starts.
Translate a PRD into technical decisions, data shape, boundaries, folder structure, and implementation slices. Use when the user asks for architecture, system design, stack choices, app structure, APIs, repositories, services, or a tech lead handoff before coding starts.
Review a feature, architecture, or code path for practical security risks including auth, permissions, secrets, data exposure, abuse cases, and release blockers. Use when the user asks for a security review, threat model, permissions check, data-handling sanity check, or pre-release risk scan.
| name | SQL |
| slug | sql |
| version | 1.0.1 |
| changelog | Added SQL Server support, schema design patterns, query patterns (CTEs, window functions), operations guide (backup, monitoring, replication) |
| homepage | https://clawic.com/skills/sql |
| description | Master relational databases with SQL. Schema design, queries, performance, migrations for PostgreSQL, MySQL, SQLite, SQL Server. |
| metadata | {"clawdbot":{"emoji":"🗄️","requires":{"anyBins":["sqlite3","psql","mysql","sqlcmd"]},"os":["linux","darwin","win32"]}} |
Master relational databases from the command line. Covers SQLite, PostgreSQL, MySQL, and SQL Server with battle-tested patterns for schema design, querying, migrations, and operations.
Working with relational databases—designing schemas, writing queries, building migrations, optimizing performance, or managing backups. Applies to SQLite, PostgreSQL, MySQL, and SQL Server.
| Topic | File |
|---|---|
| Query patterns | patterns.md |
| Schema design | schemas.md |
| Operations | operations.md |
| Use Case | Database | Why |
|---|---|---|
| Local/embedded | SQLite | Zero setup, single file |
| General production | PostgreSQL | Best standards, JSONB, extensions |
| Legacy/hosting | MySQL | Wide hosting support |
| Enterprise/.NET | SQL Server | Windows integration |
# ❌ NEVER
cursor.execute(f"SELECT * FROM users WHERE id = {user_id}")
# ✅ ALWAYS
cursor.execute("SELECT * FROM users WHERE id = ?", (user_id,))
Any column in WHERE, JOIN ON, or ORDER BY on large tables needs an index.
BEGIN;
UPDATE accounts SET balance = balance - 100 WHERE id = 1;
UPDATE accounts SET balance = balance + 100 WHERE id = 2;
COMMIT;
-- ✅ Faster (stops at first match)
SELECT * FROM orders o WHERE EXISTS (
SELECT 1 FROM users u WHERE u.id = o.user_id AND u.active
);
sqlite3 mydb.sqlite # Create/open
sqlite3 mydb.sqlite "SELECT * FROM users;" # Query
sqlite3 -header -csv mydb.sqlite "SELECT *..." > out.csv
sqlite3 mydb.sqlite "PRAGMA journal_mode=WAL;" # Better concurrency
psql -h localhost -U myuser -d mydb # Connect
psql -c "SELECT NOW();" mydb # Query
psql -f migration.sql mydb # Run file
\dt \d+ users \di+ # List tables/indexes
mysql -h localhost -u root -p mydb # Connect
mysql -e "SELECT NOW();" mydb # Query
sqlcmd -S localhost -U myuser -d mydb # Connect
sqlcmd -Q "SELECT GETDATE()" # Query
sqlcmd -S localhost -d mydb -E # Windows auth
NOT IN (subquery) returns empty if subquery has NULL → use NOT EXISTSNULL = NULL is NULL, not true → use IS NULLCOUNT(column) excludes NULLs, COUNT(*) counts allWHERE YEAR(date) = 2024 scans full tableWHERE varchar_col = 123 skips indexLIKE '%term' can't use index → only LIKE 'term%' works(a, b) won't help filtering only on b-- PostgreSQL
EXPLAIN (ANALYZE, BUFFERS) SELECT * FROM orders WHERE user_id = 5;
-- SQLite
EXPLAIN QUERY PLAN SELECT * FROM orders WHERE user_id = 5;
Red flags:
Seq Scan on large tables → needs indexRows Removed by Filter high → index doesn't cover filterANALYZE tablename;-- Composite index (equality first, range last)
CREATE INDEX idx_orders ON orders(user_id, status);
-- Covering index (avoids table lookup)
CREATE INDEX idx_orders ON orders(user_id) INCLUDE (total);
-- Partial index (smaller, faster)
CREATE INDEX idx_pending ON orders(user_id) WHERE status = 'pending';
| Feature | PostgreSQL | MySQL | SQLite | SQL Server |
|---|---|---|---|---|
| LIMIT | LIMIT n | LIMIT n | LIMIT n | TOP n |
| UPSERT | ON CONFLICT | ON DUPLICATE KEY | ON CONFLICT | MERGE |
| Boolean | true/false | 1/0 | 1/0 | 1/0 |
| Concat | || | CONCAT() | || | + |
Install with clawhub install <slug> if user confirms:
prisma — Node.js ORMsqlite — SQLite-specific patternsanalytics — data analysis queriesclawhub star sqlclawhub sync