fabric-apps-analytic-templates
AGENTS.md26 starsChanged 2 months agoMITView on GitHub
You will help the user build a React web app that visualizes data from Power BI semantic models. The app fetches live data via DAX queries, renders charts and grids using Vega-Lite and a built-in DataGrid component, and supports light/dark theming. Your job is to discover the user's data, write correct DAX queries, build React components that fetch and display that data, and validate the result in the browser. Before the first schema command, ensure the user- or task-provided semantic…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository9 other files it gives its agents.
- app-designSkill
- app-validationSkill
- dax-authoringSkill
- fabric-cliSkill
- fabric-sdkSkill
- playwright-cliSkill
- query-designSkill
- schema-discoverySkill
- visualsSkill
The file
We split this AGENTS.md into the rules it gives an agent
10 rules. About 0 are common, 6 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Before the first schema command, ensure the user- or task-provided semantic model is registered and its connection alias is known.
- Very specific: line 14
Do not fetch the whole schema upfront, and do not rely on src/fabric.generated.ts for schema because it holds only connection aliases.
- Distinctive: line 20
When modifying existing behavior, relevant query files may be inspected earlier.
- Very specific: line 37
When a component uses useThemeContext() or useSemanticModelQuery(), call the hook unconditionally at the top of the component before any …
- Very specific: line 70
Keep all DAX in .dax files and import it with Vite's ?raw suffix.
- Very specific: line 71
Use separate .dax files when a parameter changes query structure.
- Distinctive: line 75
Never define Vega-Lite specs inline in component files.
- Distinctive: line 79
After the required schema and query results are understood, load and follow the app-design skill before writing presentation code.
- Distinctive: line 87
Never use mock, fake, or hardcoded data: All data must come from a real source.
- Distinctive: line 90
Never guess query result schema: Run the query first and use its exact output names.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Agent Instructions
Purpose
You will help the user build a React web app that visualizes data from Power BI semantic models. The app fetches live data via DAX queries, renders charts and grids using Vega-Lite and a built-in DataGrid component, and supports light/dark theming. Your job is to discover the user's data, write correct DAX queries, build React components that fetch and display that data, and validate the result in the browser.
Semantic model schema (discover it progressively)
Before the first schema command, ensure the user- or task-provided semantic model is registered and its connection alias is known. Never register an inferred or additional data source.
Discover the connected model's schema on demand with DAX INFO.VIEW.* queries run through npx fabric-app-data query. Fetch only what the current request needs: start with a scope probe, then tables, then columns and measures for the tables that are relevant.
Do not fetch the whole schema upfront, and do not rely on src/fabric.generated.ts for schema because it holds only connection aliases.
Complete the initial semantic-model discovery with the supplied connection details and model
metadata before inspecting generic application source files. Do not include global.css,
package.json, App.tsx, hooks, utilities, or broad src/** patterns in initial glob, search, or
read operations. After initial discovery, inspect only the files needed to implement the request.
When modifying existing behavior, relevant query files may be inspected earlier.
The schema-discovery skill has the discovery order, INFO function map, and narrowing patterns.
API discovery
Use exact symbol searches and the narrowest relevant public declaration or template-local source file to learn an API. Do not broadly list, search, read, or dynamically import package internals, compiled JavaScript bundles, or Vite dependency bundles. Read runtime implementation only when the task explicitly requires debugging behavior.
For visualizations backed by a Fabric semantic model, follow these four steps:
// 1. barrel src/queries/<page>/<viz>.ts exports { connection, query, columnMetadata, vegaLiteSpec }
// 2. fetch const { data, isLoading, error } = useSemanticModelQuery({ connection, query });
// 3. shape const table = toDataTable(data.table, columnMetadata);
// 4. render <VegaVisual spec={vegaLiteSpec} data={table} theme={theme} /> // or <DataGrid data={table} theme={theme} />When a component uses useThemeContext() or useSemanticModelQuery(), call the hook unconditionally at the top of the component before any loading or error return.
Runtime rules:
- DAX failures do not throw from the SDK.
useSemanticModelQuerymaps failed query results, transport failures, and unexpected runtime failures to itserrorfield. Handleerror, then requiredata.status === "success"before touchingdata.table. - Key
columnMetadataby the query's exact raw output column name. Give each entry a bracket-freenamealias for Vega-Lite and DataGrid fields; raw names containing.,[, or]can render asundefined. - Pass the resolved
themefromuseThemeContext()toVegaVisualandDataGrid.
Project structure
fabric.yaml # Fabric connection config
index.html # Vite entry HTML
vite.config.ts # Vite + Tailwind build config
tsconfig.json # TypeScript configuration
src/
├── fabric.generated.ts # Connection aliases to workspace/item IDs
├── main.tsx # App entry point
├── App.tsx # Main dashboard layout
├── ErrorFallback.tsx # Error boundary fallback UI
├── global.css # Tailwind design tokens
├── data-palette-presets.json
├── components/
├── hooks/
├── lib/
├── queries/ # DAX, Vega-Lite specs, and factory functions
└── vite-env.d.tsQuery and spec organization
Group query files by page or domain under src/queries/. Each visualization uses the same kebab-case base name for its .dax, .json, and .ts files.
- Keep all DAX in
.daxfiles and import it with Vite's?rawsuffix. - Use separate
.daxfiles when a parameter changes query structure. - Export a factory returning
{ connection, query, columnMetadata, vegaLiteSpec }. - Key
columnMetadataby exact query output names and map each to a Vega-safename, user-facingdisplayName, and optionalformat. - Re-export modules through an
index.tsin each group and at thesrc/queries/root. - Never define Vega-Lite specs inline in component files.
Validate each single-table visual immediately after completing its query factory and before UX design, editing src/global.css, or writing component code. Run npm run validate:visual -- <query-factory.ts> [factory-params-json] [<query-factory.ts> [factory-params-json] ...], repeating a factory path for every relevant parameter variant. Run the validation command directly without piping it through tail, grep, head, or another command that can hide a nonzero exit status. Validate all completed factories in one command when possible, and do not proceed until every result passes.
After the required schema and query results are understood, load and follow the app-design skill before writing presentation code.
Validation
Browser validation is required after UI changes. After implementation is complete, load and follow the app-validation skill, validate through the Fabric portal embed flow, and fix issues before considering the task complete. Use only the target Fabric workspace URI supplied by the user or task. If deployment configuration is missing and no target workspace URI was supplied, ask the user for one.
Critical rules
- Never use mock, fake, or hardcoded data. All data must come from a real source.
- Never store data in memory or local storage. Fetch on demand from the real source.
- Do not assume or silently add a data source. Confirm the source with the user and never supplement it without explicit consent.
- Never guess query result schema. Run the query first and use its exact output names.
- Do not ask the user to describe the schema. Discover it with DAX
INFO.VIEW.*queries.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

