Writing and executing C# scripts and macros against Power BI semantic models using Tabular Editor 2/3. Automatically invoke when the user mentions "C# script", "Tabular Editor script", "TOM scripting", "MacroActions.json", "XMLA", or asks to "automate model changes", "bulk update measures", "create calculation groups", "write a macro", "format DAX expressions", "manage model metadata".
SkillScore82Maintained
Automatic
◆Data Engineer pack
Last verified 8/17/2026
What it changes
Passed 18 of 22 test cases with the skill, and 9 of 22 without it.
Without skill41%
With skill82%
Checks it passed that the model alone missed
The script calls SelectMeasure().
The script includes an Info() call.
The script calls ExportProperties().
and 10 more in the full report
11 fixed7 passed either way2 still failing2 broke
Pass-rate lift
+41 pp
Tokens
+208%
Agent turns
0%
Response time
-19%
Measured 8/17/2026v1 · latest is v218 of 22 cases passed with skill
Tokens, turns and time describe resource use, not a dollar price.
This benchmark measured an earlier version of the skill.
A newer attempt on gemini-3.8-flash on 10/18/2026 did not produce a publishable comparison (not comparable). The snapshot above is the previously measured run.
See it in action
One of 11 test cases the skill fixed. Same model, same prompt, with and without the skill.
1 of 11
Prompt
Write a C# script for Tabular Editor that updates the description of a table named 'Customer' only if it exists, and displays a fatal script error if missing.
What was checked, without and with the skill
Checked
Without skill
With skill
The script calls Model.Tables.Contains() to verify table existence.
Missed
Passed
The script calls Error() when the table does not exist.
Missed
Passed
case-09 · gemini-3.6-flash · 8/17/2026 · answers are capped and redacted
What's inside
The instructions your model reads when the skill loads.
SKILL.md413 lines5 files
C# Scripting for Tabular Editor
Expert guidance for writing and executing C# scripts to manipulate Power BI semantic model metadata using Tabular Editor 2/3 CLI or the Tabular Editor IDE.
When to Use This Skill
Activate automatically when tasks involve:
Writing C# scripts for Tabular Editor
Bulk operations on model objects (measures, columns, tables)
Creating or modifying calculation groups
Managing model security (roles, RLS, OLS)
Formatting DAX expressions
Automating repetitive model changes
Querying model metadata via TOM API
Building interactive scripts with user input dialogs
Critical
Every statement must end with ; (semicolon required by C#)
Use double quotes " for strings and escape with \ when needed
Use forward slashes / in DisplayFolder paths (auto-converted to \)
Always add Info() statements for debugging - script stops at error point
Test scripts on non-production models first
Changes are undoable with Ctrl+Z in the Tabular Editor UI
C# Version Support
Environment
C# Version
Notes
Tabular Editor 2
Default compiler
Older C# syntax
Tabular Editor 3
Roslyn
Supports up to C# 12 with VS2022
TE2 with Roslyn
Configurable
Set in File > Preferences > General
To use newer C# features in TE2, configure Roslyn compiler path in preferences.