query-optimizer

query-optimizer is a skill for Claude Code from sdebruyn/fabric-dw-mcp-cli. It costs 103 tokens per session (1,590 once invoked), scanned A, original, MIT.

A query-analysis workflow for Microsoft Fabric Data Warehouse, a cloud system for storing and querying data. It examines how a SQL query is expected to run and suggests or applies changes to improve it.

In plain words
What is it for?
Use it to investigate and optimize SQL queries, review execution plans and query history, and check data-clustering settings.
Why use it?
It helps identify slow parts of a query, such as costly operations or missing and outdated statistics, instead of relying on guesswork.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Part of the fabric-dw plugin — 3 skills shipped together

Good fit Use it to investigate and optimize SQL queries, review execution plans and query history, and check data-clustering settings.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/sdebruyn/fabric-dw-mcp-cli/query-optimizer
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add sdebruyn/fabric-dw-mcp-cli --skill query-optimizer
Clone the repo
git clone --depth 1 https://github.com/sdebruyn/fabric-dw-mcp-cli

Made for: Claude Code.

Or install fabric-dw, the plugin that ships this one along with the rest of its 3 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for query-optimizer

README.md
[![agentmods](https://agentmods.dev/badge/skills/sdebruyn/fabric-dw-mcp-cli/query-optimizer/github.svg)](https://agentmods.dev/skills/sdebruyn/fabric-dw-mcp-cli/query-optimizer)
Your own site
<a href="https://agentmods.dev/skills/sdebruyn/fabric-dw-mcp-cli/query-optimizer"><img src="https://agentmods.dev/badge/skills/sdebruyn/fabric-dw-mcp-cli/query-optimizer/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for query-optimizer

Your own site · 80×15
<a href="https://agentmods.dev/skills/sdebruyn/fabric-dw-mcp-cli/query-optimizer"><img src="https://agentmods.dev/badge/skills/sdebruyn/fabric-dw-mcp-cli/query-optimizer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 103 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,590 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Excessive Agency · line 124
    Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.
    Fix: Add human-in-the-loop confirmation for destructive, irreversible, or high-impact operations. Never auto-execute commands that modify files, send data, or alter system state.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00103 $0.01590
Opus 5.5 $0.00041 $0.00636
Sonnet 5.5 $0.00021 $0.00318
Haiku 4.5 $0.00010 $0.00159

Measured 1mo ago against content hash c85ec084d5ef, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

query-optimizer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/fabric-dw/skills/query-optimizer/SKILL.md · 128 lines

How it starts

The opening of the file, as written. The whole thing — 128 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Query Performance Analysis & Optimization

Analyzes and optimizes a query on a Fabric Data Warehouse using the fabric-dw MCP tools.

Inputs

Gather these from the user (via $ARGUMENTS or natural language) before starting:

  • workspace: workspace name or GUID
  • warehouse: warehouse name or GUID (must be a Fabric Data Warehouse, not a SQL Analytics Endpoint, for clustering steps)
  • query: the SQL query text to analyze (or a historical query ID / text snippet to look up)

If the warehouse is a SQL Analytics Endpoint, skip steps 8, 9, 11 (clustering), and 13 (set_cluster_columns).

Workflow

Step 1 - Capture the estimated execution plan

Call get_query_plan with the query text. This returns a SHOWPLAN_XML document without executing the query.

To visualize the plan, use the CLI (pass the warehouse name as the first argument and the query via -q):

fdw sql plan <warehouse> -q "<query>" --format html -o plan.html   # writes self-contained HTML; open plan.html in any browser
fdw sql plan <workspace>/<warehouse> -q "<query>" --format svg -o plan.svg   # renders SVG via system dot binary (requires Graphviz)

Note: --format html requires -o/--output; it writes a file and does not open the browser automatically.

Step 2 - Parse the plan XML

Analyze the returned SHOWPLAN_XML for:

  • Costly operators: Hash Join, Sort, nested-loop Scan on large row estimates, Spool
  • Residual predicates: predicates that cannot be applied early (non-SARGable)
  • Missing-index hints embedded in the plan
  • Data skew warnings or large estimated vs. actual row count mismatches (if available)
  • Type mismatch conversions: e.g. CONVERT_IMPLICIT on a column used in a predicate

Step 3 - Pull recent history

Use list_request_history (filter by SQL text substring if supported) and list_long_running_queries to see whether this query pattern has a history of slow executions. Note elapsed time and status.

Step 4 - List statistics on referenced tables

Read the full file on GitHub · 128 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 128 lines · 103 tokens per session scan A c85ec084d5ef

Subscribe to this mod's changes

query-optimizer is a skill published in the GitHub repository sdebruyn/fabric-dw-mcp-cli (10 stars, last pushed 9d ago), licensed MIT. It adds 103 tokens to every session and 1,590 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

nosql-database-design

Designs a NoSQL data model by leading with access pattern analysis. Covers DynamoDB single-table design (PK/SK/GSI) and MongoDB embedding vs referencing, consistency models, and capacity planning. Invoked when the user asks to design a DynamoDB schema, MongoDB data model, or NoSQL data model.

soulcodex/agentic · 71 tokens

relational-database-design

Designs or reviews a relational database schema for a given domain. Covers table structure, normalization, indexes, constraints, and migration strategy. Invoked when the user asks to design a schema, review a database structure, or optimize a data model.

soulcodex/agentic · 55 tokens

sql-query-optimization

Diagnoses and optimises slow SQL queries using EXPLAIN ANALYZE. Covers identifying bottlenecks (sequential scans, bad estimates, heap fetches), index strategy, query rewrites, and verification. Invoked when the user asks to optimize a query, fix a slow database query, or improve database performance.

soulcodex/agentic · 70 tokens

erd-studio-setup

Friendly, step-by-step setup for ERD Studio in an existing dbt project, for people who may be new to dbt or data modelling. By default a quick start: checks the dbt CLI, draws one business area as an ERD Studio logical model that mirrors dbt, checks it with the ERD Studio diff until logical matches physical and opens…

liam-machine/erd-studio · 247 tokens

bitable

Access Lark Bitable databases - list tables, view fields, and read records. Use when user asks about a Bitable, database, or wants to query structured data.

yjwong/lark-cli · 38 tokens

database-verification

Shell-based database connectivity and integrity checks. Verifies that databases are reachable, schemas match expectations, and data integrity constraints hold.

vladkesler/initrunner · 29 tokens