# SQL Rig: SQL Server Toolkit for AI Agents

> The full SQL Rig kit: 47 tested files that keep your AI agent safe on SQL Server, from multi-step Agent jobs and linked servers to batched deletes and index maintenance.

SQL Rig: SQL Server Toolkit for AI Agents is a paid AI agent skill on Agensi by Scott Coffey, in Data & Databases. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $49 (one-time purchase)
- Creator: [Scott Coffey](https://www.agensi.io/creators/scott-coffey)
- Category: [Data & Databases](https://www.agensi.io/skills/data-databases)
- Version: 1.3
- Last updated: 2026-11-02
- Security: scan passed (2026-11-02); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/sql-rig-sql-server-toolkit-for-ai-agents
- Tags: database, devops, code-review, sql-server, t-sql, mssql, dba, powershell

## About this skill

SQL Rig is the toolkit I use to let AI agents work on production-adjacent SQL Server without guessing. It gives the agent strict rules, a task prompt for each common job, and tested T-SQL and PowerShell to start from. Every write defaults to dry run, every create is idempotent, and every script header states purpose, minimum version, permissions, and rollback.

**What it does**

- Loads DBA rules and a forbidden-patterns list. The agent rejects and rewrites output that matches a known bad pattern.
- Routes each request to a task prompt with defined steps and deliverables: blocking, Agent jobs, linked servers, proc refactors, index review, backup and restore, security audit.
- Starts from tested scripts instead of improvised SQL, and gives rollback steps for every change.

**What's included (47 files)**

- Prompts (10): DBA system prompt, Cursor rules, CLAUDE.md block, and 7 task prompts.
- T-SQL (19): blocking chains, expensive queries (plan cache and Query Store), wait stats delta, Agent job inventory and template, multi-step Agent jobs (T-SQL, PowerShell, and CmdExec steps with explicit success and failure flow), failure alerts and operators, linked-server add, test, and OPENQUERY patterns, batched DELETE and UPDATE with row caps, idempotent upsert, safe stored procedure template, least-privilege permission checks, orphaned users, unused indexes, sampled fragmentation with REORGANIZE or REBUILD plans, statistics maintenance, surface-area audit.
- PowerShell (7): smoke test, backup with CHECKSUM and VERIFYONLY, Agent job export, script-folder runner with per-file transactions, blocking snapshot to CSV or JSON, linked-server test, Agent alert installer. All support -WhatIf and never hardcode passwords.
- Guardrails (4): production safety rules, forbidden patterns, human review checklist, rollback templates.
- SQL Server 2025 vector preview (3): version-gated VECTOR column and DiskANN demo, RAG retrieval prompt, and notes that stop the agent from inventing vector syntax.
- Quickstart, changelog, license.

**Requirements**

- SQL Server 2016 or later, or Azure SQL Managed Instance. Most scripts target 2019 and later; headers state the minimum. Vector files need SQL Server 2025 or Azure SQL.
- PowerShell 5.1 or later. The SqlServer module and dbatools are optional.
- You run the scripts yourself. The skill never connects to a server.

Updates ship through Agensi to every buyer. Built by Scott Coffey, sqlrig.com.

## Requires

- SSMS, sqlcmd, or Azure Data Studio
- PowerShell 5.1+
- Optional: SqlServer module
- Optional: dbatools

## Known limitations

Requires manual execution in SSMS or Azure Data Studio. SQL Server 2025 vector features are in preview. Requires Windows, Entra ID, or secret store for auth; no hardcoded passwords.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the SQL Rig: SQL Server Toolkit for AI Agents skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### Does the skill connect to my server?

No. It gives the agent rules and scripts; you run them.

### Will it change anything without asking?

No. Writes default to @DryRun = 1 or -WhatIf, and destructive actions require explicit confirmation.

### Is dbatools required?

No. It is optional everywhere.

### How do updates work?

New versions go to every buyer through Agensi.

### Team use?

One purchase per person.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
