Skip to content

Commit b611ec9

Browse files
authored
Merge pull request #5 from vanterx/feat/perf-review-orchestrator-v4-tier1
feat(skills): add mssql-performance-review orchestrator (tier 1 — agentic core)
2 parents 2142404 + a530ea4 commit b611ec9

34 files changed

Lines changed: 1484 additions & 4 deletions

File tree

CLAUDE.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ A Claude Code skills library for SQL Server performance tuning — T-SQL static
44

55
## Purpose
66

7-
Provides fifteen slash-command skills that Claude uses when asked to review T-SQL source code, `.sqlplan` XML files, STATISTICS IO/TIME output, Profiler/XE trace data, deadlock graphs, index recommendations, wait statistics, Query Store data, procedure/trigger/function runtime stats collected from `sys.dm_exec_procedure_stats`, Always On AG health from `sys.dm_hadr_*` DMVs, Windows Server Failover Cluster log files, SQL Server ERRORLOG files, or SQL Server SPN and Kerberos delegation configuration. No application code — content is Markdown only.
7+
Provides sixteen slash-command skills — fifteen specialised review skills plus one agentic orchestrator (`mssql-performance-review`) that dispatches the right specialised skill(s) to mixed artifact inputs. Specialised skills cover T-SQL source code, `.sqlplan` XML files, STATISTICS IO/TIME output, Profiler/XE trace data, deadlock graphs, index recommendations, wait statistics, Query Store data, procedure/trigger/function runtime stats collected from `sys.dm_exec_procedure_stats`, Always On AG health from `sys.dm_hadr_*` DMVs, Windows Server Failover Cluster log files, SQL Server ERRORLOG files, and SQL Server SPN and Kerberos delegation configuration. No application code — content is Markdown only.
88

99
## Tech Stack
1010

@@ -33,6 +33,7 @@ Provides fifteen slash-command skills that Claude uses when asked to review T-SQ
3333
| [skills/hadr-health-review/SKILL.md](skills/hadr-health-review/SKILL.md) | Always On AG health analysis: `hadr-health-review`. 22 checks (H1–H22) — replica connectivity, data loss risk, recovery time, throughput, and configuration |
3434
| [skills/errorlog-review/SKILL.md](skills/errorlog-review/SKILL.md) | SQL Server ERRORLOG analysis: `errorlog-review`. 28 checks (E1–E28) — AG failover events, lease expiry, memory pressure, I/O slow, corruption warnings, login failure bursts, startup/shutdown, and configuration signals |
3535
| [skills/spn-review/SKILL.md](skills/spn-review/SKILL.md) | SPN and Kerberos delegation analysis: `spn-review`. 30 checks (K1–K30) — MSSQLSvc SPN presence, service account binding, AG listener and alias, permissions, Kerberos delegation, AD account sensitivity |
36+
| [skills/mssql-performance-review/SKILL.md](skills/mssql-performance-review/SKILL.md) | Agentic offline orchestrator: `mssql-performance-review`. No checks of its own (dispatcher, like `sqlplan-batch`). Routes mixed artifacts to the 15 specialised skills, runs adversarial root-cause check, emits evidence chain + risk-rated fixes + rollback. |
3637

3738
### Human Reference (references/check-explanations.md — not loaded at runtime by default)
3839

@@ -53,12 +54,13 @@ Provides fifteen slash-command skills that Claude uses when asked to review T-SQ
5354
| [skills/hadr-health-review/references/check-explanations.md](skills/hadr-health-review/references/check-explanations.md) | Plain-English explanation of all 22 H-checks with DMV examples, fix recipes, and Quick Reference table |
5455
| [skills/errorlog-review/references/check-explanations.md](skills/errorlog-review/references/check-explanations.md) | Plain-English explanation of all 28 E-checks with ERRORLOG examples, fix recipes, and Quick Reference table |
5556
| [skills/spn-review/references/check-explanations.md](skills/spn-review/references/check-explanations.md) | Plain-English explanation of all 30 K-checks with setspn/AD attribute examples, delegation model tables, and Quick Reference table |
57+
| [skills/mssql-performance-review/references/check-explanations.md](skills/mssql-performance-review/references/check-explanations.md) | Methodology reference for the orchestrator: dispatch heuristics, symptom-to-probe-sequence map, hypothesis classes, recommendation conflict catalogue, and rationale for the standard analysis order |
5658

5759
### Root Documentation
5860

5961
| File | Purpose |
6062
|------|---------|
61-
| [README.md](README.md) | User-facing guide: triggers, input formats, output samples for all 15 skills |
63+
| [README.md](README.md) | User-facing guide: triggers, input formats, output samples for all 16 skills |
6264
| [PERFORMANCE_TUNING_GUIDE.md](PERFORMANCE_TUNING_GUIDE.md) | Decision guide: which skill to use for which scenario, symptom-based routing, artifact capture how-tos, 231-check ID reference |
6365
| [LLM_COST_ESTIMATION.md](LLM_COST_ESTIMATION.md) | Token and dollar cost breakdown per skill — worked examples, cost control strategies, prompt caching guide |
6466
| [.claude/docs/architectural_patterns.md](.claude/docs/architectural_patterns.md) | Cross-cutting conventions: check ID namespacing, input polymorphism, output format, companion pipeline, dollar-sign avoidance |
@@ -95,7 +97,7 @@ npx skills add vanterx/mssql-performance-skills -g # global
9597

9698
**Manual fallback:**
9799
```bash
98-
cp -r skills/* ~/.claude/skills/ # global (all 15 skills)
100+
cp -r skills/* ~/.claude/skills/ # global (all 16 skills)
99101
cp -r skills/* .claude/skills/ # project-scoped
100102
```
101103

@@ -156,8 +158,9 @@ Never use `$0`, `$3`, `$15`, or `$[...]` inside SKILL.md files. The skill loader
156158
| `L` | `clusterlog-review` |
157159
| `E` | `errorlog-review` |
158160
| `K` | `spn-review` |
161+
| (none) | `mssql-performance-review` — dispatcher; delegates checks to other skills, like `sqlplan-batch` |
159162

160-
New skills must choose an unused single uppercase letter.
163+
New skills must choose an unused single uppercase letter, or document why they are dispatcher-style (no prefix) like the orchestrator and `sqlplan-batch`.
161164

162165
### references/check-explanations.md is not loaded at runtime by default
163166
Only `SKILL.md` is loaded automatically by the Claude Code skill loader. The `references/check-explanations.md` file is human reference and on-demand context — Claude may load it when a user asks "explain check X" or for deeper fix-option detail. Do not put trigger conditions or thresholds there that Claude needs to act on without prompting.

LLM_COST_ESTIMATION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Claude Code's own instructions, tool definitions, CLAUDE.md, and conversation hi
4949
| `hadr-health-review` | ~2,900 |
5050
| `errorlog-review` | ~3,100 |
5151
| `spn-review` | ~3,800 |
52+
| `mssql-performance-review` | ~7,500 |
5253

5354
### Your input artifact
5455

PERFORMANCE_TUNING_GUIDE.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,32 @@ A decision guide for choosing the right skill — or combination of skills — f
2121
| [`procstats-review`](#procstats-review) | `/procstats-review` | Output from `sql/procstats/04_report_queries.sql` pasted from `collect.proc_stats` | Procedure/trigger/function runtime stats — 20 checks (R1–R20): top consumers, per-execution efficiency, N+1 patterns, parameter sniffing, trend analysis |
2222
| [`clusterlog-review`](#clusterlog-review) | `/clusterlog-review` | `CLUSTER.LOG` file or inline paste | WSFC cluster log analysis — 25 checks (L1–L25): lease timeouts, health check failures, quorum loss, node eviction, network partition, RHS crashes, AG resource transitions |
2323
| [`errorlog-review`](#errorlog-review) | `/errorlog-review` | SQL Server ERRORLOG file or inline paste | ERRORLOG operational analysis — 28 checks (E1–E28): AG failover events, lease expiry, memory pressure, I/O slow, corruption warnings, login failure bursts, startup/shutdown, and configuration signals |
24+
| [`hadr-health-review`](#hadr-health-review) | `/hadr-health-review` | `sys.dm_hadr_*` DMV output | Always On AG health analysis — 22 checks (H1–H22): replica connectivity, data loss risk, recovery time, throughput, and configuration |
2425
| [`spn-review`](#spn-review) | `/spn-review` | `setspn` output and/or `Get-ADUser`/`Get-ADComputer` AD attribute output | SPN and Kerberos delegation analysis — 30 checks (K1–K30): MSSQLSvc SPN presence, service account binding, AG listener and alias, permissions, Kerberos delegation, AD account sensitivity |
26+
| [`mssql-performance-review`](#mssql-performance-review) | `/mssql-performance-review` / `/sql-triage` | Mixed artifacts or a symptom description | Agentic offline orchestrator — routes mixed inputs to the right specialised skills, runs an adversarial root-cause check, emits a consolidated report with evidence chain, risk-rated fixes, and rollback. Dispatcher, no checks of its own. |
2527

2628
---
2729

2830
## Choose by Scenario
2931

32+
### "I have a pile of mixed artifacts and don't know where to start"
33+
34+
**Use: `/mssql-performance-review`**
35+
36+
The orchestrator classifies every input (`.sqlplan`, `.sql`, stats output, wait stats, trace, Query Store, procstats, deadlock XML, ERRORLOG, CLUSTER.LOG, setspn output, hadr DMVs), forms 2-3 ranked hypotheses, dispatches the relevant specialised skills, runs an adversarial root-cause check, and emits one consolidated report. Strictly offline — never contacts SQL Server.
37+
38+
```
39+
/mssql-performance-review ./incident-20260517/
40+
```
41+
42+
Also accepts a symptom description ("CPU is high on prod since 09:00") and tells you which captures to run.
43+
44+
```
45+
/sql-triage CPU pegged at 95% on PROD-SQL01 since 09:00, no recent deploy
46+
```
47+
48+
---
49+
3050
### "I'm writing a new query or stored procedure"
3151

3252
**Use: `/tsql-review`**

README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ A collection of Claude Code skills covering the full SQL Server performance tuni
2929
| [hadr-health-review](#hadr-health-review) | Analyze Always On AG health from `sys.dm_hadr_*` DMVs — 22 checks (H1–H22): replica connectivity, data loss risk, recovery time, throughput, and configuration |
3030
| [errorlog-review](#errorlog-review) | Analyze SQL Server ERRORLOG for operational issues — 28 checks (E1–E28): AG failover events, lease expiry, memory pressure, I/O slow, corruption warnings, login failure bursts, startup/shutdown |
3131
| [spn-review](#spn-review) | Analyze SQL Server SPN configuration and Kerberos delegation settings — 30 checks (K1–K30): SPN presence, service account binding, AG listener and alias, permissions, delegation, AD account sensitivity |
32+
| [mssql-performance-review](#mssql-performance-review) | Agentic offline orchestrator — routes mixed artifacts (or a symptom description) to the right specialised skills, runs an adversarial root-cause check, and emits a single consolidated report with evidence chain, risk-rated fixes, and rollback. Use when you have several artifact types together or are not sure which skill to run. |
3233

3334
---
3435

@@ -1195,6 +1196,53 @@ EXECUTE collect.usp_CollectProcStats;
11951196

11961197
---
11971198

1199+
## mssql-performance-review
1200+
1201+
Agentic offline orchestrator. Routes mixed SQL Server artifacts to the right specialised skills, runs an adversarial root-cause check, and emits a single consolidated report with explicit evidence chain, risk-rated fixes, and rollback steps for every recommendation.
1202+
1203+
**Strictly offline.** The orchestrator never contacts a SQL Server. It only reads files you provide and emits scripts you run yourself. Air-gap compatible; no connection strings; no consent prompts.
1204+
1205+
**Triggers:** `/mssql-performance-review`, `/mssql-perf-review`, `/mssql-full-review`, `/sql-triage`
1206+
1207+
**Input:**
1208+
1209+
- A directory containing mixed artifacts (`.sqlplan`, `.sql`, statistics output, wait stats, trace, Query Store, procstats, deadlock XML, ERRORLOG, CLUSTER.LOG, setspn output, hadr DMVs)
1210+
- A list of file paths
1211+
- Inline pasted content blocks with type hints
1212+
- A natural-language symptom description ("CPU is high on prod since 09:00")
1213+
1214+
**Usage:**
1215+
1216+
```
1217+
# Artifact-driven (you have files)
1218+
/mssql-performance-review ./artifacts/
1219+
1220+
# Symptom-driven (you have only a description)
1221+
/sql-triage CPU pegged at 95% on PROD-SQL01 since 09:00 today
1222+
```
1223+
1224+
**What it does:**
1225+
1226+
1. Classifies every input against the 15 specialised skills' input patterns.
1227+
2. Generates 2-3 ranked hypotheses (parameter sniffing, missing index, server-wide I/O, AG failover, deadlock, etc.).
1228+
3. Dispatches the specialised skills in the optimal order (cheap source/breadth first, then deep dive).
1229+
4. Builds an evidence chain for every consolidated finding — each Critical finding cites at least 3 check IDs from 2+ skills, with source artifact, observed value, and threshold.
1230+
5. Runs an **adversarial check** that deliberately tries to disprove the primary root cause — surfaces contradicting evidence rather than suppressing it.
1231+
6. Produces ranked fix recommendations with action, effort, blocking window, risk class, side effects, exact rollback step, and post-deployment verification capture.
1232+
7. Detects recommendation conflicts (e.g., one skill says add index X, another says X is unused).
1233+
8. Tier 3 emits a capture bundle for missing artifacts — scripts you run yourself.
1234+
1235+
**Sample output:** See [`example/mssql-performance-review/mixed-artifacts-analysis.md`](example/mssql-performance-review/mixed-artifacts-analysis.md) for an artifact-first walkthrough; [`example/mssql-performance-review/symptom-first-analysis.md`](example/mssql-performance-review/symptom-first-analysis.md) for the symptom-only triage flow.
1236+
1237+
**When to use this vs the specialised skill directly:**
1238+
1239+
- Use this when you have several artifact types or a symptom and are not sure which skill to run.
1240+
- Use the specialised skill directly when you have one artifact and know which skill it needs (e.g., one `.sqlplan``/sqlplan-review`).
1241+
1242+
The orchestrator does not duplicate the specialised skills — it composes them. The full methodology, hypothesis classes, conflict catalogue, and risk rubric are in [`skills/mssql-performance-review/references/`](skills/mssql-performance-review/references/).
1243+
1244+
---
1245+
11981246
## Thresholds Quick Reference
11991247

12001248
| Metric | Info | Warning | Critical |

0 commit comments

Comments
 (0)