An open-source workflow for prototyping semantic models, catching TMDL defects, keeping client models aligned and standardizing reports.
A marketing team asks a familiar question: which campaigns bring in profitable customers? The answer sounds simple until someone has to turn it into a Power BI model.
What counts as a customer? Which date defines acquisition? Is revenue recognised at order date or payment date? How should refunds be handled? Does the business already have a customer dimension, or does the data need to be joined from several systems?
The people who understand the business question are often not the people who build the semantic model. The request moves through a backlog, assumptions are made, and the first draft comes back shaped by what the engineer could infer.
Power BI's Project format (PBIP) and Tabular Model Definition Language (TMDL) make semantic models easier to version, inspect and review as text. But text-based source control does not, by itself, make model changes safe. A missing table reference, duplicated lineage tag, malformed field parameter or renamed measure can still break a report.
I built swift-pbi to address the work around those models: translate business questions into an engineering hand-off, validate and repair mechanical defects, keep template-based client models aligned without erasing legitimate differences, and standardise recurring report layouts.
It is not a replacement for Power BI Desktop, Tabular Editor or deployment tooling. It is a set of open-source skills and command-line tools that make parts of the development workflow more inspectable and reproducible.
If you want to follow along, the walkthrough near the end installs swift-pbi and turns a “monthly active customers” request into a built model and an engineering hand-off in four prompts, with the tool output at each step.
The gap is not just between data and dashboards
A semantic model is an executable interpretation of a business. Tables, relationships, measures, calculation logic, formats and descriptions encode decisions about how the organisation understands its activity.
A request such as “show customer retention by acquisition cohort” hides several design questions:
- What is the grain of the customer and transaction tables?
- Which event marks acquisition?
- What constitutes an active or retained customer?
- How are cancellations, refunds, and reactivations represented?
- Which dimensions should filter the measure?
- What source systems and refresh rules are authoritative?
If these questions remain implicit, the engineer has to guess or return for clarification. Either way, the first model can become a negotiation over assumptions rather than a useful starting point.
The prototype-model workflow in swift-pbi treats the business request as a specification problem. It interviews the requester, records assumptions and open questions, creates a star-schema proposal, builds a PBIP project with fictional sample rows, validates the result and produces a hand-off package.
The package is not intended to pretend that unknown source-system details have been solved. It separates what can be modeled from what the engineering team still needs to decide: source of truth, refresh strategy, historical retention, row-level security and production credentials.

Start with a specification, not a guessed dashboard
The prototype workflow asks for the business questions, relevant entities, measures, relationships and constraints before generating the model.
For example, a fictional bike repair workshop might need to understand service revenue, repeat customers, technician utilization and parts performance. Those questions imply different grains and relationships:
- A work order is not the same thing as a work-order line.
- A customer-level count should not be calculated from a dimension if the intended population is defined by a fact table.
- A ratio needs a clearly defined numerator and denominator at a compatible grain.
- A date table needs an explicit relationship to the event date being analysed.
The first draft of a bike-shop specification in the repository's reproducible demo failed its hand-off checks. It contained three P1 findings: an orphan customer key, a per-customer ratio counted from the dimension rather than the fact table, and a measure without a description.
After the specification, the hand-off profile reported zero P0, zero P1, and zero P2 findings. The model build contained six tables, 29 columns, six measures, and four relationships. The generated PBIP report had one empty page; this was a model prototype and hand-off package, not a finished business dashboard.
Rebuilding the corrected specification produced byte-identical files. That matters because a reproducible build makes it possible to review the specification and the generated artifacts separately.
These are repository demo results on fictional data, not a claim that the workflow can infer every organization's business definitions.
Treat TMDL validation as a preflight check
PBIP and TMDL make model metadata reviewable in Git. They also expose the model to ordinary text-file defects and consistency problems.
The swift-pbi preflight workflow uses tmdl-preflight, a separate open-source command-line tool pinned to version 1.2.1 in the current project configuration. The tool reports 119 rules covering TMDL structure and conventions. Twenty-five rules have mechanical fixers, although four of those fixers run only when explicitly selected because they are unsafe to apply indiscriminately.
The repository includes a deliberately broken fictional bike-shop model. Running the preflight check reports 12 findings:
| Finding | Severity | What it means |
|---|---|---|
| F001 | Error | An orphan comma in a field-parameter definition |
| M003 | Error | Two tables share a lineage tag |
| M006 | Warning | A table file is missing from model.tmdl |
| M004 | Warning | A lineage tag is not a canonical UUID |
| Other findings | Info | Missing descriptions, format string, style note and calendar columns |
The distinction between a validator finding and a Power BI Desktop failure is important. In a separate Windows test bench using the earlier v1.1.0 tools, I tested each planted defect individually in Desktop. The duplicate lineage tag prevented the project from opening. The field-parameter comma did not prevent the model from opening, but visuals using that parameter failed. The missing table reference and placeholder lineage tag did not stop Desktop from opening the model.
The current macOS demo uses v1.2.1 and records the tool output, not a new Desktop compatibility test. The Windows bench has not been rerun against v1.2.1. I keep those claims separate rather than treating every lint error as a load blocker.
After the fixer runs, it reports four mechanical repairs: add the missing table reference, replace the duplicate lineage tag, replace the placeholder tag and remove the orphan comma. An independent re-check reports zero errors and zero warnings. Eight informational findings remain because they need a human decision, such as writing meaningful descriptions or deciding which calendar columns are required.
A second fix run changes nothing.

Fix what is mechanical; leave meaning to people
A linter can detect that a description is missing. It cannot reliably invent the business meaning of a measure.
A fixer can replace a duplicated identifier. It should not decide whether a measure's definition is semantically correct. A style rule can identify a missing format string, but the appropriate format depends on what the measure represents.
The preflight skill therefore follows a constrained sequence:
1. Run the check and capture its output.
2. Explain each finding and its likely impact.
3. Show the proposed changes or dry run.
4. Ask for consent before editing.
5. Apply only supported mechanical fixes.
6. Run the check again and report what remains.
The agent is instructed to quote counts from tool output rather than estimate them. It must not claim that a model opens in Power BI Desktop merely because the validator passes.
This is a deliberately narrow role for an agent. The command-line tool determines what it found. The agent explains the result and mediates the workflow. The human remains responsible for approving file changes and deciding questions of business meaning.

Keep client models aligned without making them identical
The fleet-drift workflow addresses a different problem: organizations and agencies that maintain several Power BI models derived from a shared template.
A template may define common revenue measures, dimensions and relationships. Each client model may also have legitimate differences: additional measures, different source connections, a deliberately absent table, or a client-specific calculation.
A naïve synchronization process can erase those differences. A useful fleet process must distinguish accidental drift from intentional variation.
swift-pbi uses tmdl-drift-doctor to compare a template with spinout models, classify differences, apply an explicit allowlist and maintain a ledger of retired objects. A fleet.yml configuration records approved exceptions.
For example:
| Spinout difference | How it is represented | Remediation behaviour |
|---|---|---|
| Client-only measure or column | Recognised as an extra object | Preserved |
| Different source connection | Excluded from the expression allowlist | Not cascaded from the template |
| Client-specific measure definition | Explicit expression override with reason, owner and date | Reported for review |
| Deliberately absent object | absent override | Not reintroduced |
| Retired measure that a client still needs | retain override or ledger entry | Not deleted |
The repository demo plants drift across four fictional spinout models: changed DAX, a lost currency format, a deleted measure, a dropped column, a relationship changed to bidirectional filtering, a measure moved to another table, and a spinout-only measure.
Before remediation, detection reports eight actionable findings and one advisory. The remediation command applies six fixes under an explicit allowlist. Afterwards, detection reports zero actionable findings, and preflight reports zero errors in all four spinouts.
The demo then retires a measure from the template. The process refuses to proceed against a stale baseline. After the baseline is recaptured, ordinary remediation skips deletions. One spinout is explicitly marked as retaining the measure. A second explicit confirmation is required to remove it from the other three.
That second gate is intentional. Deleting a measure from a client model is not equivalent to correcting a formatting inconsistency. The workflow makes destructive synchronization a separate decision.

Standardize reports through a model-driven canvas
A consistent semantic model does not guarantee consistent reports. Teams often rebuild similar chart layouts repeatedly, and small differences in field bindings, bookmarks and formatting accumulate.
The chart-style skill uses pbi-plot-styler to maintain a standardized combo-chart canvas. The example uses field parameters for plot axis, legend and measures, with bookmarks representing recurring analytical questions. Styling is driven from the model rather than manually copied across every report.
In the recorded coffee-roastery example, the check command found zero errors. The style command rebuilt one of one combo charts, using five line measures and excluding one measure assigned to the columns role. A second run rebuilt zero charts.
I then renamed a measure in the model without updating the report. The check reported two binding errors, BND001 and BND002, identifying the visual that still referenced the old measure name.
This is a useful boundary for automation. The tool can detect a broken binding and rebuild a known layout. It cannot decide whether the chart is the right way to answer a business question.

The architecture: skills coordinate, tools do the work
swift-pbi is not one monolithic application. It combines agent instructions with four focused command-line tools:
| Workflow | Responsibility | Tool |
|---|---|---|
| prototype-model | Interview, specification, model build and hand-off | pbip-model-forge, tmdl-preflight |
| preflight | Lint, explain, repair with consent and re-check | tmdl-preflight |
| fleet-drift | Detect, classify and remediate template drift | tmdl-drift-doctor |
| chart-style | Check bindings and standardize combo-chart layouts | pbi-plot-styler |
| power-bi-definitions | Reuse and audit measures from TMDL | Reads model files directly |
The tools are invoked through uvx against pinned releases. This avoids relying on a globally installed version that may differ between machines.
The skills are designed to work with terminal-capable agents such as Claude Code, Codex, Cursor, GitHub Copilot, Cline and Kiro, or any agent that reads AGENTS.md. In chat-only environments, an assistant can help interview the requester, write a specification and explain pasted output, but it cannot execute the local tools.
That distinction is part of the design, not a footnote. A workflow should say clearly which steps were executed and which were only described.

Walkthrough: from “monthly active customers” to an engineering hand-off
To show what the toolkit produces, I installed swift-pbi into Claude Code and played the marketing team of a fictional coffee-subscription shop. Below are the four prompts I typed, exactly as I typed them, and what came back. Everything shown in code is tool output. An agent will word its replies differently on your machine, but the tools, checks and files are the same.
Step 1: Install
/plugin marketplace add C-Kapsalis/swift-pbi /plugin install swift-pbi@swift-pbi You also need uv. The skills run each tool with uvx at the pinned v1.2.1 release, so nothing is installed globally. Codex, Cursor, Copilot and other agents can use the same skills through AGENTS.md.
Step 2: Ask in business language
Our marketing team wants to track monthly active customers by acquisition campaign, and to see which campaigns bring in profitable customers. We're a (fictional) online coffee-subscription shop; the data is an orders export from our e-commerce platform plus a spreadsheet of campaigns. Can you prototype a Power BI model we can hand to our data engineers?
The prototype-model skill loaded on its own. Before writing anything, it asked three questions, the most it allows per turn, each with a suggested default:
- What makes a customer active in a month? A paid order that month, or a live subscription? The second needs pause and cancel dates that an orders export usually lacks.
- How is a customer tied to a campaign? Suggested: the campaign on their first order, for life, with no campaign meaning Organic.
- What does profitable mean? Suggested: gross margin per customer against acquisition cost, which is campaign spend divided by customers acquired.
It also asked whether one row of the export is an order or an order line, and told me not to paste real customer rows.
Step 3: Answer, and let it build
1: (a), a paid order that month. 2: the first order carries a utm_campaign field that matches a campaign_id in the spreadsheet; no campaign means Organic. 3: your suggestion. Each export row is one order line, with unit price, quantity and unit cost; shipping cost is per order. [...] Go ahead: write the spec, build the model and give me the hand-off.
The agent wrote a spec (coffee-campaigns-spec.json) with fictional sample rows, ran the model gate, built the PBIP and ran the file gate. Both gates passed on the first attempt:

The model has six tables and 16 measures. Active Customers # is a distinct count of customers with a paid order, so on a month axis it gives monthly active customers. Margin to CAC Ratio divides a campaign's lifetime gross margin by its spend, so a value above 1 means the campaign's customers have paid it back.

Three decisions were flagged instead of hidden. Spend exists only as a campaign total, so acquisition cost cannot be split by month. Shipping cost sits on the first line of each order so it is counted once. And the agent added a Products table without being asked, which it listed for the engineers to confirm.
Step 4: Read the hand-off
handoff/HANDOFF.md maps each marketing question to the measures that answer it, records the agreed definitions, lists every table and all 16 measures with their DAX, explains the modelling choices to keep or replace, and ends with 13 open questions only the engineers can answer:

It also states what was verified and what was not: the tools validated the files, and opening the project in Power BI Desktop is a manual step that has not been done.
Step 5: Break it the way people do
Then I did what someone starting a new table often does: copied Customers.tmdl to Prospects.tmdl and changed the table name. Then I asked:
One of our engineers copied Customers.tmdl to start a Prospects table, and now Power BI Desktop won't open CoffeeCampaigns.pbip. Can you check what's wrong?
The preflight skill loaded, found five duplicate lineage tags and the missing ref table line, showed a dry run and stopped to ask. It also pointed out that Prospects was not in the spec, so a rebuild would delete it, and offered to add it to the spec instead. After I replied “Yes, make the backup and apply the fixes”, it backed up the folder, applied six fixes, showed the diff and re-checked:

Its closing line is the one I care most about: a clean check only means the files pass the tool's rules. It does not prove that Desktop opens the project or that the numbers are right.
What the tests do not prove
The examples are reproducible, but they are not production validation across every Power BI model or organisation.
The models and client spinouts in the demo are fictional. The generated sample data is not customer data. Passing preflight establishes that the tested rules found no remaining errors or warnings; it does not establish that every measure expresses the intended business definition.
The current macOS demo output does not prove that every generated project opens in Power BI Desktop. The separate Windows bench was performed with v1.1.0, and has not been rerun with the v1.2.1 tool pin.
The agent evaluation is also separate from the tool demo. In runs on 21 October 2026 against the v1.1.0 tools, the plugin arm scored 0.90 compared with 0.84 without the plugin across 37 case-runs. The per-suite mean delta was positive in four of five runs, with a median difference of +0.05. This is an early, narrow evaluation, not evidence that the skills improve every Power BI task or generalize to larger models. The project includes a complexity ladder intended to test progressively larger models.
The project does not deploy models to Fabric workspaces. It does not replace Tabular Editor's broader best-practice analysis, ALM Toolkit's model comparison and deployment workflows, Fab Inspector's report and Fabric-item checks, or Microsoft's Fabric deployment tools. Those tools address different parts of the lifecycle and can be used alongside swift-pbi.
Why I built it this way
The central design decision is to keep the boundaries visible.
A business request should become a specification before it becomes a model. A validator should report what it can establish, not what a human hopes it means. A fixer should repair mechanical defects without inventing semantics. A template synchronization tool should preserve documented client differences and require explicit confirmation for destructive changes. An agent should explain tool output rather than manufacture it.
These constraints make the workflow less magical and more useful. They also make failures easier to investigate. When a report is wrong, the team can ask whether the problem began in the business definition, the model specification, the TMDL, the report binding or the interpretation of the output.
The next step is broader testing against larger and less controlled models, including counterexamples from practitioners. The project is open source because those counterexamples are more valuable than a polished demo that only confirms the assumptions I started with.
If you work with PBIP, TMDL or template-based Power BI delivery, I would be interested in cases where the tools report a defect they should ignore, or miss one they should catch.
- Project: https://github.com/C-Kapsalis/swift-pbi
- Reproducible demo:
sh benchmarks/demo/run-all.sh - Documentation and installation: see
README.mdandINSTALL.md.



