Optimise dax
This skill should be used when the user asks to "optimise my DAX", "speed up this measure", "review my DAX", "refactor these measures", "why is my report slow", mentions a slow visual or long refresh traceable to a measure, or invokes /AtelierBID:optimise-dax. Detects anti-patterns, ranks them worst-first with plain-English explanations, and rewrites only what the user accepts — dry-run by default, with a before/after equivalence artefact per change. Use it whenever DAX performance or code quality comes up, even if the user has not named a specific measure.From its SKILL.md
npx -y skills add DATA-AI-XYZ/Atelier --skill optimise-daxAssembled 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
4.6 KB, as published. Nobody here has run it
Optimise DAX measures
Detection, ranking, explanation and rewriting are all deterministic — scripts/optimise-dax.js does the analysis. The AI's job here is to present findings clearly and to make sure nothing is written without the user's explicit yes.
Plain-English: it reads your measures, tells you which ones are written badly and why, and rewrites only the ones you approve.
Step 1 — Resolve the input (hard gate)
optimise-dax.js reads a single TMDL file, not a model directory. Establish which file holds the measures — commonly <model>/Measures.tmdl or a table file containing measure blocks.
If the user has a model directory, list the *.tmdl files containing measure and ask which to work on, or iterate them one at a time. Do not guess. Rewriting the wrong file is a silent, hard-to-notice mistake.
Create a run folder: echo '{}' | node scripts/new-run.js dax-opt - → <run>.
Step 2 — Detect and rank
node scripts/optimise-dax.js --detect --explain --json \
--in <file.tmdl> --out <run>/findings.json
Findings come back already ranked worst-first, each with rank, severity, rule, measure and summary; --explain adds the plain-English reasoning. Without --json it prints one line per finding as #rank [severity] rule — measure: summary.
Present them in rank order. Lead with the severity and the measure name — the user needs to recognise their own measure, not parse a rule id.
If there are no findings, say so plainly and stop. Do not manufacture work.
Detected is not the same as auto-fixable. The rule set finds more than it can safely rewrite — a run may report three findings and offer one rewrite. Check the count from Step 4 before promising a fix, and tell the user which findings they will need to address by hand. Reporting three problems and silently fixing one is worse than reporting one fix and two known issues.
Step 3 — Let the user choose
Ask which findings to act on. Accept "all", a list of measure names, or a severity threshold.
Never skip this step, even when every finding looks obviously correct. The rewrites are output-identical by construction of the rule set, not by proof — see Step 5.
Step 4 — Preview the rewrite (dry run)
node scripts/optimise-dax.js --rewrite --in <file.tmdl> --out <run>/rewritten.tmdl
This writes the rewritten TMDL to the run folder, leaving the user's file untouched. Show the before/after for each accepted measure.
To see what an in-place write would do without doing it:
node scripts/optimise-dax.js --rewrite --write-back --in <file.tmdl>
That prints write-back: dry-run — N rewrite(s) available; pass --apply to write (<file> unchanged). It is a genuine dry run — the file is byte-for-byte unchanged.
Step 5 — Emit the equivalence pair
For each rewrite the user is about to accept:
node scripts/optimise-dax.js --rewrite --equivalence-pair \
--in <file.tmdl> --out <run>/equivalence.json
Be honest about what this is. Offline, the plugin cannot execute DAX, so it cannot prove the rewrite returns the same numbers. The verdict reports engine: none rather than claiming equivalence (ADR-0025). The pair is the artefact the user runs in Power BI Desktop to confirm for themselves.
Say this to the user in plain words. Do not describe a rewrite as "verified" or "proven equivalent".
Step 6 — Apply, only on explicit confirmation
node scripts/optimise-dax.js --rewrite --write-back --apply --in <file.tmdl>
Prints write-back: applied N rewrite(s) to <file>.
Only run this after the user has said yes to this specific change set. If they are working outside version control, say so and suggest they commit or copy the file first.
Step 7 — Report back
Give the user: how many findings were detected and how many applied, the file that changed, the path to the equivalence artefact, and a one-line reminder that the equivalence pair still needs running in Desktop to confirm the numbers.