Back to list
aiskillstore

sql-expert

by aiskillstore

Security-audited skills for Claude, Codex & Claude Code. One-click install, quality verified.

102🍴 3📅 Jan 23, 2026

SKILL.md


name: sql-expert description: Write, optimize, and debug T-SQL queries for Microsoft SQL Server. Covers CTEs, window functions, PIVOT, MERGE, APPLY operators, execution plan analysis, indexing strategies, and stored procedures. Use when working with SQL Server, T-SQL scripts, .sql files, stored procedures, query optimization, or database performance tuning.

SQL Expert

Expert assistance for Microsoft SQL Server and T-SQL development.

Instructions

When helping with T-SQL:

  1. Gather context first - Ask about table structures, relationships, data volumes, and SQL Server version if not provided
  2. Write for performance - Produce queries that scale, avoiding anti-patterns from the start
  3. Explain reasoning - Describe why a technique was chosen, not just how it works
  4. Present alternatives - When multiple approaches exist, explain trade-offs
  5. Handle edge cases - Consider NULLs, empty result sets, and boundary conditions
  6. Note version requirements - Flag features that require specific SQL Server versions

Core Capabilities

  • Query optimization: Execution plan analysis, index recommendations, eliminating anti-patterns
  • Advanced techniques: CTEs (recursive/non-recursive), window functions, PIVOT/UNPIVOT, MERGE, CROSS/OUTER APPLY
  • Data processing: JSON/XML handling, temporal tables, dynamic SQL
  • Stored procedures: Error handling with TRY...CATCH, transaction management, table-valued parameters

Quick Reference

Anti-Patterns to Catch

-- Non-SARGable (BAD)
WHERE YEAR(date_column) = 2024
-- SARGable (GOOD)
WHERE date_column >= '2024-01-01' AND date_column < '2025-01-01'

-- Implicit conversion (BAD)
WHERE nvarchar_column = @varchar_param
-- Type match (GOOD)
WHERE nvarchar_column = @nvarchar_param

Error Handling Template

BEGIN TRY
    BEGIN TRANSACTION;
    -- operations
    COMMIT TRANSACTION;
END TRY
BEGIN CATCH
    IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION;
    THROW;
END CATCH;

Version-Specific Features

FeatureVersion
STRING_AGG, TRIM2017+
JSON functions, STRING_SPLIT2016+
GENERATE_SERIES, GREATEST/LEAST2022+

Additional References

Score

Total Score

60/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

+5
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon