/tsql-master:execution-plan-analysisfrom tsql-master
Triages SQL Server execution plans (.sqlplan, ShowPlan XML) to identify costly operators, warnings, and cardinality issues. Useful for performance troubleshooting and query rewrite decisions.
Ships in tsql-master. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Use this skill to triage SQL Server actual or estimated execution plans, especially .sqlplan ShowPlan XML. Treat the plan as evidence, not a verdict: validate schema, data types, indexes, row counts, partitioning, parameter values, and local-vs-linked-server execution before recommending rewrites or indexes.
Ask for the smallest set needed to verify the plan:
Use ../_shared/optimization-intake.md and ../_shared/assumption-tracker.md for intake and assumption status tracking.
Record whether the plan is actual or estimated. Actual plans expose runtime row counts, warnings, spills, memory grant use, and actual partition access. Estimated plans can still reveal access paths, conversions, missing index requests, and join choices, but cannot prove runtime misestimates or spills.
Capture:
Sort operators by estimated subtree or operator cost to find likely work centers, but do not tune solely by percentage. A 90% operator in a tiny query may not matter; a low-percentage operator inside a repeated nested loops branch can dominate runtime.
For each candidate operator, record:
| Evidence | What to capture |
|---|---|
| Operator | Physical and logical operation |
| Object | Table, index, or remote source |
| Cost | Estimated operator/subtree cost and relative percentage |
| Rows | estimated rows, actual rows, executions, rows read |
| Predicates | seek predicates, residual predicates, probes, join predicates |
| Warnings | spills, conversions, missing indexes, no join predicate, cardinality issues |
A seek is not automatically good and a scan is not automatically bad. Verify how much data was read vs returned.
SeekPredicates vs Predicate. A seek that reads millions and filters later may need a better key order, computed column, filtered index, or rewrite.Search ShowPlan for CONVERT_IMPLICIT, PlanAffectingConvert, and scalar operators around indexed columns. Prioritize conversions on the column side of predicates and joins because they can block seeks or distort estimates.
Classify each conversion:
Recommended fixes must preserve semantics: align parameter types, temp-table types, literals, computed columns, or source column definitions when schema change is allowed.
Large estimate errors can explain bad join order, memory grants, spills, and wrong join algorithms.
Flag when any operator has:
Tie recommendations to root cause: update statistics, create filtered statistics/indexes, use temp tables for phased cardinality, address parameter sensitivity, or rewrite predicates.
For partitioned objects, prove whether the plan eliminates partitions.
Check:
Warn against unsafe partition predicates such as wrapping the partition column in functions, comparing mismatched types, or filtering on a related date column that is not the partitioning column unless a trusted constraint proves equivalence.
Missing-index warnings are suggestions for one compiled statement, not a design. Convert them into candidate indexes only after comparing with existing indexes, workload patterns, write cost, and constraints.
Also inspect unused or duplicate indexes if the plan shows update overhead or if index maintenance is part of the ask. Do not recommend dropping indexes from a single plan; require workload evidence.
Use this format:
For ShowPlan XML attributes, XPath-style lookups, and operator-cost interpretation, see references/showplan-xml-checklist.md.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub josiahsiegel/claude-plugin-marketplace --plugin tsql-master6 skills in this plugin
/advanced-patternsAdvanced T-SQL patterns and techniques for SQL Server and Azure SQL.
PROACTIVELY activate for: (1) writing CTEs and recursive queries, (2) APPLY operator (CROSS APPLY, OUTER APPLY), (3) MERGE statement and OUTPUT clause, (4) temporal tables (system-versioned), (5) In-Memory OLTP / memory-optimized tables, (6) advanced grouping (ROLLUP, CUBE, GROUPING SETS), (7) PIVOT and UNPIVOT, (8) ROW_NUMBER/RANK/DENSE_RANK with PARTITION BY, (9) hierarchies via recursive CTE or HierarchyId, (10) JSON_ARRAYAGG and STRING_AGG patterns.
Provides: pattern catalog with examples for each technique, performance tradeoffs, and copy-pasteable templates for common advanced query shapes.
/azure-sql-optimizationAzure SQL Database optimization and platform-specific features.
PROACTIVELY activate for: (1) Azure SQL Database optimization, (2) DTU vs vCore selection and right-sizing, (3) automatic tuning (force last good plan, create/drop index), (4) Hyperscale tier and read replicas, (5) Serverless tier and auto-pause, (6) Azure SQL performance monitoring (Query Performance Insight, Intelligent Insights), (7) elastic pools, (8) Always Encrypted with secure enclaves, (9) Managed Instance vs Azure SQL DB tradeoffs, (10) failover groups and geo-replication.
Provides: tier-selection matrix, automatic-tuning enablement steps, Hyperscale architecture overview, monitoring queries, and elastic pool sizing guidance.
/index-strategiesThis skill should be used when the user asks to design, review, add, drop, consolidate, or tune SQL Server indexes. PROACTIVELY activate for clustered vs nonclustered design, covering indexes and INCLUDE columns, filtered indexes, columnstore indexes, missing-index DMV interpretation, duplicate or unused indexes, index maintenance, fragmentation, fill factor, compression, partition-aligned indexes, partition elimination proof, huge-table index constraints, online/resumable rebuilds, and index changes for slow T-SQL queries.
Provides: index-design decision tree, workload-aware tradeoff checklist, DMV interpretation guidance, and maintenance/rebuild patterns.
/query-optimizationThis skill should be used when the user asks to optimize slow T-SQL queries, fix SQL Server performance regressions, improve SARGability, rewrite joins, prove whether joins can be removed, compare temp-table data types, select rewrite templates, diagnose parameter sniffing, evaluate query hints, inspect statistics/cardinality estimates, reduce spills or memory grants, use Query Store, or interpret plan evidence. PROACTIVELY activate for slow queries, scans vs seeks, implicit conversions, bad joins, tempdb spills, query rewrites, partition predicate safety, and before recommending indexes or hints.
Provides: evidence-first workflow, rewrite templates, parameter-sniffing playbook, and gating rules before recommending indexes or hints.
/tsql-functionsComplete T-SQL function reference for SQL Server and Azure SQL Database.
PROACTIVELY activate for: (1) string functions (CONCAT_WS, STRING_SPLIT, STRING_AGG, TRIM, REPLACE, LEFT/RIGHT/SUBSTRING), (2) date/time functions (DATEADD, DATEDIFF, FORMAT, DATETRUNC, AT TIME ZONE), (3) math and conversion functions (CAST, CONVERT, TRY_CAST, ROUND, FLOOR, CEILING), (4) window/ranking functions (ROW_NUMBER, RANK, LEAD/LAG, FIRST_VALUE, LAST_VALUE, NTILE), (5) JSON functions (JSON_VALUE, JSON_QUERY, JSON_MODIFY, OPENJSON), (6) XML functions (FOR XML, .nodes, .value), (7) aggregate functions and GROUP BY extensions, (8) system and metadata functions (sys.* views, OBJECT_ID, OBJECT_NAME).
Provides: function catalog grouped by category, version-availability matrix (SQL 2016+/2019+/2022+), and worked examples for each function family.
Other plugins' skills for the same job