Pbi drafter
Generate a Power BI dashboard PBIP from a /*FACTORY*/ Config Block using the Dashboard Drafter pipeline. Takes a ready config block, runs parse_config → run_factory, outputs a PBIP dashboard. Use when user says: 'generate dashboard', 'run dashboard drafter', 'build dashboard from config', 'run factory', 'create dashboard', 'PBI dashboard generator', 'ダッシュボード生成', or provides a /*FACTORY*/ config block with generation intent.From its SKILL.md
npx -y skills add yujiyamane/pbi-ai-skills --skill pbi-drafterAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
5.9 KB, ~1.5k tokens by cl100k_base, as published. Nobody here has run it
PBI Drafter
Overview
Execute the Dashboard Drafter pipeline from a /*FACTORY ... */ Config Block and produce a ready-to-open PBIP dashboard. This skill only generates — it does not draft configs. Use pbi-drafter-configurator first if you don't have a config block yet.
Trigger phrases: generate dashboard, run dashboard drafter, build dashboard from config, run factory, create dashboard, PBI dashboard generator, ダッシュボード生成, or a /*FACTORY ... */ block with generation intent.
Step 1 — Validate Input
-
Confirm the input contains a
/*FACTORY ... */block. If not, tell the user to runpbi-drafter-configuratorfirst. -
Check that the
SOURCE:file exists at the specified path. If not, report the missing path and stop. -
Verify the config uses actual CSV column names before
AS(e.g.amount AS "Amount", notSUM_Measure_1 AS "Amount"). If slot placeholder names are used as source columns, warn the user:⚠️ The config uses template slot names (e.g.
SUM_Measure_1 AS "Amount") as source columns. This will cause Power BI to error with "column not found" on refresh. Usepbi-drafter-configuratorto regenerate the config with actual CSV column names, or manually replace the slot names with the real CSV column headers.
Step 2 — Pre-flight
- Remind the user: "Close PBI Desktop before generation to avoid file-lock errors."
- Verify the template folder exists at
pbi-drafter/template/relative to the repo root.- If missing, stop and report the path.
Step 3 — Generate
Working directory: <repo-root>/pbi-drafter/
Before running, sanitise the TITLE from the config block:
- Replace
&withand - Remove any character in
< > : " / \ | ? *
These characters are invalid in Windows folder names and will cause run_factory to fail silently or produce a broken output path. If sanitisation changes the title, inform the user: "TITLE sanitised: 'Profit & Loss' → 'Profit and Loss'".
Run the following Python (inline, no separate script file needed):
import sys, shutil, re
from pathlib import Path
repo_root = Path(r"<repo-root>")
drafter = repo_root / "pbi-drafter"
sys.path.insert(0, str(drafter))
from src.config_parser import parse_config
from src.factory import run_factory
config_text = r'''<paste the full /*FACTORY ... */ block here>'''
cfg = parse_config(config_text)
raw_title = cfg['title']
safe_title = raw_title.replace('&', 'and')
safe_title = re.sub(r'[<>:"/\\|?*]', '', safe_title).strip()
if safe_title != raw_title:
cfg['title'] = safe_title
print(f'TITLE sanitised: {raw_title!r} -> {safe_title!r}')
title = cfg['title'].replace(' ', '_')
out = drafter / 'output' / title
if out.exists():
shutil.rmtree(out)
result = run_factory(
drafter / 'template',
drafter / 'output',
cfg,
)
print('Generated:', result)
If generation fails, show the full error traceback — do not suppress or summarise it.
Step 4 — Verify Output
After successful generation:
- Output first 20 lines of
Fact.tmdlfrompbi-drafter/output/<Title>/<Title>.SemanticModel/definition/tables/Fact.tmdl - Check no template slot names remain in visible
sourceColumn:entries (lines withoutisHidden). Template slot names are:SUM_Measure_1–10,CNT_Measure_1–5,AVG_Measure_1–5,Key_Dim_1–10,Other_Field_1–10,DateKey. - Verify format strings — SUM columns with
$format →formatString: $#,0.00;#→ integer;%→ percentage;#.0→ one decimal. - Report hidden field count: count lines containing
isHiddenin Fact.tmdl.
Step 5 — Report to User
✅ Dashboard generated at:
pbi-drafter/output/<Title>/<Title>.pbip
Open in PBI Desktop and click "Refresh" to load data.
[first 20 lines of Fact.tmdl]
[any verification warnings]
Critical Rules
| Rule | Detail |
|---|---|
| Working directory | <repo-root>/pbi-drafter/ |
| Never modify template/ | The template is the golden master. All output goes to output/. |
| Delete before regenerate | Always shutil.rmtree(out) before run_factory to avoid stale artefacts. |
| TITLE must be Windows filename-safe | Forbidden characters in TITLE: `& < > : " / \ |
| Actual CSV column names | Source token before AS must be the real CSV column name. Slot placeholder names cause "column not found" in Power BI. |
| CNT columns → type text | CNT source columns (used for DISTINCTCOUNT) load as type text. ID fields like E00001 or INV-12345 are strings — this is intentional and correct. |
| DAX_ measures excluded from M Query | The DAX_ prefix measures are TMDL artefacts only — they are never part of the M Query field_map. |
| en-US.tmdl untouched | Never read or write en-US.tmdl — PBI Desktop auto-regenerates it. |
| sourceColumn = M Query output name | After the rename step, sourceColumn in TMDL must match the business display name the M Query outputs. |
| Date categoricals excluded from KEY | Month, Quarter, Year, FY, MonthName, Period, Week columns should NOT be in KEY slots. |
| Full traceback on failure | If run_factory or parse_config raises, show the complete traceback — never summarise. |
| 350 TDD tests | All pipeline steps are covered. Run python -m pytest tests/ -q in pbi-drafter/ if something seems broken. |
What ships with it: 248 files
9110.8 KB alongside SKILL.md, 18 of them executable
data/
- finance_dummy_data.csv295.3 KB
- phase1_dummy_data.csv240.3 KB
docs/
- architecture.md6.8 KB
- assets/demo.gif5485.2 KB
- assets/README.md592 B
- assets/screenshot_adhoc.png188.3 KB
- assets/screenshot_details.png224.1 KB
- assets/screenshot_drillthrough.png240.9 KB
- assets/screenshot_summary.png199.4 KB
- assets/screenshot_visual_objects.png194.9 KB
examples/
- finance_dashboard_config.txt743 B
- hr_dashboard_config.txt552 B
- sample_data_generator.pyruns3.3 KB
- sample_finance_data.csv41.5 KB
- sample_hr_data.csv24.8 KB
src/
- config_parser.pyruns5.2 KB
- factory.pyruns6.9 KB
- format_pipeline.pyruns2.4 KB
- __init__.pyruns0 B
- mquery_generator.pyruns3.8 KB
- rename_pipeline.pyruns4.1 KB
- sort_pipeline.pyruns1.5 KB
- visibility_pipeline.pyruns4.2 KB
template/
- .gitignore44 B
- Template.pbip274 B
- Template.Report/definition/pages/1835df268ba784b629e9/page.json41.1 KB
- Template.Report/definition/pages/1835df268ba784b629e9/visuals/30699bd85a97d862cf32/visual.json1.2 KB
- Template.Report/definition/pages/1835df268ba784b629e9/visuals/40be750afcd66a6e7f93/visual.json34.7 KB
- Template.Report/definition/pages/1835df268ba784b629e9/visuals/49101a38893f67eb6ee0/visual.json2.0 KB
- Template.Report/definition/pages/1835df268ba784b629e9/visuals/4f139702e801f12ccf22/visual.json5.9 KB
- Template.Report/definition/pages/1835df268ba784b629e9/visuals/879ee301244e89c54b03/visual.json1.9 KB
- Template.Report/definition/pages/1835df268ba784b629e9/visuals/91c3ddb2c1d28b51536b/visual.json3.5 KB
- Template.Report/definition/pages/1835df268ba784b629e9/visuals/980ecf5a0be58a1a1e1a/visual.json23.2 KB
- Template.Report/definition/pages/1835df268ba784b629e9/visuals/d8ade742a88d75f22cea/visual.json396 B
- Template.Report/definition/pages/1835df268ba784b629e9/visuals/effbadcaa021b16d6b87/visual.json1.6 KB
- CHANGELOG.md3.5 KB
- .gitignore42 B
- pyproject.toml67 B
- README.md7.5 KB
- _run_asset.pyruns1.1 KB
208 more files not listed here. See all 248 in the repository.