Power BI CLI - semantic models (.NET TOM) and PBIR reports for token-efficient AI agent usage, built for Claude Code
$ npx -y skills add MinaSaad1/pbi-cli --agent claude-code
Run the curl in your terminal, the rest in Claude Code.
Repo: MinaSaad1/pbi-cli
What's inside
pipx install pbi-cli-tool # 1. Install (handles PATH automatically)
pbi-cli skills install # 2. Register Claude Code skills (one-time setup)
pbi connect # 3. Connect to Power BI Desktop
Open Power BI Desktop with a .pbix file, run the three commands above, and start asking Claude.
Requires: Windows with Python 3.10+ and Power BI Desktop running.
Install and set up pbi-cli from https://github.com/MinaSaad1/pbi-cli.git
Claude will clone, install, connect, and set up skills automatically.
pip install pbi-cli-tool
On Windows, pip install often places the pbi command in a directory that isn't on your PATH.
Fix: Add the Scripts directory to PATH
python -c "import site; print(site.getusersitepackages().replace('site-packages','Scripts'))"
Add the printed path to your system PATH, then restart your terminal. We recommend pipx to avoid this entirely.
Ask Claude to work with your Power BI semantic model. Requires pbi connect.
Ask Claude to build and manage your Power BI reports. No connection needed -- works directly on PBIR files.
Two layers, one CLI:
.pbip projects.All config lives in ~/.pbi-cli/:
~/.pbi-cli/
config.json # Default connection preference
connections.json # Named connections
repl_history # REPL command history
Bundled DLLs ship inside the Python package (pbi_cli/dlls/).
After running pbi-cli skills install, Claude Code discovers 13 Power BI skills. Each skill teaches Claude a different area. You don't need to memorize commands.
pbi connect)| Skill | What you say | What Claude does |
|---|---|---|
| DAX | "What are the top 10 products by revenue?" | Writes and executes DAX queries, validates syntax |
| Modeling | "Create a star schema with Sales and Calendar" | Creates tables, relationships, measures, hierarchies |
| Deployment | "Save a snapshot before I make changes" | Exports/imports TMDL, manages transactions, diffs snapshots |
| Security | "Set up RLS for regional managers" | Creates roles, filters, perspectives |
| Docs | "Document everything in this model" | Generates data dictionaries, measure inventories |
| Partitions | "Show me the M query for the Sales table" | Manages partitions, expressions, calendar config |
| Diagnostics | "Why is this query so slow?" | Traces queries, checks model health, benchmarks |
| Skill | What you say | What Claude does |
|---|---|---|
| Report | "Create a new report project for Sales" | Scaffolds PBIR reports, validates structure, previews layout |
| Visuals | "Add a bar chart showing revenue by region" | Adds, binds, updates, bulk-manages 32 visual types |
| Pages | "Add an Executive Overview page" | Manages pages, bookmarks, visibility, drillthrough |
| Themes | "Apply our corporate brand colours" | Applies themes, conditional formatting, colour scales |
| Filters | "Show only the top 10 products" | Adds page/visual filters (TopN, date, categorical) |
| Custom Visuals | "Build a radial gauge Power BI doesn't have" | Scaffolds a TypeScript visual project, iterates on tsc --noEmit, packages .pbiviz, imports into the report |
The Custom Visuals skill turns vibe-coding into the Power BI Visuals SDK loop.
Claude scaffolds a sibling TypeScript project with npx pbiviz new, iterates against
the Power BI Visuals API with tsc --noEmit between every change, packages a
.pbiviz, and embeds it into your report:
# After installing the skill, just describe what you want in Claude Code:
# "Build me a radial gauge that highlights values above target"
#
# Under the hood, the skill drives:
npx --yes powerbi-visuals-tools@^5.6.0 new mygaugevisual
# (Claude edits src/visual.ts + capabilities.json, runs tsc --noEmit until clean)
npx --yes powerbi-visuals-tools@^5.6.0 package
pbi visual import-custom dist/mygaugevisual.1.0.5.pbiviz --replace
The skill auto-installs Node and pbiviz on first run (with your consent), pins
the SDK to a known-good version, keeps the TypeScript project as a sibling to your
.pbip (no PBIR contamination), and operates under a curated npm allowlist for
common deps (D3, Lodash, date-fns) -- anything off-list requires explicit approval.
Three new pbi-cli commands support the loop:
| Command | What it does |
|---|---|
pbi visual import-custom <pbiviz> | Embed a locally-built .pbiviz into the report's RegisteredResources/ and register it in report.json. --replace overwrites by GUID. |
pbi visual list-custom | List embedded and public (AppSource) custom visuals, distinguished by kind. |
pbi visual remove-custom <guid-or-name> | Deregister and physically delete the .pbiviz resource. |
27 command groups covering both the semantic model and the report layer.
| Category | Commands |
|---|---|
| Queries | dax execute, dax validate, dax clear-cache |
| Model | table, column, measure, relationship, hierarchy, calc-group |
| Deploy | database export-tmdl, database import-tmdl, database export-tmsl, database diff-tmdl, transaction |
| Security | security-role, perspective |
| Connect | connect, disconnect, connections list, connections last |
| Data | partition, expression, calendar, advanced culture |
| Diagnostics | trace start/stop/fetch/export, model stats |
| Report | report create, report info, report validate, report preview, report reload |
| Pages | report add-page, report delete-page, report get-page, report set-background, report set-visibility |
| Visuals | visual add/get/list/update/delete, visual bind, visual bulk-bind/bulk-update/bulk-delete, visual where |
| Filters | filters list, filters add-categorical/add-topn/add-relative-date, filters remove/clear |
| Formatting | format get/clear, format background-gradient/background-conditional/background-measure |
| Bookmarks | bookmarks list/get/add/delete/set-visibility |
| Tools | setup, repl, skills install/list/uninstall |
Use --json for machine-readable output (for scripts and AI agents):
pbi --json measure list
pbi --json dax execute "EVALUATE Sales"
pbi --json visual list --page overview
Run pbi <command> --help for full options.
For interactive work, the REPL keeps a persistent connection:
$ pbi repl
pbi> connect --data-source localhost:54321
Connected: localhost-54321
pbi(localhost-54321)> measure list
pbi(localhost-54321)> dax execute "EVALUATE TOPN(5, Sales)"
pbi(localhost-54321)> exit
Tab completion, command history, and a dynamic prompt showing your active connection.
git clone https://github.com/MinaSaad1/pbi-cli.git
cd pbi-cli
pip install -e ".[dev]"
ruff check src/ tests/ # Lint
mypy src/ # Type check
pytest -m "not e2e" # Run tests (488 tests)
pbi-cli-tool ships with Microsoft Analysis Services client library
assemblies (Microsoft.AnalysisServices.*.dll) under src/pbi_cli/dlls/.
These binaries are not covered by pbi-cli's MIT license. They are
redistributed unmodified under the Microsoft Software License Terms for
Microsoft Analysis Management Objects (AMO) and Microsoft Analysis
Services - ADOMD.NET. Full terms are in
THIRD_PARTY_LICENSES.md and the companion
NOTICE file. By installing pbi-cli-tool you agree to those
terms in addition to the MIT License that applies to the rest of the
package.
Contributions are welcome! Please open an issue first to discuss what you'd like to change.
.gitattributes
.github/
workflows/
ci.yml
custom-visual-smoke.yml
downloads-chart.yml
release.yml
.gitignore
assets/
architecture-flow.svg
auto-sync.svg
backup-restore.svg
banner.svg
before-after.svg
bulk-operations.svg
chat-demo-report.svg
chat-demo.svg
dax-debugging.svg
downloads-chart.svg
layers.svg
model-health-check.svg
report-layer.svg
report-workflow.svg
rls-testing.svg
skills-hub.svg
stats.svg
visual-types.svg
CHANGELOG.md
Claude_AI_symbol.svg
CONTRIBUTING.md
LICENSE
New_Power_BI_Logo.svg
NOTICE
pyproject.toml
README.md
README.pypi.md
scripts/
bake_headers.py
generate_downloads_chart.py
SECURITY.md
src/
pbi_cli/
__init__.py
__main__.py
commands/
__init__.py
_helpers.py
advanced.py
bookmarks.py
calc_group.py
calendar.py
column.py
connection.py
database.py
dax.py
expression.py
filters.py
format_cmd.py
hierarchy.py
measure.py
model.py
partition.py
perspective.py
relationship.py
repl_cmd.py
report.py
security.py
setup_cmd.py
skills_cmd.py
table.py
trace.py
transaction.py
visual.py
core/
__init__.py
adomd_backend.py
banner.py
bookmark_backend.py
bulk_backend.py
claude_integration.py
config.py
connection_store.py
custom_visual_backend.py
dotnet_loader.py
errors.py
filter_backend.py
format_backend.py
output.py
pbir_models.py
pbir_path.py
pbir_validators.py
report_backend.py
session.py
tmdl_diff.py
tom_backend.py
visual_backend.py
dlls/
__init__.py
Microsoft.AnalysisServices.AdomdClient.dll
Microsoft.AnalysisServices.Core.dll
Microsoft.AnalysisServices.dll
Microsoft.AnalysisServices.Tabular.dll
Microsoft.AnalysisServices.Tabular.Json.dll
pbi_cli.runtimeconfig.json
README.md
main_pbi_cli.py
main.py
preview/
__init__.py
renderer.py
server.py
watcher.py
skills/
__init__.py
power-bi-custom-visuals/
AGENTS-template.md
SKILL.md
power-bi-dax/
SKILL.md
power-bi-deployment/
SKILL.md
power-bi-diagnostics/
SKILL.md
power-bi-docs/
SKILL.md
power-bi-filters/
SKILL.md
power-bi-modeling/
SKILL.md
power-bi-pages/
SKILL.md
power-bi-partitions/
SKILL.md
power-bi-report/
SKILL.md
power-bi-security/
SKILL.md
power-bi-themes/
SKILL.md
power-bi-visuals/
SKILL.md
templates/
__init__.py
visuals/
__init__.py
actionButton.json
advancedSlicerVisual.json
areaChart.json
azureMap.json
barChart.json
card.json
cardNew.json
cardVisual.json
clusteredBarChart.json
clusteredColumnChart.json
columnChart.json
donutChart.json
funnelChart.json
gauge.json
image.json
kpi.json
lineChart.json
lineStackedColumnComboChart.json
listSlicer.json
multiRowCard.json
pageNavigator.json
pivotTable.json
ribbonChart.json
scatterChart.json
shape.json
slicer.json
stackedBarChart.json
tableEx.json
textbox.json
textSlicer.json
treemap.json
waterfallChart.json
utils/
__init__.py
desktop_sync.py
platform.py
repl.py
tests/
__init__.py
conftest.py
mocks/
__init__.py
test_bookmark_backend.py
test_bulk_backend.py
test_claude_md.py
test_commands/
__init__.py
test_connection.py
test_dax.py
test_measure.py
test_misc_commands.py
test_model.py
test_repl.py
test_setup.py
test_table.py
test_config.py
test_connection_store.py
test_custom_visual_backend.py
test_e2e.py
test_errors.py
test_filter_backend.py
test_format_backend.py
test_hardening.py
test_helpers.py
test_output.py
test_pbir_path.py
test_pbir_validators.py
test_platform.py
test_preview.py
test_report_backend.py
test_skill_triggering.py
test_tmdl_diff.py
test_visual_backend.py
test_visual_calc.py
THIRD_PARTY_LICENSES.mdFAQ
pbi-cli is a Claude Code plugin with 13 hand-picked skills for data work, indexed on Flowy. Install it with the command on its page. It includes power-bi-custom-visuals, power-bi-dax, power-bi-deployment. Its skills do not fire on their own yet. Request auto-invocation to have Flowy route them as you prompt. Free and open source.