Sql Server Skills

v1.0.0

Expertise in diagnosing SQL Server performance issues, analyzing indexes, interpreting execution plans, optimizing queries, managing schema, backups, and mon...

0· 273·1 current·1 all-time
byVince Lozada@vince-winkintel
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Suspicious
medium confidence
Purpose & Capability
The name and description match the actual content: T-SQL DMV scripts, index/schema guidance, execution plan help, and sqlcmd examples. Requiring SQL connection credentials is appropriate for this purpose. However the registry metadata at the top of the evaluation lists no required env vars while the SKILL.md frontmatter explicitly declares credentials (SQL_SERVER, SQL_USER, SQL_PASSWORD). That mismatch is an incoherence in packaging/metadata that should be resolved before trusting automatic wiring of credentials.
!
Instruction Scope
Runtime instructions tell the agent to run local sqlcmd with the provided credentials and to execute numerous DMV/read-only scripts — this is expected. But the examples and commands reference an environment variable SQL_DATABASE in multiple places that is not declared in the SKILL.md credentials block (only SQL_SERVER/SQL_USER/SQL_PASSWORD are declared). The skill also contains scripts and guidance that propose ALTER INDEX and other DDL operations (these are declared in the write_access section, but such actions are powerful). The KILL command appears commented and is explicitly warned against, which is good, but the presence of destructive/DDL SQL in the repo means you must ensure the agent never runs those autonomously.
Install Mechanism
There is no install spec and the skill is instruction+script only, which minimizes supply-chain risk. The included build script only merges SKILL.md files and zips them locally; it does not download or execute remote code. The README mentions git/github release URLs (for manual install) but the skill itself does not perform downloads during runtime.
Credentials
Requesting SQL connection credentials (server/username/password) is proportional to performing SQL diagnostics. The SKILL.md also describes appropriate least-privilege permissions in SECURITY.md. That said, the earlier registry metadata showing 'no required env vars' contradicts the skill frontmatter. Also an example uses SQL_DATABASE which is not declared; confirm exactly which env vars the platform will provide before installing.
Persistence & Privilege
The skill is not marked always:true and does not request any system-level persistence. It contains no mechanism to modify other skills or global agent configuration. Autonomous invocation is allowed by default (disable-model-invocation is false) — that is normal but combined with DDL/write capabilities it means you should control when it runs and with which credentials.
What to consider before installing
This skill looks functionally consistent with being a SQL Server diagnostics toolkit, but there are a few red flags to check before installing or running it: - Metadata mismatch: the registry metadata lists no required env vars, but the SKILL.md declares SQL_SERVER, SQL_USER, and SQL_PASSWORD. Confirm your platform will present those credentials to the skill and won't silently run without them. - Undeclared env var: examples use SQL_DATABASE (e.g. -d "$SQL_DATABASE") which is not listed in the declared credentials. If your environment does not provide SQL_DATABASE, the example commands may fail or use defaults you don't expect. Ensure all needed variables are declared/provided. - Dangerous operations present: most supplied scripts are read-only DMVs, but there are separate sub-skill sections and scripts that produce ALTER INDEX, DROP or DDL statements and the KILL command is present (commented). Do NOT allow the agent to run these write/DDL scripts autonomously. Use a least-privilege monitoring login (VIEW SERVER STATE / VIEW DATABASE STATE, etc.) and avoid giving sysadmin privileges to the agent. - Operational controls: restrict this skill to user-invoked runs or require human approval before executing any non-read-only commands. Audit and review any generated CREATE/ALTER/DROP statements before applying them. If you want to proceed: validate the declared env vars on your platform (add SQL_DATABASE if needed), create a dedicated monitoring account with minimal permissions described in SECURITY.md, and ensure the agent is prevented from autonomously executing DDL or KILL commands.

Like a lobster shell, security has layers — review code before you run it.

latestvk9744cdn522wp9663cjpwpy5zd82dca3
273downloads
0stars
1versions
Updated 1mo ago
v1.0.0
MIT-0

SQL Server Skills

Comprehensive SQL Server skill for AI agents. Covers performance diagnostics, index analysis, execution plan interpretation, query optimization, schema management, backup/restore, and monitoring — all via sqlcmd and T-SQL DMVs.


Requirements

  • sqlcmdMicrosoft Download
  • SQL Server 2016+ — All DMV queries target compatibility level 130+
  • PermissionsVIEW SERVER STATE for most DMV queries; sysadmin or db_owner for some operations

Quick Connect

# Windows Authentication (domain-joined machine)
sqlcmd -S "$SQL_SERVER" -E

# SQL Authentication
sqlcmd -S "$SQL_SERVER" -U "$SQL_USER" -P "$SQL_PASSWORD" -d "$SQL_DATABASE"

# Named instance + specific database
sqlcmd -S "$SQL_SERVER" -U "$SQL_USER" -P "$SQL_PASSWORD" -d "$SQL_DATABASE"

# Run a diagnostic script
sqlcmd -S "$SQL_SERVER" -U "$SQL_USER" -P "$SQL_PASSWORD" -d master -i scripts/top-slow-queries.sql

# Run with output to file
sqlcmd -S "$SQL_SERVER" -U "$SQL_USER" -P "$SQL_PASSWORD" -d master -i scripts/wait-stats.sql -o results.txt -s "," -W

Skill Organization

Sub-SkillPathUse When
Diagnosticssqlserver-diagnostics/SKILL.mdServer is slow — find the bottleneck (wait stats, slow queries, active requests)
Indexessqlserver-indexes/SKILL.mdFind missing indexes, fix fragmentation, drop unused indexes
Execution Planssqlserver-execution-plans/SKILL.mdRead and interpret query execution plans, spot bad operators
Query Optimizationsqlserver-query-optimization/SKILL.mdFix stored procedures, views, anti-patterns, parameter sniffing
Schemasqlserver-schema/SKILL.mdCREATE/ALTER TABLE, migrations, constraints, data types
Backup/Restoresqlserver-backup/SKILL.mdBACKUP DATABASE, RESTORE, check backup history
Monitoringsqlserver-monitoring/SKILL.mdSQL Agent jobs, error log, blocking, deadlocks, long-running transactions

Decision Tree — What Are You Trying To Do?

Is the server slow or a query timing out?
├── I don't know WHERE the bottleneck is → sqlserver-diagnostics
│   └── Start with wait-stats.sql, then top-slow-queries.sql
│
├── I have a specific slow query → sqlserver-execution-plans
│   └── Capture the plan, identify bad operators
│
├── I suspect missing or broken indexes → sqlserver-indexes
│   └── Run missing-indexes.sql + index-fragmentation.sql
│
└── I want to rewrite/fix bad T-SQL code → sqlserver-query-optimization
    └── Check anti-patterns: cursors, non-SARGable, DELETE+INSERT loops

Is there a blocking/locking issue?
└── sqlserver-monitoring (blocking-analysis.sql)

Do I need to change the schema?
└── sqlserver-schema

Do I need to backup or restore a database?
└── sqlserver-backup

Do I need to check SQL Agent jobs or the error log?
└── sqlserver-monitoring

Common Workflows

Workflow 1: Server Is Slow — Start Here

# Step 1: What is SQL Server waiting on?
sqlcmd -S "$SQL_SERVER" -U "$SQL_USER" -P "$SQL_PASSWORD" -d master -i scripts/wait-stats.sql

# Step 2: Which queries are consuming the most resources?
sqlcmd -S "$SQL_SERVER" -U "$SQL_USER" -P "$SQL_PASSWORD" -d master -i scripts/top-slow-queries.sql

# Step 3: What's running right now?
sqlcmd -S "$SQL_SERVER" -U "$SQL_USER" -P "$SQL_PASSWORD" -d master -i scripts/active-queries.sql

Then read sqlserver-diagnostics/SKILL.md to interpret results.


Workflow 2: Optimize a Specific Query

-- Step 1: Capture I/O and time stats
SET STATISTICS IO ON;
SET STATISTICS TIME ON;
GO
-- paste your query here
GO

-- Step 2: Get XML execution plan
SET STATISTICS XML ON;
GO
-- paste your query here
GO
SET STATISTICS XML OFF;

Then read sqlserver-execution-plans/SKILL.md to interpret the plan.


Workflow 3: Monthly Index Maintenance

# Find missing indexes (sorted by impact score)
sqlcmd -S "$SQL_SERVER" -U "$SQL_USER" -P "$SQL_PASSWORD" -d "$SQL_DATABASE" -i scripts/missing-indexes.sql

# Check fragmentation
sqlcmd -S "$SQL_SERVER" -U "$SQL_USER" -P "$SQL_PASSWORD" -d "$SQL_DATABASE" -i scripts/index-fragmentation.sql

# Find unused indexes costing write overhead
sqlcmd -S "$SQL_SERVER" -U "$SQL_USER" -P "$SQL_PASSWORD" -d "$SQL_DATABASE" -i scripts/unused-indexes.sql

See sqlserver-indexes/SKILL.md for interpretation and the rebuild/reorganize decision.


Workflow 4: Investigate Blocking

# Run blocking analysis
sqlcmd -S "$SQL_SERVER" -U "$SQL_USER" -P "$SQL_PASSWORD" -d master -i scripts/blocking-analysis.sql

See sqlserver-monitoring/SKILL.md for deadlock investigation and KILL guidance.


Sub-Skill Quick Reference

  • sqlserver-diagnostics/SKILL.md — DMV-based bottleneck analysis (most important starting point)
  • sqlserver-indexes/SKILL.md — Full index lifecycle: find, fix, maintain, drop
  • sqlserver-execution-plans/SKILL.md — Read plans, spot table scans, fix key lookups
  • sqlserver-query-optimization/SKILL.md — Stored proc rewrites, anti-patterns, hints
  • sqlserver-schema/SKILL.md — DDL patterns, migrations, data type guidance
  • sqlserver-backup/SKILL.md — Backup/restore commands and history queries
  • sqlserver-monitoring/SKILL.md — Jobs, error log, blocking, deadlocks

Comments

Loading comments...