← 返回 Skills 市场
vince-winkintel

Sql Server Skills

作者 Vince Lozada · GitHub ↗ · v1.0.0
cross-platform ⚠ suspicious
284
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install sql-server-skills
功能描述
Expertise in diagnosing SQL Server performance issues, analyzing indexes, interpreting execution plans, optimizing queries, managing schema, backups, and mon...
使用说明 (SKILL.md)

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-Skill Path Use When
Diagnostics sqlserver-diagnostics/SKILL.md Server is slow — find the bottleneck (wait stats, slow queries, active requests)
Indexes sqlserver-indexes/SKILL.md Find missing indexes, fix fragmentation, drop unused indexes
Execution Plans sqlserver-execution-plans/SKILL.md Read and interpret query execution plans, spot bad operators
Query Optimization sqlserver-query-optimization/SKILL.md Fix stored procedures, views, anti-patterns, parameter sniffing
Schema sqlserver-schema/SKILL.md CREATE/ALTER TABLE, migrations, constraints, data types
Backup/Restore sqlserver-backup/SKILL.md BACKUP DATABASE, RESTORE, check backup history
Monitoring sqlserver-monitoring/SKILL.md SQL 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
安全使用建议
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.
功能分析
Type: OpenClaw Skill Name: sql-server-skills Version: 1.0.0 The bundle is a comprehensive and well-documented set of SQL Server DBA tools for performance diagnostics, schema management, and monitoring. It utilizes standard T-SQL Dynamic Management Views (DMVs) and the 'sqlcmd' utility to perform its functions. Security is proactively addressed through a dedicated SECURITY.md file, the principle of least privilege, and explicit instructions (in SKILL.md and blocking-analysis.sql) forbidding the autonomous execution of destructive commands like 'KILL'. No evidence of data exfiltration, obfuscation, or malicious prompt injection was found; the included bash script (build-claude-skill.sh) is a standard utility for packaging the skill for different platforms.
能力评估
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.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install sql-server-skills
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /sql-server-skills 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release — comprehensive SQL Server performance diagnostics, DMV queries, execution plan analysis, index management, and query optimization for AI agents.
元数据
Slug sql-server-skills
版本 1.0.0
许可证
累计安装 1
当前安装数 1
历史版本数 1
常见问题

Sql Server Skills 是什么?

Expertise in diagnosing SQL Server performance issues, analyzing indexes, interpreting execution plans, optimizing queries, managing schema, backups, and mon... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 284 次。

如何安装 Sql Server Skills?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install sql-server-skills」即可一键安装,无需额外配置。

Sql Server Skills 是免费的吗?

是的,Sql Server Skills 完全免费(开源免费),可自由下载、安装和使用。

Sql Server Skills 支持哪些平台?

Sql Server Skills 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Sql Server Skills?

由 Vince Lozada(@vince-winkintel)开发并维护,当前版本 v1.0.0。

💬 留言讨论