Author, validate, and test Power Query M expressions in semantic model partitions.

GPL-3.0Auto-check passedDatabases

Install Power Query

skills CLI
$ npx skills add data-goblin/power-bi-agentic-development --skill power-query -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install data-goblin/power-bi-agentic-development power-query --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/data-goblin/power-bi-agentic-development.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/semantic-models/skills/power-query .claude/skills/power-query && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
power-query
GitHub stars
1k
Token cost
~2.2k tokens
SKILL.md length
753 words
Files
5 (incl. references)
Skills in repo
33
Repo updated
First seen
Licence
GPL-3.0

At a glance

Author, validate, and test Power Query M expressions in semantic model partitions.

  • Works in 2 steps: Execute via the Power Query API… → Save the Partition via XMLA / TOM
  • Mentions Power Query
  • SKILL.md covers Partition Expressions, Writing M Expressions, Validating M Expressions and Previewing Partition Steps, plus 2 more sections
  • Runs Python scripts from its folder; calls curl and jq

What it does

Power Query is an agent skill from data-goblin/power-bi-agentic-development. Author, validate, and test Power Query M expressions in semantic model partitions. Automatically invoke when the user mentions "Power Query", "M code", "M expression", "partition expression", "query folding", or asks to "write Power Query", "fix Power Query", "test a partition", "preview partition data", "debug Power Query step", "optimize Power Query".

Its SKILL.md is about 2.2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 6 other files, including reference files (for example `examples/execute_m.py`, `examples/preview_partition.py` and `references/best-practices.md`).

It sits in Databases. It works with SQL. The repository describes itself as: Power BI AI skills and Power BI agents for Claude Code and GitHub Copilot: a plugin marketplace of Power BI skills, subagents, and hooks for semantic models, DAX, TMDL, reports… The licence is GPL-3.0.

When your agent uses it

  • Mentions Power Query
  • Partition expression
  • Asks to write Power Query
  • Fix Power Query

Example prompts

  • “Power Query”
  • “M code”
  • “M expression”
  • “/power-query”

Requirements

  • Python 3

Workflow steps

2 steps, taken from the step headings in SKILL.md.

  1. Execute via the Power Query API (Recommended)
  2. Save the Partition via XMLA / TOM

What it can do on your machine

Read from SKILL.md and the folder at commit 41886f2. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • curl
    • jq

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • learn.microsoft.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Power Query loads about 2.2k tokens when it runs, and up to ~7.1k if it reads all its reference files. Until then it costs about 92 tokens; SKILL.md has 753 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~92
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~7.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from data-goblin/power-bi-agentic-development at commit 41886f2, republished under its GPL-3.0 licence (© data-goblin). 753 words, ~2,236 tokens.

Download SKILL.mdSave it as .claude/skills/power-query/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.
name
power-query
description
Author, validate, and test Power Query M expressions in semantic model partitions. Automatically invoke when the user mentions "Power Query", "M code", "M expression", "partition expression", "query folding", or asks to "write Power Query", "fix Power Query", "test a partition", "preview partition data", "debug Power Query step", "optimize Power Query".

Power Query for Semantic Models

Author, validate, and test Power Query M expressions in semantic model import partitions. Covers writing correct M code, preserving query folding, validating expressions, and testing them by executing against real data sources.

Partition Expressions

Each import table in a semantic model has a partition with an M expression defining what data gets loaded during refresh. The expression typically connects to a data source, navigates to a table/view, and applies transformations.

Structure of a Partition Expression
let
    Source = Sql.Database(#"SqlEndpoint", #"Database"),
    Data = Source{[Schema="dbo", Item="Orders"]}[Data],
    #"Removed Columns" = Table.RemoveColumns(Data, {"InternalId"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Removed Columns", {{"Amount", Currency.Type}})
in
    #"Changed Type"

Key elements:

  • Parameters: #"SqlEndpoint", #"Database" are shared M parameters defined at the model level
  • Navigation: Source{[Schema="dbo", Item="Orders"]}[Data] navigates to a specific table
  • Steps: Each step is a named variable in the let...in chain
  • Quoted identifiers: Step names with spaces use #"Step Name" syntax
Extracting Expressions
bash
# Get partition expression from TMDL via fab
fab get "<Workspace>.Workspace/<Model>.SemanticModel" -f \
  -q "definition.parts[?path=='definition/tables/<Table>.tmdl'].payload"

# Get shared M parameters
fab get "<Workspace>.Workspace/<Model>.SemanticModel" -f \
  -q "definition.parts[?path=='definition/expressions.tmdl'].payload"

Writing M Expressions

Query Folding

Query folding is the most important performance concept. The M engine translates compatible steps into native data source queries (e.g., SQL). When folding breaks, subsequent steps run in the mashup engine, pulling all data into memory first.

Steps that typically fold (for SQL sources):

  • Table.SelectColumns / Table.RemoveColumns -> SELECT
  • Table.SelectRows -> WHERE
  • Table.Sort -> ORDER BY
  • Table.FirstN -> TOP
  • Table.Group -> GROUP BY
  • Table.RenameColumns -> AS aliases

Steps that may or may not fold (source-dependent):

  • Table.TransformColumnTypes -- frequently breaks folding for text-to-numeric/date conversions on SQL Server sources. Use Table.TransformColumns with explicit conversion functions (e.g., Number.From) as a more reliable foldable alternative.

Steps that break folding:

  • Table.AddColumn with custom M functions (not translatable to SQL)
  • Table.Buffer (forces materialization; prefer Table.StopFolding to stop folding without the memory overhead)
  • Table.LastN (no SQL equivalent without subquery)
  • Table.Combine across different data sources (cross-database folding within the same SQL Server is possible via EnableCrossDatabaseFolding)
  • Complex each expressions with M-specific logic
  • Any step after a fold-breaking step

Best practice: Apply folding-compatible steps (filter, select, type) early; add custom columns and M-only transforms after all foldable work is done.

Column Pruning and Row Filtering

Remove unused columns and filter rows as early as possible:

let
    Source = Sql.Database(SqlEndpoint, Database),
    Data = Source{[Schema="dbo", Item="Orders"]}[Data],
    // Filter and select BEFORE any custom transforms
    #"Filtered" = Table.SelectRows(Data, each [Status] <> "Cancelled"),
    #"Selected" = Table.SelectColumns(#"Filtered", {"OrderId", "Date", "Amount", "CustomerId"})
in
    #"Selected"

These steps fold to SQL: SELECT OrderId, Date, Amount, CustomerId FROM dbo.Orders WHERE Status <> 'Cancelled'

Type Handling
  • Apply Table.TransformColumnTypes early (folds to CAST in SQL)
  • Use explicit M types: Int64.Type, type text, type date, Currency.Type, type logical
  • Avoid implicit type inference on large datasets
Naming Conventions
  • Step names should describe the transformation: #"Removed Duplicates", #"Filtered Active"
  • Avoid generic names like #"Custom1" or #"Step1"
  • Use quoted identifiers #"Name" for steps with spaces (Power Query convention)

Validating M Expressions

Two approaches to validate that an M expression is syntactically correct and produces expected results:

Show full SKILL.md (343 more words)Show less

Test the expression by running it against real data. This validates syntax, data source connectivity, and transformation correctness in one step.

The full workflow, run by the bundled examples/execute_m.py:

  1. Create or reuse a runner dataflow in the workspace
  2. Bind the data source connection to the runner
  3. Wrap the expression in a section document, inline parameters
  4. Execute via POST /v1/workspaces/{wsId}/dataflows/{dfId}/executeQuery
  5. Parse the Arrow response to verify data
bash
MASHUP='section Section1;
shared SqlEndpoint = "myserver.database.windows.net";
shared Database = "MyDB";
shared Result = let
    Source = Sql.Database(SqlEndpoint, Database),
    Data = Table.FirstN(Source{[Schema="dbo",Item="Orders"]}[Data], 10)
in Data;'

curl -s -o result.bin -X POST ".../executeQuery" \
  -H "Authorization: Bearer ${TOKEN}" -H "Content-Type: application/json" \
  -d "$(jq -n --arg m "$MASHUP" '{queryName:"Result",customMashupDocument:$m}')"

See references/validation.md for step-by-step instructions and error handling.

2. Save the Partition via XMLA / TOM

Write the expression back to the model; Analysis Services validates the M syntax on save. This doesn't execute the query but catches structural errors:

  • Missing or mismatched let/in
  • Undefined step references
  • Invalid function calls
  • Type mismatches in TransformColumnTypes
bash
# Edit the TMDL partition source directly and deploy via fab import,
# or use the XMLA endpoint with Tabular Editor or SSMS to modify
# the partition expression on the deployed model.

AS returns an error if the expression is malformed. This is faster than a full execute but doesn't catch runtime errors (wrong column names, data source issues).

Choosing a Validation Approach
NeedUse
Full data validation (correct columns, types, values)Execute via API
Quick syntax checkSave to model via XMLA/TOM
Step-by-step debuggingExecute with truncated in clause
Performance testing (check folding)Execute with full data, observe timing

Previewing Partition Steps

See the data at any point in the transformation chain by truncating the let...in:

-- See raw source data (all columns)
in Data;

-- See after column removal
in #"Removed Columns";

-- See final result
in #"Changed Type";

Add Table.FirstN(stepName, 100) before the in to limit rows for large tables. See references/validation.md for the complete procedure.

Common Patterns

Incremental Refresh Partitions

Incremental refresh partitions use RangeStart and RangeEnd parameters:

let
    Source = Sql.Database(#"SqlEndpoint", #"Database"),
    Data = Source{[Schema="dbo", Item="Orders"]}[Data],
    #"Filtered" = Table.SelectRows(Data, each
        [OrderDate] >= #"RangeStart" and [OrderDate] < #"RangeEnd")
in
    #"Filtered"

When testing, inline concrete date values for RangeStart and RangeEnd.

Lakehouse Sources
let
    Source = Lakehouse.Contents(null),
    Data = Source{[Id="lakehouse-guid"]}[Data],
    Table = Data{[Id="table-name", ItemKind="Table"]}[Data]
in
    Table
SQL with Native Query

For complex SQL that can't be expressed in M:

let
    Source = Sql.Database("server", "db"),
    Data = Value.NativeQuery(Source, "SELECT * FROM dbo.MyView WHERE Year = 2024", null, [EnableFolding=true])
in
    Data

Value.NativeQuery with EnableFolding=true allows subsequent M steps to fold on top of the native query.

References

  • references/validation.md -- Detailed validation workflow with executeQuery API, step preview, error handling
  • references/best-practices.md -- Query folding guidance, fold-breaker list, anti-patterns, performance tips
  • examples/execute_m.py -- Python script to execute M expressions via the Fabric API (CLI tool)
  • examples/preview_partition.py -- Python script to preview partition data at any step (uses fab get + execute_m.py)
  • Power Query M Reference
  • Query Folding Guidance

© data-goblin, GPL-3.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 4 other files (references) in plugins/semantic-models/skills/power-query of data-goblin/power-bi-agentic-development.

  • SKILL.md
  • examples/execute_m.py
  • examples/preview_partition.py
  • references/best-practices.md
  • references/validation.md

Open the folder on GitHubat commit 41886f2

Compare with similar skills

Power Query next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Power Query compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Power Query this skilldata-goblin/power-bi-agentic-development1k—~2.2kAutomated safety check: PassGPL-3.0
Evolving The Data ModelTriliumNext/Trilium38k—~2.1kAutomated safety check: PassAGPL-3.0
SQL Optimization Patternsynulihao/AgentSkillOS61710 repos~3.3kAutomated safety check: PassNone
SQL PortabilityHL7/sql-on-fhir150—~512Automated safety check: PassCustom licence
ChronicleailyProject/aily-blockly3.8k—~1.6kAutomated safety check: PassGPL-3.0
DB Migrationskurealnum/dotfiles290—~820Automated safety check: PassNone

Similar skills

  • Evolving The Data Model

    TriliumNext/Trilium

    A skill your agent uses when adding a DB migration or a new column/field to a Becca entity in Trilium ("add a migration", "new column on notes/attributes", "ALTER TABLE", "add a field to…

    38k GitHub stars~2.1k tokensUpdated today
    DatabasesAuto-check passed
  • SQL Optimization Patterns

    ynulihao/AgentSkillOS

    Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries.

    617 GitHub starsUsed in 10 repos~3.3k tokens
    DatabasesAuto-check passed
  • SQL Portability

    HL7/sql-on-fhir

    Analyse whether a SQL query is portable across database implementations using sqlglot transpilation.

    150 GitHub stars~512 tokensUpdated yesterday
    DatabasesAuto-check passed
  • Chronicle

    ailyProject/aily-blockly

    Analyze indexed Aily chat session history for prior decisions, tool executions, project summaries, usage tips, and session-store reindexing.

    3.8k GitHub stars~1.6k tokensUpdated yesterday
    DatabasesAuto-check passed
  • DB Migrations

    kurealnum/dotfiles

    A skill your agent uses when generating or regenerating Drizzle migration files, changing database schema tables or columns, resolving migration sequence conflicts after rebase, reviewing migration…

    290 GitHub stars~820 tokensUpdated 5 mo ago
    DatabasesAuto-check passed
  • Contact Filter

    ChatbotXIO/ChatbotX

    Work with the ChatbotX contact filter system — the shared filter model behind the contacts list, conversations, and broadcast audiences.

    878 GitHub stars~2.5k tokensUpdated today
    DatabasesAuto-check passed

More from data-goblin/power-bi-agentic-development

All 33 skills in this repo
  • Paginated Report

    data-goblin/power-bi-agentic-development

    Author, validate, publish, and test Power BI paginated reports in the RDL format.

    1k GitHub stars~3.5k tokensUpdated 2 days ago
    Auto-check passed
  • Audit Tenant Settings

    data-goblin/power-bi-agentic-development

    Automatically invoke this skill whenever the user asks about Fabric tenant settings or Power BI tenant settings or auditing tenant settings.

    1k GitHub stars~4.7k tokensUpdated 2 days ago
    Auto-check passed
  • Bpa Rules

    data-goblin/power-bi-agentic-development

    Interactive BPA rule generation for Power BI semantic models; guided discovery, model investigation, and expert rule authoring.

    1k GitHub stars~4.4k tokensUpdated 2 days ago
    Auto-check passed
  • Pbip

    data-goblin/power-bi-agentic-development

    Guidance for Power BI Project (PBIP) structure, thick and thin reports, project renames, forks, and validation.

    1k GitHub stars~3.8k tokensUpdated 2 days ago
    Auto-check passed
  • Review Report

    data-goblin/power-bi-agentic-development

    Actionable feedback on the quality, usage, and effectiveness of Power BI reports.

    1k GitHub stars~4.2k tokensUpdated 2 days ago
    Auto-check passed
  • Semantic Model

    data-goblin/power-bi-agentic-development

    This skill should be used whenever the user mentions a "semantic model", "data model", or "dataset", or asks to "build", "model", "design", "optimize", "review", or "audit" one, or to "add a…

    1k GitHub stars~2.8k tokensUpdated 2 days ago
    Auto-check passed

Works with

Categories

Questions about Power Query

What does Power Query do?

Author, validate, and test Power Query M expressions in semantic model partitions. Power Query is an agent skill from data-goblin/power-bi-agentic-development. Author, validate, and test Power Query M expressions in semantic model partitions.

When should I use Power Query?

Power Query fits situations like: mentions Power Query; partition expression; asks to write Power Query; fix Power Query.

How do I install Power Query in Claude Code?

Run `npx skills add data-goblin/power-bi-agentic-development --skill power-query -a claude-code`. Or copy the skill folder (plugins/semantic-models/skills/power-query in data-goblin/power-bi-agentic-development) into .claude/skills/power-query in your project. Claude Code loads it when a task matches its description.

How do I install Power Query in Codex?

Run `npx skills add data-goblin/power-bi-agentic-development --skill power-query -a codex`. Or copy the skill folder (plugins/semantic-models/skills/power-query in data-goblin/power-bi-agentic-development) into .agents/skills/power-query in your project. Codex loads it when a task matches its description.

Can I use Power Query in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add data-goblin/power-bi-agentic-development --skill power-query -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/power-query, .gemini/skills/power-query, .github/skills/power-query and .opencode/skills/power-query in your project.

What does Power Query need to run?

Going by SKILL.md and its folder, Power Query needs Python for the scripts in its folder and the command-line tools its instructions call (curl and jq). Our summary lists: Python 3.

Does Power Query access the network?

SKILL.md names 1 domain. As links in the text: learn.microsoft.com. This is read from the text; nothing was executed.

Is Power Query safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Power Query use?

Power Query is published under the GPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Power Query use?

About 2.2k tokens (SKILL.md is roughly 8.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 4.8k tokens, read only when the agent opens those files.

What are the alternatives to Power Query?

Skills that share tags, products or a category with Power Query: Evolving The Data Model (TriliumNext/Trilium, 38k stars), SQL Optimization Patterns (ynulihao/AgentSkillOS, 617 stars), SQL Portability (HL7/sql-on-fhir, 150 stars) and Chronicle (ailyProject/aily-blockly, 3.8k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Power Query?

data-goblin (a GitHub user) maintains it in data-goblin/power-bi-agentic-development, which has 1,026 GitHub stars. The repository holds 33 skills in this directory. The repository was last updated on October 5, 2026.

Source: data-goblin/power-bi-agentic-development on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.