agentleFS
MicrosoftKnown publishermicrosoft/frontier-sre-agent-rvas/labs/02-sql-server-dba/resources/sql-server-mcp/agent/skills/sql-server-dba/SKILL.md

sql-server-dba

Skill9 starsChanged 48 days agoMITView on GitHub

Diagnose SQL Server and Azure SQL with safe native evidence

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

43 rules. About 0 are common, 33 are distinctive, and 10 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈33

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 10

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use native SQL Server and Azure SQL capabilities to discover database structure, monitor health, troubleshoot incidents, identify …

    line 10
  2. Distinctive:

    Before querying a target, require:

    line 19
  3. Very specific:

    Use only these sqlserver-mcp tools for live database work:

    line 38
  4. Distinctive:

    Do not use ODBC, pyodbc, sqlcmd, Azure CLI, PowerShell, Python, shell commands, language drivers, generated programs, or another connector …

    line 47
  5. Distinctive:

    Do not install packages, drivers, or command-line utilities.

    line 51
  6. Distinctive:

    If the connector or required profile is unavailable, stop and report the missing capability.

    line 54
  7. Very specific:

    Call list_profiles and select the named target profile.

    line 62
  8. Distinctive:

    Run bounded native metadata and diagnostic queries.

    line 66
  9. Very specific:

    Use only the configured sqlserver-mcp profile

    line 75
  10. Distinctive:

    Do not request, display, cache, or pass a raw token in conversation

    line 78
  11. Distinctive:

    Never use the SQL-authenticated administrator

    line 80
  12. Very specific:

    Use only a named profile on the same sqlserver-mcp connector

    line 84
  13. Distinctive:

    Do not assume that the Azure SRE Agent UAMI is accepted outside Azure SQL

    line 85
  14. Distinctive:

    Stop when network reachability, trust, or authentication is unresolved

    line 86
  15. Distinctive:

    After connecting, collect only the identifiers needed to choose supported queries:

    line 88
  16. Distinctive:

    Do not run server-scoped queries until the platform and effective permissions show that they are available.

    line 100
  17. Very specific:

    Use run_query with native catalog views to discover:

    line 107
  18. Very specific:

    Do not sample business data unless the user asks and the sample is necessary.

    line 117
  19. Very specific:

    Use get_object when details for one known relation or routine are sufficient.

    line 118
  20. Distinctive:

    Wait type, wait duration, blocking session, and resource

    line 125
  21. Distinctive:

    Use Query Store when it is enabled and readable:

    line 136
  22. Distinctive:

    Consider parameter-sensitive behavior and workload shifts

    line 141
  23. Distinctive:

    If Query Store is unavailable, use live and cached evidence and state that the historical conclusion is limited.

    line 144
  24. Distinctive:

    Wait statistics identify where time accumulated, not root cause by themselves.

    line 161
  25. Very specific:

    When evidence points to query-plan quality, use analyze_query for an estimated plan:

    line 167
  26. Distinctive:

    Check estimates, predicates, join strategies, conversions, spills, and memory grants

    line 171
  27. Distinctive:

    Check whether parameter values or plan changes explain the behavior

    line 173
  28. Distinctive:

    Treat missing-index DMVs as cumulative, volatile suggestions

    line 175
  29. Distinctive:

    Consider write cost, storage, overlap, selectivity, and maintenance cost

    line 176
  30. Distinctive:

    Check statistics metadata and modification counters before attributing stale estimates to statistics

    line 177
  31. Distinctive:

    Use read-only statements and native system objects

    line 190
  32. Very specific:

    Add TOP, time ranges, database filters, or object filters where applicable

    line 193
  33. Distinctive:

    Avoid broad plan-cache extraction and unbounded XML plan retrieval

    line 194
  34. Very specific:

    Use LIMITED or narrowly scoped modes for expensive physical-statistics functions

    line 195
  35. Distinctive:

    Avoid scanning application tables unless the user request requires it

    line 197
  36. Distinctive:

    Do not execute application stored procedures

    line 198
  37. Distinctive:

    Do not expose credentials, tokens, sensitive query parameters, or business data in the response

    line 199
  38. Distinctive:

    Do not claim that a recommendation resolves an issue until a controlled change and post-change measurement demonstrate the result.

    line 234
  39. Distinctive:

    Recommendations: read-only next steps or proposed changes with tradeoffs

    line 244
  40. Distinctive:

    When no bottleneck is demonstrated, say so and identify the observation window and evidence reviewed.

    line 248
  41. Distinctive:

    If authentication fails, distinguish:

    line 253
  42. Distinctive:

    If a system object or column is unavailable, verify the engine, version, and platform-specific documentation.

    line 267
  43. Distinctive:

    If evidence is empty, check capture state, reset time, filters, permissions, and workload activity before concluding that the condition did …

    line 271

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

SQL Server DBA

Overview

Use native SQL Server and Azure SQL capabilities to discover database structure, monitor health, troubleshoot incidents, identify performance bottlenecks, and produce evidence-based tuning recommendations.

This skill is read-only and platform-aware. It does not create database helper objects or treat a recommendation as permission to apply a change.

Prerequisites

Before querying a target, require:

  • The sqlserver-mcp connector assigned explicitly to the custom agent
  • An explicit server or service endpoint and database name
  • A permitted observation scope and time window
  • Required database and performance-state permissions

For Azure SQL, use the Azure SRE Agent user-assigned managed identity through the sqlserver-mcp connection. The MCP workload identity must exist as a contained Microsoft Entra user in the target database and hold the approved read-only role. Azure RBAC alone does not grant SQL data-plane access.

For SQL Server outside Azure SQL, use only an approved connection and authentication profile exposed by sqlserver-mcp. If none exists, report the missing prerequisite. Never substitute the SQL administrator, request a password, or invent another authentication method.

Exclusive Tool Contract

Use only these sqlserver-mcp tools for live database work:

ToolUse
list_profilesDiscover allowlisted targets and select the correct profile
get_objectRetrieve native metadata for one relation or routine
run_queryRun bounded, parameterized, parser-validated read-only T-SQL
analyze_queryCompile and summarize an estimated execution plan without running workload

Do not use ODBC, pyodbc, sqlcmd, Azure CLI, PowerShell, Python, shell commands, language drivers, generated programs, or another connector to open or query a database.

Do not install packages, drivers, or command-line utilities. Do not construct or handle connection strings, passwords, or access tokens.

If the connector or required profile is unavailable, stop and report the missing capability. A failed MCP call is evidence to troubleshoot, not permission to attempt another connection path.

Quick Start

  1. Confirm the target server, database, user objective, incident time window, and whether production query execution is permitted.
  2. Call list_profiles and select the named target profile.
  3. Identify the engine edition, product version, database, compatibility level, and available permissions with a bounded run_query call.
  4. Select the smallest diagnostic path that answers the request.
  5. Run bounded native metadata and diagnostic queries.
  6. Correlate evidence before identifying a cause.
  7. Report findings, limitations, recommendations, and confirmation that no changes were applied.

Connection and Capability Discovery

For Azure SQL:

  • Use only the configured sqlserver-mcp profile
  • Require the logical server fully qualified domain name and database name
  • Let the MCP service acquire and apply the Azure SQL token
  • Do not request, display, cache, or pass a raw token in conversation
  • Rely on the MCP connection policy for encryption and certificate validation
  • Never use the SQL-authenticated administrator

For other SQL Server deployments:

  • Use only a named profile on the same sqlserver-mcp connector
  • Do not assume that the Azure SRE Agent UAMI is accepted outside Azure SQL
  • Stop when network reachability, trust, or authentication is unresolved

After connecting, collect only the identifiers needed to choose supported queries:

  • SERVERPROPERTY('EngineEdition')
  • SERVERPROPERTY('ProductVersion')
  • SERVERPROPERTY('ProductLevel')
  • SERVERPROPERTY('Edition')
  • DB_NAME()
  • Database compatibility level
  • Query Store state
  • Effective database performance-state permissions

Do not run server-scoped queries until the platform and effective permissions show that they are available.

Diagnostic Workflow

Understand database structure

Use run_query with native catalog views to discover:

  • Schemas, tables, views, and programmable objects
  • Columns, data types, nullability, defaults, and computed columns
  • Primary keys, unique constraints, checks, and foreign keys
  • Index keys, included columns, filters, and disabled state
  • Declared dependencies between objects

Build entity relationships from declared primary and foreign keys. Label relationships inferred from naming or query behavior as inferred, not declared. Do not sample business data unless the user asks and the sample is necessary. Use get_object when details for one known relation or routine are sufficient.

Establish current activity

Inspect bounded current activity for:

  • Active requests and sessions
  • Wait type, wait duration, blocking session, and resource
  • Open transactions and transaction age
  • Locks involved in an active blocking chain
  • Query text and available plans
  • Memory grants and spills where evidence exists

Capture observation timestamps in UTC. Current-state DMVs are point-in-time evidence and must not be described as historical trends.

Analyze historical query performance

Use Query Store when it is enabled and readable:

  • Compare runtime intervals rather than lifetime averages alone
  • Identify regressions in duration, CPU, reads, writes, and execution count
  • Compare plans and plan changes for the same query
  • Consider parameter-sensitive behavior and workload shifts
  • Record Query Store capture state and observation interval

If Query Store is unavailable, use live and cached evidence and state that the historical conclusion is limited. Do not enable or reconfigure Query Store.

Investigate resource bottlenecks

Correlate workload evidence across relevant categories:

  • CPU pressure and expensive queries
  • Data and log I/O latency
  • Database and server waits
  • Blocking, lock escalation, and deadlocks
  • Memory grants, concurrency, and spills
  • Tempdb usage and contention
  • Transaction-log usage and long-running transactions
  • Storage, database size, and growth
  • Azure SQL resource-governance and service-tier limits

Wait statistics identify where time accumulated, not root cause by themselves. Account for scope, reset time, benign waits, platform filtering, and the observation window.

Evaluate plans, indexes, and statistics

When evidence points to query-plan quality, use analyze_query for an estimated plan:

  • Correlate estimated-plan evidence with Query Store or existing runtime data
  • Check estimates, predicates, join strategies, conversions, spills, and memory grants
  • Check whether parameter values or plan changes explain the behavior
  • Evaluate existing indexes before proposing another one
  • Treat missing-index DMVs as cumulative, volatile suggestions
  • Consider write cost, storage, overlap, selectivity, and maintenance cost
  • Check statistics metadata and modification counters before attributing stale estimates to statistics

analyze_query does not execute the submitted workload. Do not seek another tool or connection method to obtain an actual plan.

See native diagnostics for the preferred system surfaces and platform notes.

Query Safety Rules

Apply these rules to every SQL query:

  • Use read-only statements and native system objects
  • Fully qualify system objects with the sys schema
  • Select named columns instead of SELECT *, especially from DMVs
  • Add TOP, time ranges, database filters, or object filters where applicable
  • Avoid broad plan-cache extraction and unbounded XML plan retrieval
  • Use LIMITED or narrowly scoped modes for expensive physical-statistics functions
  • Avoid scanning application tables unless the user request requires it
  • Do not execute application stored procedures
  • Do not expose credentials, tokens, sensitive query parameters, or business data in the response

Never execute:

  • INSERT, UPDATE, DELETE, MERGE, or bulk data operations
  • CREATE, ALTER, DROP, TRUNCATE, or permission changes
  • Index rebuilds, reorganizations, creation, or removal
  • Statistics updates
  • Query Store plan forcing, hints, capture changes, or cleanup
  • Configuration changes, failovers, backup, restore, or maintenance commands
  • Creation of monitoring views, procedures, tables, functions, jobs, or Extended Events sessions

Existing Extended Events sessions and targets may be read when the tool, platform, and permissions support safe access.

Evidence Standard

Classify every important statement as one of:

  • Observation supported by returned evidence
  • Interpretation consistent with the evidence
  • Hypothesis requiring additional evidence
  • Recommendation not yet applied

For each finding, record:

  • Target and UTC observation window
  • Native source and relevant identifiers
  • Measured value or returned state
  • Expected impact
  • Alternative explanations
  • Evidence needed to confirm the cause

Do not claim that a recommendation resolves an issue until a controlled change and post-change measurement demonstrate the result.

Response Format

Return:

  1. Scope: target, platform, database, time window, and permissions
  2. Findings: impact-ranked observations with native evidence
  3. Analysis: interpretation, correlations, and uncertainties
  4. Recommendations: read-only next steps or proposed changes with tradeoffs
  5. Limitations: unavailable evidence, permissions, or platform constraints
  6. Change status: state that no database changes were applied

When no bottleneck is demonstrated, say so and identify the observation window and evidence reviewed. Do not manufacture an issue to satisfy the request.

Troubleshooting

If authentication fails, distinguish:

  • Azure SRE Agent to MCP managed identity or audience failure
  • MCP target profile missing or unavailable
  • Network or DNS reachability
  • TLS or certificate validation
  • Microsoft Entra token or identity failure
  • Missing contained database user
  • Login accepted but database access denied
  • Required DMV permission denied

Return the exact failure without exposing secrets. Do not retry with broader credentials or another database client.

If a system object or column is unavailable, verify the engine, version, and platform-specific documentation. Use a supported alternative or report the limitation. Do not guess a replacement column.

If evidence is empty, check capture state, reset time, filters, permissions, and workload activity before concluding that the condition did not occur.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.