rayfin
Skill108 starsChanged 5 months agoMITView on GitHub
Use when doing ANY task involving Rayfin — scaffolding, data models, decorators, auth, deployment, CLI commands, or client setup. Triggers: rayfin, rayfin init, rayfin up, rayfin login, RayfinClient, @entity, @role, @anonymous, @authenticated, @text, @uuid, @int, @decimal, @boolean, @date, @email, @set, @one, @many, DAB, Data API Builder, rayfin.yml, publishableKey, signUp, signIn, signOut, sendMagicLink, handleMagicLinkCallback, ensureSignedInWithFabric, Fabric SSO, Entra ID, rayfin up db apply, rayfin up staticapp deploy, schema.ts, OpaqueSession, onSessionChange, GraphQL select, GraphQL create, GraphQL update, GraphQL delete, findById, executePaginated, RLS policy, row-level security, claims.sub, claims.email, TC39 decorators, config generation, dialect, mssql, postgresql
- Deletes or force-pushes
We split this skill into the rules it gives an agent
19 rules. 1 is common, 1 is distinctive, and 17 are very specific to this project.
1
Common
Most of the 4 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
17
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Use these for code examples, API details, and troubleshooting — not this skill.
- Very specific: line 16
Run MCP and CLI lookups from the project root so local node_modules wins whether the CLI/MCP package is installed locally, globally, or …
- Very specific: line 32
If rayfin is not on PATH, use npx -y @microsoft/rayfin-cli docs ...
- Very specific: line 56
Prefer npm create @microsoft/rayfin@latest for new projects — it generates correct tsconfig and schema boilerplate.
- Very specific: line 60
Every entity must have an explicit permission decorator (@role, @anonymous, @authenticated) — entities without one are inaccessible.
- Very specific: line 61
Add policy: (claims, item) => claims.sub.eq(item.user_id) for row-level filtering on user-scoped data.
- Very specific: line 62
Use exclude in role options to hide sensitive fields (e.g., exclude: ['secret']).
- Very specific: line 64
Keep allowedRedirectUris in rayfin.yml tightly scoped to your app's origin.
- Very specific: line 71
Every field needs exactly one decorator: @uuid, @text, @int, @decimal, @boolean, @date, @email, @set.
- Very specific: line 74
Use @one(() => Target) with lazy arrow functions for relationships — Rayfin auto-generates FK columns named {property}_id.
- Very specific: line 75
Use import (not import type) for entity classes referenced in @one()/@many() arrow functions — decorators need the runtime class value.
- Very specific: line 78
Use @many(() => Target) for the inverse side of relationships.
- Very specific: line 86
Use .first(n).executePaginated() for cursor-based pagination.
- Common: line 98
When the user asks to "build and deploy," "make it live," or "deploy this change" (including schema-only changes like adding a column), …
- Very specific: line 105
Never use raw fetch() or hand-built GraphQL for data operations — always use client.data.<Entity> (provides type-safe queries and automatic …
- Very specific: line 106
Never omit permission decorators on entities — always add an explicit @permissions(...).
- Very specific: line 107
Never use @text() without max on MSSQL — always set @text({ max: N }) (e.g.
- Very specific: line 108
Never use @text() for FK columns that reference another entity's @uuid() PK — use @uuid() to match types.
- Very specific: line 109
Never skip search_docs('known limitations') before implementing entities — always run it first to surface platform constraints (text length …
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Rayfin
Rayfin Docs
Rayfin's documentation is available via MCP tools and the rayfin docs CLI.
Use these for code examples, API details, and troubleshooting — not this skill.
Docs are version-locked to the Rayfin packages installed in the user's project.
Run MCP and CLI lookups from the project root so local node_modules wins whether the CLI/MCP package is installed locally, globally, or through npx.
MCP tools (if the rayfin MCP server is connected):
search_docs(query: '<topic>', module: 'guide')— builder guides and tutorialssearch_docs(query: '<topic>', module: 'ts-sdk')— TypeScript SDK API referenceget_doc(symbol: '<decorator or class>')— resolve a symbol to its docsdiscover_packages(query: '<topic>')— find missing or too-old Rayfin packages when installed docs do not cover the task
CLI fallback (when MCP is unavailable):
rayfin docs search '<topic>' --module guide— builder guides and tutorialsrayfin docs search '<topic>' --module ts-sdk— TypeScript SDK API referencerayfin docs get --symbol '<decorator or class>'— resolve a symbol to its docsrayfin docs discover '<topic>'— find a Rayfin package when installed docs do not cover the task
If rayfin is not on PATH, use npx -y @microsoft/rayfin-cli docs ... from the project root.
Key doc topics:
- Known limitations — FK naming, constraint limits, relationship rules
- Data permissions —
@roledecorator, policy DSL, field visibility - GraphQL data access — RayfinClient setup, query chain, mutations
- Auth overview — auth methods, session handling
- Fabric deployment — workspace and static app deployment workflow
Before creating entities or writing queries, check known limitations:
search_docs(query: 'known limitations', module: 'guide')
# or: npx -y @microsoft/rayfin-cli docs search 'known limitations' --module guideRules
Platform
- Rayfin uses TC39 Stage 3 decorators — never enable
experimentalDecoratorsoremitDecoratorMetadata. - Include
ESNext.Decoratorsin the tsconfiglibarray. - Two deployment targets: Rayfin Local (Docker, MSSQL or PostgreSQL) and Fabric Apps (managed, MSSQL only).
- Prefer
npm create @microsoft/rayfin@latestfor new projects — it generates correct tsconfig and schema boilerplate.
Security
- Every entity must have an explicit permission decorator (
@role,@anonymous,@authenticated) — entities without one are inaccessible. - Add
policy: (claims, item) => claims.sub.eq(item.user_id)for row-level filtering on user-scoped data. - Use
excludein role options to hide sensitive fields (e.g.,exclude: ['secret']). - Publishable keys (
pk-*) are safe for client-side code — never expose service secrets or connection strings. - Keep
allowedRedirectUrisinrayfin.ymltightly scoped to your app's origin. - Email/password auth is local development only — deployed Fabric apps support Fabric SSO (Entra ID) exclusively.
- Fabric SSO only works inside the Fabric Portal — do not attempt it in local development.
Data Modeling
- Define entities with
@entity()inrayfin/data/and register them inrayfin/data/schema.tsastype AppSchema = { Name: Name }. - Every field needs exactly one decorator:
@uuid,@text,@int,@decimal,@boolean,@date,@email,@set. - Fields are required by default — use
{ optional: true }and?together for nullable fields. @text()length option ismax(notmaxLength) — e.g.,@text({ max: 200 }).- Use
@one(() => Target)with lazy arrow functions for relationships — Rayfin auto-generates FK columns named{property}_id. - Use
import(notimport type) for entity classes referenced in@one()/@many()arrow functions — decorators need the runtime class value. - FK columns referencing another entity (
{property}_id) must use@uuid()to match the PK type. Auth-based fields likeuser_idfromclaims.subuse@text(). - Many-to-many requires an explicit join entity with two
@one()fields. - Use
@many(() => Target)for the inverse side of relationships.
Querying
- Query chain:
.select()→.where()→.orderBy()→.execute(). - Single record by ID:
client.data.Entity.findById('uuid-here')— notfindByPk. - Filter by FK columns using
{property}_id(e.g.,customer_id), not dot-path (e.g.,customer.id). - Dot-paths are for
.select()only (e.g.,customer.companyName). - Use
.first(n).executePaginated()for cursor-based pagination. - Sort directions must be lowercase:
'asc'or'desc'.
Schema
- For Fabric:
rayfin upis the canonical command for "deploy this change," "apply this schema change," or "push my entity update" — it deploys the app and applies pending schema migrations in a single step. Recommend it on every deploy, including incremental schema changes after the initial deploy. rayfin up db applyis a narrow advanced subcommand that applies schema-only without touching the static build — only recommend it when the user explicitly asks to skip the static deploy step.--forcepermits destructive changes (drop table, drop column, alter type) — never use without review.--gen-config-onlygenerates the underlying API config without applying — use to inspect before applying.
Deployment
- When the user asks to "build and deploy," "make it live," or "deploy this change" (including schema-only changes like adding a column), execute the full workflow — do not present steps as instructions for the user to run manually.
- Workflow:
rayfin login→rayfin up→rayfin up status.rayfin upbuilds the static app, deploys it, and applies any pending schema migrations. rayfin up statuschecks endpoint health — run after deployment to verify.- Deployment metadata is written to
rayfin/.deployments.json(per-workspace record:fabricItemId,hostingUrl,publishableKey, etc.). The deploy also appends the live hosting URL toallowedRedirectUrisinrayfin.yml.
Anti-Patterns
- Never use raw
fetch()or hand-built GraphQL for data operations — always useclient.data.<Entity>(provides type-safe queries and automatic auth). - Never omit permission decorators on entities — always add an explicit
@permissions(...). Forgetting silently appliesauthenticated: *(full CRUD for any signed-in user), which is usually too permissive for production data. - Never use
@text()withoutmaxon MSSQL — always set@text({ max: N })(e.g.max: 200for typical strings).NVARCHAR(MAX)breaks GraphQL schema generation and cannot be uniquely indexed. - Never use
@text()for FK columns that reference another entity's@uuid()PK — use@uuid()to match types. (user_idfromclaims.subis@text(), not a FK.) - Never skip
search_docs('known limitations')before implementing entities — always run it first to surface platform constraints (text length caps, supported scalar types, MSSQL-specific gotchas) that affect entity design.
CLI Quick Reference
# Scaffold
npm create @microsoft/rayfin@latest <name> # Create from template
npx rayfin init [directory] # Interactive setup
# Deploy to Fabric (default workflow)
npx rayfin login # Sign in with Entra ID
npx rayfin up # Deploy app + apply schema (canonical)
npx rayfin up status # Check deployment health
npx rayfin up db apply # Schema-only, skip static deploy (advanced)
npx rayfin up staticapp deploy # Redeploy static contentOther versions6 projects use a version of this.
Word for word · 2
Edited · 4
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
Used alongsideProjects with it also use rayfin-connectors, rayfin-functions and 7 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
MicrosoftSkillrayfin-connectors
Use for Rayfin connectors that wire existing Fabric SQL data sources (Lakehouse, Warehouse, SQL Database) into an app as GraphQL-backed entities. Triggers: rayfin connector, rayfin up connector apply, connectors:, fabric-sqlanalytics, fabric-warehouse, fabric-sqldatabase, kusto, kql, eventhouse, workspaceId, itemId, operations:, AppConnectorsSchema, ConnectorsSchema, rayfin/connectors/, metadata.json, connector @role policy, connector claims.sub filter, connector claims.email filter, ConnectorsRayfinClient, rayfin-client.ts, client.connectors, connectorConfig, GraphQLBackedConnector, RestrictedDataApi, schema.ts aggregate, generate entities from metadata, add a use case on specific entities, wire connector into client, call a connector from the SDK, rayfin connector inspect, inspect connector data, sample connector rows, fabric-semanticmodel, --entity, --query, DAX EVALUATE, read-only sample query, rayfin connector search, discover connectable sources, find fabric sources to add, --all-workspaces, --workspace-id, connector search interactive picker, rayfin connector invoke, invoke a connector operation, run executeQuery, --input, --file, RAYFIN_FEATURE_FLAGS, resultSetRowCountLimit, limit rows, row limit, cap rows, too many rows, overflow
Also in 3 projects that use this
MicrosoftSkillrayfin-functions
Use when writing Rayfin user-defined functions (UDFs), invoking functions from frontend code, or using functions CLI commands. Triggers: rayfin functions, udf.func, UserDataFunctions, RayfinContext, FabricContext, AppFunctionsSchema, functions init, dev functions apply, client.functions, invoke, func start, function_app.ts, types.ts, rayfin/functions/, FunctionClient, FunctionsSchema, fabric-user-data-functions, functionsBaseUrl, VITE_RAYFIN_FUNCTIONS_URL, bootstrap.ts, rayfinClient.ts
Also in 3 projects that use this
- +7 more from microsoft
In this repository33 other files it gives its agents.
- AGENTS.mdAGENTS.md
- templates/angular-blankapp/AGENTS.mdAGENTS.md
- templates/angular-dashboard/AGENTS.mdAGENTS.md
- templates/campus-scheduler/AGENTS.mdAGENTS.md
- templates/fabric-atlas/AGENTS.mdAGENTS.md
- templates/field-technician/AGENTS.mdAGENTS.md
- templates/finance-analytics/AGENTS.mdAGENTS.md
- templates/ibcs-trainer/AGENTS.mdAGENTS.md
- templates/maritime-insights/AGENTS.mdAGENTS.md
- templates/paragliding-insights/AGENTS.mdAGENTS.md
- templates/slide-deck/AGENTS.mdAGENTS.md
- templates/static-blankapp/AGENTS.mdAGENTS.md
- templates/todo-local-experimental/AGENTS.mdAGENTS.md
- templates/universal-app/AGENTS.mdAGENTS.md
- template-gallerySkill
- rayfinSkill
- rayfinSkill
- rayfinSkill
- rayfinSkill
- rayfinSkill
- rayfinSkill
- rayfinSkill
- analyticsSkill
- app-designSkill
- authenticationSkill
- build-workflowSkill
- capability-routerSkill
- data-modelingSkill
- daxSkill
- fabric-dataSkill
- graphein-visualsSkill
- headless-previewSkill
- visualsSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

