sql-pro
Skill36 starsChanged 6 months agoMITView on GitHub
Masters modern SQL across PostgreSQL, BigQuery, Snowflake, and hybrid OLTP/OLAP systems — covering advanced query techniques, dimensional modeling, time-series SQL, and data warehouse patterns. Use when writing complex analytics SQL, designing cloud database schemas, or optimizing cross-platform SQL workloads.
13 other projects use a version of this.
Adopted by
Most recently taken up by
- TheHiddenDeveloper/jarvis-skillstheir own version, first seen Aug 19, 2026
- Leo-Atienza/atlas-claudetheir own version, first seen Jul 24, 2026
- james-paul25/claude-skilltheir own version, first seen Jul 11, 2026
- jshsakura/awesome-opencode-skillstheir own version, first seen Jul 8, 2026
- codeApe-7/ai-agent-workflowGrouptheir own version, first seen Jun 6, 2026
- ai4brands-design/claude-skillstheir own version, first seen Mar 22, 2026
Other versions13 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 13
- Jeffallan/claude-skills★ 12ksame name
- jshsakura/awesome-opencode-skills★ 29same name
- codeApe-7/ai-agent-workflowGroup★ 17same name
- belokonm/claude-supercode-skills★ 11same name
- xfstudio/skills★ 9same name
- nicolasestrem/antigravity-gemini-skills★ 8same name
- Leo-Atienza/atlas-claude★ 4same name
- marttp/my_agent_skills_I_use★ 4same name
- ai4brands-design/claude-skills★ 2same name
- d3labs-thomas/claude-code★ 2same name
3 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository157 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- a2ui-angularSkill
- accessibility-auditSkill
- adk-deploy-guideSkill
- adk-dev-guideSkill
- adk-eval-guideSkill
- adk-observability-guideSkill
- agentic-ai-coding-standardSkill
- agentic-ai-devSkill
- ai-auditSkill
- ai-chatSkill
- ai-decision-recordSkill
- ai-incident-responseSkill
- ai-launch-checkSkill
- ai-playbookSkill
- angular-best-practicesSkill
- angularSkill
- angular-spaSkill
- angular-ui-patternsSkill
- api-design-principlesSkill
- app-store-optimizationSkill
- architect-reviewSkill
- architecture-decision-recordsSkill
- architecture-designSkill
- asc-cli-usageSkill
- asc-crash-triageSkill
- asc-id-resolverSkill
- asc-release-flowSkill
- asc-signing-setupSkill
- asc-submission-healthSkill
- asc-testflight-orchestrationSkill
- browser-testingSkill
- changelog-generatorSkill
- claude-actions-auditorSkill
- clean-codeSkill
- codebase-onboardingSkill
- code-explainerSkill
- code-reviewerSkill
- code-simplifierSkill
- comment-analyzerSkill
- database-schema-designerSkill
- ddd-architectSkill
- decision-frameworksSkill
- dedup-code-agentSkill
- deployment-ci-cdSkill
- design-systemSkill
- dockerSkill
- documentation-generationSkill
- domain-finderSkill
- error-detectiveSkill
- eval-guideSkill
- feature-forgeSkill
- firebase-basicsSkill
- firebase-hosting-basicsSkill
- fixing-accessibilitySkill
- fixing-motion-performanceSkill
- flutter-animationsSkill
- flutter-genuiSkill
- flutter-mobileSkill
- flutter-security-expertSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 11 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
NEVER WRITE SQL WITHOUT KNOWING THE QUERY PLAN — USE EXPLAIN ANALYZE BEFORE CLAIMING A QUERY IS OPTIMIZED
- Very specific: line 62
Run EXPLAIN ANALYZE (PostgreSQL) or query profile (BigQuery/Snowflake)
- Distinctive: line 67
Use read replicas for heavy analytics queries on OLTP primary
“Common” is measured: kept by at least 6 in 10 of the 11 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Iron Law
NEVER WRITE SQL WITHOUT KNOWING THE QUERY PLAN — USE EXPLAIN ANALYZE BEFORE CLAIMING A QUERY IS OPTIMIZED
When to Use This Skill
- Writing complex SQL queries or analytics (window functions, recursive CTEs, OLAP)
- Designing SQL for cloud-native platforms (BigQuery, Snowflake, Redshift, Aurora)
- Building HTAP or hybrid analytical/transactional systems
- Migrating from OLTP-only PostgreSQL to an analytics tier
- Dimensional modeling, data vault, star/snowflake schemas
- Integrating machine learning with SQL workloads
- Time-series analysis (TimescaleDB, InfluxDB, Apache Druid)
Do Not Use This Skill When
- You only need ORM-level guidance (use
python-dev,nestjs-api, orjava-spring-api) - The system is non-SQL or document-only (use
database-schema-designerfor Firestore patterns) - You need query optimization patterns for PostgreSQL OLTP (use
sql-optimization-patterns) - You cannot access query plans or schema details
Quick Reference
| Workload | Platform | Key Consideration |
| OLTP (transactional) | PostgreSQL | Normalize to 3NF, index FKs and WHERE cols |
| OLAP (analytics) | BigQuery / Snowflake / Redshift | Denormalize, columnar storage, partition by date |
| HTAP (both) | CockroachDB / TiDB | Read replicas for analytics, avoid read-your-own-writes latency |
| Time-series | TimescaleDB / InfluxDB | Hypertables, continuous aggregates, retention policies |
| Data warehouse | Redshift / Databricks | Star schema, materialized views, query concurrency |
| Graph + SQL | Neo4j / Amazon Neptune | Cypher for traversal, SQL for aggregation |
Process
Phase 1 — Understand the Workload
- Classify: OLTP / OLAP / HTAP / time-series / data warehouse
- Identify read/write ratio, peak concurrency, data volume (rows, GB)
- Confirm platform and version (PostgreSQL 16, BigQuery, Snowflake Enterprise, etc.)
Phase 2 — Design the Query or Schema
- Apply appropriate normalization or denormalization for workload type
- For OLAP: star schema (fact + dimensions), SCD Type 2 for slowly changing dims
- For data vault: hubs, links, satellites pattern
- For event sourcing: append-only events table, aggregate projections
Phase 3 — Optimize and Validate
- Run
EXPLAIN ANALYZE(PostgreSQL) or query profile (BigQuery/Snowflake) - Identify sequential scans, hash joins on large tables, spill to disk
- Apply indexes, partitioning, or materialization as evidence dictates
Phase 4 — Production Readiness
- Use read replicas for heavy analytics queries on OLTP primary
- Apply LIMIT + cursor pagination for large result sets
- Set statement_timeout for user-facing queries
- Enable connection pooling (PgBouncer) for high-concurrency workloads
Platform-Specific Capabilities
PostgreSQL (Primary Stack)
- Window functions:
OVER (PARTITION BY ... ORDER BY ...) - Recursive CTEs: hierarchical data traversal
- JSON/JSONB:
@>,#>>,jsonb_path_query - Full-text:
to_tsvector,ts_rank, GIN indexes - Temporal:
timestamptz,AT TIME ZONE,generate_seriesfor gaps - Extensions:
pg_stat_statements,pg_trgm,uuid-ossp,pgcrypto
Cloud Analytics Platforms
- BigQuery: Standard SQL, partitioned tables, clustering,
INFORMATION_SCHEMA - Snowflake: Zero-copy cloning, time-travel, micro-partitioning, tasks + streams
- Redshift: Distribution keys, sort keys, VACUUM + ANALYZE cadence
- Databricks: Delta Lake,
MERGE INTO, streaming + batch unification
Time-Series
- TimescaleDB: Hypertables, continuous aggregates, compression policies
- InfluxDB: Flux queries, bucket retention, downsampling tasks
- Apache Druid: Real-time ingestion, rollup, approximate aggregations (HLL, quantiles)
Advanced SQL Patterns
Window Functions
-- Running total + rank within partition
SELECT
user_id,
order_date,
total,
SUM(total) OVER (PARTITION BY user_id ORDER BY order_date) AS running_total,
RANK() OVER (PARTITION BY user_id ORDER BY total DESC) AS rank_in_user
FROM orders;Recursive CTE (Hierarchical Data)
WITH RECURSIVE org_tree AS (
-- Base case: root nodes
SELECT id, name, parent_id, 0 AS depth
FROM employees WHERE parent_id IS NULL
UNION ALL
-- Recursive case
SELECT e.id, e.name, e.parent_id, ot.depth + 1
FROM employees e
JOIN org_tree ot ON e.parent_id = ot.id
)
SELECT * FROM org_tree ORDER BY depth, name;HTAP Pattern — Separate Read/Write Paths
-- Write path: OLTP primary (PostgreSQL)
INSERT INTO orders (user_id, total, created_at) VALUES ($1, $2, NOW());
-- Read path: replica or analytics DB
-- Use logical replication to BigQuery/Snowflake for heavy aggregations
SELECT DATE_TRUNC('month', created_at), SUM(total)
FROM orders
GROUP BY 1 ORDER BY 1;
-- Route this to read replica, not primarySCD Type 2 (Slowly Changing Dimensions)
-- Invalidate current record, insert new version
UPDATE dim_customers
SET valid_to = NOW(), is_current = FALSE
WHERE customer_id = $1 AND is_current = TRUE;
INSERT INTO dim_customers (customer_id, name, email, valid_from, valid_to, is_current)
VALUES ($1, $2, $3, NOW(), '9999-12-31', TRUE);Anti-Patterns
- Running heavy OLAP aggregations on OLTP primary — use read replica or separate analytics DB
SELECT *on wide fact tables in analytics workloads — columns are stored separately in columnar DBs- Non-partitioned tables for time-series data exceeding 1M rows — always partition by time
- Correlated subqueries in analytical queries — always transform to JOINs or window functions
- Implicit type casting in JOIN conditions — prevents index usage, causes full scans
- DDL inside transactions on BigQuery/Snowflake — not supported; manage schema changes separately
Documentation Sources
- PostgreSQL docs: Query MCP context7 with library ID
/postgresql/postgresql - BigQuery: Query MCP context7 with library ID
/googleapis/google-cloud-bigquery - Snowflake SQL reference:
WebFetchfrom Snowflake documentation - TimescaleDB: Query MCP context7
Reference Files
(None yet — patterns are inline above. Add reference/cloud-platform-sql.md when cloud-specific patterns grow beyond this file.)
Related Skills
sql-optimization-patterns— PostgreSQL OLTP query tuning, EXPLAIN analysis, N+1 fixes, cursor paginationdatabase-schema-designer— Schema design, Flyway migrations, normalization, FK/index rulesvector-database— pgvector, HNSW/IVFFlat, RAG pipelinespython-dev— SQLAlchemy async, asyncpg, FastAPI integrationjava-spring-api— R2DBC reactive PostgreSQLnestjs-api— Prisma ORM, raw SQL via Prisma
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

