Power-bi-agentic-development pbir-format
Format reference for Power BI Enhanced Report (PBIR) JSON schemas and patterns. Automatically invoke when the user asks about PBIR JSON structure, visual.json properties, PBIR expressions, objects vs visualContainerObjects, theme inheritance, conditional formatting patterns, extension measures, bookmarks, field references, filter formatting, query roles, PBIR page structure, report wallpaper, or any PBIR metadata format question.
git clone https://github.com/data-goblin/power-bi-agentic-development
T=$(mktemp -d) && git clone --depth=1 https://github.com/data-goblin/power-bi-agentic-development "$T" && mkdir -p ~/.claude/skills && cp -r "$T/plugins/pbip/skills/pbir-format" ~/.claude/skills/data-goblin-power-bi-agentic-development-pbir-format && rm -rf "$T"
plugins/pbip/skills/pbir-format/SKILL.mdPBIR Format Reference
Skill that teaches Claude about the Power BI Enhanced Report (PBIR) JSON format to read and use it. Doesn't support legacy
report.json or layout report metadata. To convert from legacy to PBIR format, users have to open and save their reports in Power BI Desktop.
Follow within reason the mental model when working with reports.
WARNING: The PBIR format is brittle and easily corrupted. Direct JSON file modification can lead to corruption. Prefer using the
pbir CLI tool if available (uv tool install pbir-cli or pip install pbir-cli), as it has built-in safeguards against breaking report files. Only fall back to direct JSON modification if the user explicitly requests it or if pbir is not available.
General, critical guidance
- Check examples: Check examples for a valid report
- Take a backup: Make a copy of the report before modifying it
- PBIX vs PBIP vs PBIR: So long as report metadata is in PBIR format, any of these formats works. PBIX is just a zip file; unzip and rezip to work with it. Do not work with PBIT (Power BI Template) file types. Note that PBIP and PBIX contain PBIR, but a "thin" report can be PBIR only.
- Valid JSON vs. Rendering JSON: Valid JSON does not guarantee rendering. A visual might not render if the bound field is invalid (missing, wrong table, or misspelled) in the visual.json, if the visual elements are cropped by their container, if a model performance issue causes the dax query to time out, if a model data quality issue results in (Blank) or empty values, etc. Check whether a visual rendered using tools like the chrome or chrome devTools MCP server if the report was published to Power BI, but it's often faster to just ask the user to check in Power BI Desktop or the browser.
- Hierarchical formatting cascade: In Power BI reports, formatting is determined by the following order of operations: defaults --> Theme wildcards (*) --> Theme visualTypes --> bespoke visual.json configuration. Theme overwrites defaults, visualType overrides wildcards in themes, and visual.json overrides all theme formatting. Prefer putting as much of the formatting in the theme as possible over bespoke visual.json formatting because then changes only need to happen in one place
- PBIR files are strict JSON: No comments allowed
- DON'T MAKE ASSUMPTIONS: Check the Microsoft documentation and other reputable resources for context if needed, or ask the user.
Report Structure
Report.Report/ +-- .pbi/localSettings.json # Local-only, gitignored +-- .platform # Fabric Git integration +-- definition.pbir # Semantic model connection (byPath or byConnection) can open this file in Power BI Desktop to open the report +-- mobileState.json # Mobile layout (niche) +-- semanticModelDiagramLayout.json # Model diagrams +-- CustomVisuals/ # Private custom visuals only +-- definition/ | +-- version.json # REQUIRED -- PBIR version | +-- report.json # REQUIRED -- report-level config, including theme, report filters, settings | +-- reportExtensions.json # Extension measures and visual calculations (report- and visual-level DAX) | +-- pages/ | | +-- pages.json # Page order, active page | | +-- [PageName]/ # Power BI Desktop may generate names with spaces; recommend no spaces for human-authored names | | +-- page.json # Page-level properties, including size, background, filters | | +-- visuals/ | | +-- [VisualName]/ | | +-- visual.json # Visual config, formatting, and field data bindings <-- most important and complex file for report dev and formatting | | +-- mobile.json # Mobile formatting of the visual (niche) | +-- bookmarks/ # Bookmarks are a bad practice and should be avoided if possible! | +-- bookmarks.json # Bookmark order and groups | +-- [id].bookmark.json # Individual bookmark state containing a snapshot of the report basically +-- StaticResources/ +-- RegisteredResources/ # Custom themes, images +-- [ThemeName].json # Custom theme <-- second most important and complex file for formatting +-- SharedResources/BaseThemes/ # Microsoft base themes
Rules
Follow within reason the mental model when reviewing or providing feedback on reports.
Modifying a report
- Understand the user's request. Ask questions if necessary to clarify the business context -- focus on the business process, the users, and the model
- Explore the report efficiently to locate relevant pages and visuals
- Check the connected semantic model. For thin reports (
), usebyConnection
,fab
, orpbir
CLI tools to explore the model. Forte
, connect to the local model in Power BI Desktop. Understanding the model reveals available fields and calculation logicbyPath - Identify the appropriate visuals and pages to modify. Ask the user for clarification if needed
- Plan modifications with the correct PBIR structure and property values
Creating a report
- Same workflow as modifying, except files are generated from scratch. Use
if thepbir new
CLI is available; otherwise, check the example reports thoroughlypbir - Ensure
is configured properly (byPath or byConnection)definition.pbir - Use a theme.json file. Recommended: the SQLBI/Data Goblins theme
- Add appropriate filters to
orreport.json
; see filter pane referencepage.json
Additional validation
For detailed report design guidance (layout, spacing, visual hierarchy, color, accessibility), see the
skill. Key rules enforced during validation:pbi-report-design
- Use a custom theme; push formatting to the theme over bespoke visual.json unless the user specifies otherwise
- Visuals must not overlap; maintain equal spacing between visuals and page edges
- Every page needs a title (textbox or background image). Ensure textboxes are tall enough to render (24-28 pt)
- Follow the 3-30-300 rule: KPIs/cards at top, breakdowns in middle, detail at bottom. Maximum 2-3 slicers per page; use the filter pane for additional filtering
- Prefer Deneb, Python, or R custom visuals over SVG or heavily customized core visuals -- balance elegance against technical debt
- Use report extensions (thin report measures, visual calculations) only when model measures are not feasible
- Centralize conditional formatting in extension or model measures referencing theme semantic colors (
,"bad"
)"good" - Use consistent colors to direct attention, not to decorate. Avoid pie charts beyond 5 categories
- Sort visuals logically (typically descending by measure). Start chart axes at zero unless there is an explicit reason not to
- Use consistent fonts. Set
for accessibility. Name visuals descriptively (altText
notrevenue_bar_chart
)a1b2c3d4 - Eliminate redundant visuals. Consider the "Apply" button on high-cardinality slicers
- See the Data Goblins report checklist for pre-deployment validation
What to Read for Common Tasks
| Task | Read |
|---|---|
| Add or modify a visual | -- expression syntax, field references, query roles, position, objects vs visualContainerObjects, selectors |
| Change formatting or colors | (container chrome) + (theme-level formatting). Prefer theme changes over bespoke visual formatting |
| Add conditional formatting | + (extension measures for CF) |
| Add or configure filters | -- all 7 filter types, default values, filter discovery |
| Work with the theme | -- inheritance, wildcards, visual-type overrides, filter pane styling, inspecting and modifying with jq |
| Push visual formatting to theme | -- promote bespoke visual formatting into theme defaults for that visual type (copy from visual.json / into theme ) |
| Change page layout/background | -- dimensions, background, wallpaper, visualInteractions |
| Create a tooltip page | -- tooltip page setup (type, size, visibility) + visualTooltip opt-in on visuals |
| Create a drillthrough page | -- drillthrough filter in page filterConfig |
| Change report settings | -- themeCollection, resourcePackages, settings, outspacePane |
| Add extension measures | -- reportExtensions.json structure, DAX patterns, referencing |
| Add annotations / metadata | -- custom name-value metadata on reports, pages, and visuals for deployment scripts, documentation, and external tooling |
| Add images or SVGs | -- RegisteredResources, base64 in themes, SVG measures |
| Add or modify textboxes | -- paragraphs, textRuns, textStyle |
| Sort a visual | -- sortDefinition inside query |
| Sync slicers across pages | -- syncGroup (groupName, fieldChanges, filterChanges) |
| Edit visual interactions | + -- visualInteractions in page.json (NoFilter, Filter, Highlight) |
| Change table/matrix column widths | -- columnWidth with metadata selector |
| Group visuals | -- visualGroup, parentGroupName, groupMode |
| Hide visuals or fields | -- isHidden at root level, query projection control |
| Format chart elements (labels, markers, lines) | -- labels, markers, lineStyles, dataPoint |
| Add analytics lines (reference, trend, error, forecast) | -- y1AxisReferenceLine, trend, error, forecast |
| Work with bookmarks | -- bookmark state, filter snapshots, visual show/hide |
| Find model fields | -- pbir model, te, fab commands |
| Rebind to different model | -- byPath vs byConnection conversion |
| Understand schema versions | -- all schema types and current versions |
| Understand how visuals generate DAX queries | -- visual metadata → SUMMARIZECOLUMNS mapping, data roles, IGNORE() context |
| Build or verify DAX query patterns | -- SUMMARIZECOLUMNS patterns, ROW(), query execution methods |
| Rename a table or field across visual JSON | -- Entity/Property/queryRef patterns in visual.json, filterConfig, reportExtensions |
| Fix broken field references after model changes | -- diagnosis, repair workflow for renamed/moved/removed fields, slicer value pitfalls |
| Convert legacy report.json to PBIR format | -- format differences, step-by-step conversion, projections-to-queryState mapping, validation |
| Understand reportExtensions.json schema | -- file schema structure, entities, visual calculations; see for DAX authoring patterns |
definition.pbir
A report must be connected to a semantic model. There are two ways to do this:
- byPath -- Local PBIP reference/thick report:
(schema 2.0.0){"byPath": {"path": "../Model.SemanticModel"}} - byConnection -- Remote/thin report:
(schema 2.0.0){"byConnection": {"connectionString": "Data Source=powerbi://..."}}
Related Skills
-- PBIP project operations: rename cascades, project forking, report JSON patternspbip
-- TMDL file format, authoring, and editingtmdl
References
Fetching Docs: To retrieve current Power BI developer/report format docs, use
microsoft_docs_search + microsoft_docs_fetch (MCP) if available, otherwise mslearn search + mslearn fetch (CLI). Search based on the user's request and run multiple searches as needed to ensure sufficient context before proceeding.
Examples:
-- Real PBIR report with 7 visual types (slicer, advancedSlicerVisual, kpi, lineChart, scatterChart, tableEx, textbox), extension measures, bookmarks, conditional formattingexamples/K201-MonthSlicer.Report/
-- 54 standalone visual.json examples; seeexamples/visuals/
for a catalog. Split intoexamples/visuals/__index.md
(minimal, theme-only) anddefault/
(bespoke formatting, conditional formatting, gradients, filters)formatted/
Core references:
-- visual.json: expressions, field refs, query roles, position, objects vs vCO, selectors, sorting, filtersreferences/visual-json.md
-- PBIR folder structure detailsreferences/pbir-structure.md
-- Schema versions and URLsreferences/schemas.md
-- Valid property enumerationsreferences/enumerations.md
-- version.json format (concise)references/version-json.md
-- .platform file format (concise)references/platform.md
-- Bookmark structure and state snapshotsreferences/bookmarks.md
Formatting & expressions:
-- Theme wildcards, inheritance, color system, filter pane styling, visual-type overrides. Includes jq patterns for inspecting and modifying theme JSON directlyreferences/theme.md
-- Expressions, selectors, conditional formatting, visual calculationsreferences/schema-patterns/
-- objects vs visualContainerObjects deep-divereferences/visual-container-formatting.md
-- When to use measure expressions vs literal valuesreferences/measures-vs-literals.md
-- Extension measure patternsreferences/measures.md
Visual & page configuration:
-- Textbox visual formatreferences/textbox.md
-- Page configuration and backgroundsreferences/page.md
-- Report-level settingsreferences/report.md
-- Report wallpaper/canvas backgroundreferences/wallpaper.md
-- Filter pane formattingreferences/filter-pane.md
-- Visual sort configurationreferences/sort-visuals.md
-- Static images, base64 in themes, SVG measuresreferences/images.md
-- reportExtensions.json formatreferences/report-extensions.md
-- Custom metadata on reports, pages, and visualsreferences/annotations.md
Semantic model integration:
-- Field references, model structure, report rebinding, query inferencereferences/semantic-model/
How-to guides:
-- Advanced conditional formatting, SVG in visuals, fix broken field references, convert legacy to PBIRreferences/how-to/