pbi-semantic-layer-tmdl

pbi-semantic-layer-tmdl is a skill for Claude Code, Codex from luccapinto/agentic-data-kit. It costs 44 tokens per session (691 once invoked), scanned A, original, MIT.

A guide for editing a Power BI semantic model as readable TMDL text files. A semantic model defines tables, relationships, calculations, security rules, and other data structures used by Power BI reports.

In plain words
What is it for?
Use it to add or edit tables, columns, measures, relationships, row-level security, translations, and shared Power Query expressions directly in a PBIP project.
Why use it?
It makes model changes scriptable and easier to review in version control. It also explains which files to edit and warns that Power BI Desktop must be closed before saving changes.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

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.

agentmods
npx agentmods add skills/luccapinto/agentic-data-kit/pbi-semantic-layer-tmdl
Any agent
npx skills add luccapinto/agentic-data-kit --skill pbi-semantic-layer-tmdl
Clone the repo
git clone --depth 1 https://github.com/luccapinto/agentic-data-kit

Made for: Claude Code, Codex.

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 pbi-semantic-layer-tmdl

README.md
[![agentmods](https://agentmods.dev/badge/skills/luccapinto/agentic-data-kit/pbi-semantic-layer-tmdl.svg)](https://agentmods.dev/skills/luccapinto/agentic-data-kit/pbi-semantic-layer-tmdl)
Your own site
<a href="https://agentmods.dev/skills/luccapinto/agentic-data-kit/pbi-semantic-layer-tmdl"><img src="https://agentmods.dev/badge/skills/luccapinto/agentic-data-kit/pbi-semantic-layer-tmdl.svg" alt="Measured on agentmods" height="20"></a>
Per session 44 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 691 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00044 $0.00691
Opus 5 $0.00022 $0.00345
Sonnet 5 $0.00009 $0.00138
Haiku 4.5 $0.00004 $0.00069

Measured 6d ago against content hash c82cd2ce3cb6, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

pbi-semantic-layer-tmdl 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 6d 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.

.agent/skills/pbi-semantic-layer-tmdl/SKILL.md · 70 lines

How it starts

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

Skill: pbi-semantic-layer-tmdl

Author and edit the semantic model (tables, columns, measures, relationships, RLS) by writing TMDL files directly. TMDL is the GA, human-readable text format for tabular models — great diffs, one file per table, fully scriptable.

Hard precondition

Power BI Desktop must be CLOSED before saving. Desktop keeps the model in memory and overwrites disk on save, so editing live corrupts files or loses work.

.SemanticModel structure

<Project>.SemanticModel/
  definition.pbism          ← pointer (do not hand-edit)
  definition/
    model.tmdl              ← model-level definition, lists tables
    database.tmdl           ← compatibility level / annotations
    tables/<Table>.tmdl     ← ONE table per file (golden rule)
    relationships.tmdl      ← all relationships
    expressions.tmdl        ← shared M expressions / parameters
    cultures/               ← translations
    roles.tmdl              ← RLS
  .pbi/                     ← local cache/settings — NEVER edit (localSettings.json, cache.abf)

Edit .tmdl files only. One table per file — never define every table inside model.tmdl.

TMDL syntax reference

table 'Sales'
    description: "Primary sales fact."

    measure 'Total Sales' = SUM(Sales[Amount])
        formatString: "#,##0.00"
        displayFolder: "Financials"
        description: "Sum of sales amount."

    column 'Amount'
        dataType: decimal
        sourceColumn: BaseAmount
relationship Sales_Date
    fromColumn: Sales.DateId
    toColumn: Date.DateId
    fromCardinality: many
    toCardinality: one

Serialization rules: keep functional properties (dataType, sourceColumn) before cosmetic ones; match the file's existing indentation; for multi-line DAX, break with \ at the end of the line.

Tooling

  • Tabular Editor 2 (free) can open the .SemanticModel folder, validate, batch-edit, and re-serialize clean TMDL. Use it to sanity-check non-trivial edits.
  • Optional: Microsoft's powerbi-modeling-mcp (preview) edits the same PBIP/TMDL files and is handy for bulk operations. File editing remains the default, accessible path.

Read the full file on GitHub · 70 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. 6d ago First seen · 70 lines · 44 tokens per session scan A c82cd2ce3cb6

Subscribe to this mod's changes

pbi-semantic-layer-tmdl is a skill published in the GitHub repository luccapinto/agentic-data-kit (7 stars, last pushed 1mo ago), licensed MIT. It adds 44 tokens to every session and 691 once invoked, about $0.0002 per session on Opus 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.