sql-pro-skill/SKILL.md
Use when user needs SQL development, database design, query optimization, performance tuning, or database administration across PostgreSQL, MySQL, SQL Server, and Oracle platforms.
npx skillsauth add 404kidwiz/claude-supercode-skills sql-proInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Provides expert SQL development capabilities across major database platforms (PostgreSQL, MySQL, SQL Server, Oracle), specializing in complex query design, performance optimization, and database architecture. Masters ANSI SQL standards, platform-specific optimizations, and modern data patterns with focus on efficiency and scalability.
Invoke this skill when:
Do NOT invoke when:
Query Requirement Analysis
│
├─ Need to reference result multiple times?
│ └─ YES → Use CTE (avoids duplicate subquery evaluation)
│ WITH user_totals AS (SELECT ...)
│ SELECT * FROM user_totals WHERE ...
│ UNION ALL
│ SELECT * FROM user_totals WHERE ...
│
├─ Recursive data traversal (hierarchy, graph)?
│ └─ YES → Use Recursive CTE (ONLY option for recursion)
│ WITH RECURSIVE tree AS (
│ SELECT ... -- anchor
│ UNION ALL
│ SELECT ... FROM tree ... -- recursive
│ )
│
├─ Simple lookup or filter?
│ └─ Use JOIN (most optimizable by query planner)
│ SELECT u.*, o.total
│ FROM users u
│ JOIN orders o ON u.id = o.user_id
│
├─ Correlated subquery in WHERE clause?
│ ├─ Checking existence → Use EXISTS (stops at first match)
│ │ WHERE EXISTS (SELECT 1 FROM orders WHERE user_id = u.id)
│ │
│ └─ Value comparison → Use JOIN instead
│ -- BAD: WHERE (SELECT COUNT(*) FROM orders WHERE user_id = users.id) > 5
│ -- GOOD: JOIN (SELECT user_id, COUNT(*) as cnt FROM orders GROUP BY user_id)
│
└─ Readability vs Performance trade-off?
├─ Complex logic, readability critical → CTE
│ (Easier to understand, debug, maintain)
│
└─ Performance critical, simple logic → Subquery or JOIN
(Query planner can inline and optimize)
| Requirement | Solution | Example |
|------------|----------|---------|
| Need aggregation + row-level detail | Window function | SELECT name, salary, AVG(salary) OVER () as avg_salary FROM employees |
| Only aggregated results needed | GROUP BY | SELECT dept, AVG(salary) FROM employees GROUP BY dept |
| Ranking/row numbering | Window function (ROW_NUMBER, RANK, DENSE_RANK) | ROW_NUMBER() OVER (ORDER BY sales DESC) |
| Running totals / moving averages | Window function with frame | SUM(amount) OVER (ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) |
| LAG/LEAD (access previous/next rows) | Window function | LAG(price, 1) OVER (ORDER BY date) as prev_price |
| Percentile / NTILE | Window function | NTILE(4) OVER (ORDER BY score) as quartile |
| Simple count/sum/avg by group | GROUP BY (more efficient) | SELECT category, COUNT(*) FROM products GROUP BY category |
| Observation | Why Escalate | Example | |------------|--------------|---------| | Cartesian product in execution plan | Unintended cross join causing exponential rows | "Query returning millions of rows" | | Complex multi-level recursive CTE performance | Advanced optimization needed | "Recursive CTE traversing 10+ levels with 100K nodes" | | Cross-platform migration with incompatible features | Platform-specific feature mapping | "Migrating Oracle CONNECT BY to PostgreSQL recursive CTE" | | Query with 10+ joins and complex logic | Architecture smell, potential redesign | "Single query joining 15 tables" | | Temporal query with complex time-series logic | Advanced analytical pattern | "SCD Type 2 with historical snapshots" |
Query Performance:
SQL Quality:
Optimization:
Documentation:
development
Expert in automating Excel workflows using Node.js (ExcelJS, SheetJS) and Python (pandas, openpyxl).
content-media
Expert in designing durable, scalable workflow systems using Temporal, Camunda, and Event-Driven Architectures.
tools
Use when user needs WordPress development, theme or plugin creation, site optimization, security hardening, multisite management, or scaling WordPress from small sites to enterprise platforms.
tools
Expert in Windows Server, Active Directory (AD DS), Hybrid Identity (Entra ID), and PowerShell automation.