rayfin-functions
Skill646 starsChanged 24 days agoMITView on GitHub
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, rayfinLocalDev, resolveRayfinFunctionsBaseUrl, VITE_RAYFIN_FUNCTIONS_URL
- Reads credentials
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 1 is distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 32
Read Application authentication in functions/index.md for the configuration, identity model, and deployment requirements.
- Distinctive: line 47
When the user names a Fabric item ("connect to lakehouseA in workspaceB"), turn the workspace + item display names into coordinates:
- Very specific: line 49
If a Fabric CLI (e.g. fab) or Fabric MCP is already available in the workspace, prefer it — it wraps the same endpoints.
- Very specific: line 52
Only fall back to asking the user when the name matches multiple items, the lookup returns 403 (no access), or you can't determine the …
- Very specific: line 56
Read functions/invoking-from-frontend.md before changing frontend routing.
- Very specific: line 68
Import RayfinContext from @microsoft/fabric-user-data-functions — not from @microsoft/rayfin-functions.
- Very specific: line 70
Use import type for data-entity imports — a runtime import pulls the decorator runtime into the functions bundle.
- Very specific: line 71
Never hand-edit rayfin/functions/src/types.ts — typegen regenerates it and will overwrite your edits.
- Very specific: line 72
Never expose a local Functions URL in production.
- Very specific: line 74
Prefer secrets via rayfin secret set <NAME> read through ctx.Secrets.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill 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
Rayfin Functions
Server-side user-defined functions (UDFs) that run in the Fabric runtime and are invocable from your frontend via RayfinClient. Write trusted backend logic once; get a type-safe client call on the frontend.
The full reference lives in the Rayfin guide. Read the doc for the task you're doing before writing code — don't guess API shapes, endpoints, or CLI flags. Read a doc off disk from node_modules/@microsoft/rayfin-guide/assets/docs/<path>, or fetch it with rayfin docs get --module guide --path '<path>' — or get_doc with module: "guide" via MCP.
Where to read
| Task | Doc path |
| Overview, auth configuration and identities, project structure, first function | functions/index.md |
udf.func() API, RayfinContext, data access, importing entities | functions/writing-functions.md |
How types.ts is generated and kept in sync | functions/typegen.md |
| Reading secrets inside a function | functions/secrets.md |
Calling functions from the frontend (client.functions.*.invoke) | functions/invoking-from-frontend.md |
| Connecting to external resources — audiences, recipe chooser, per-resource walkthroughs | functions/connections/index.md |
| CLI: scaffold, local host, deploy | cli/functions/index.md, init.md, dev-apply.md, deploy.md |
Connections and secrets
Read functions/connections/index.md before writing any connection code, and functions/secrets.md before reading a secret. Both are the source of truth; the summary below exists only so you know what to look for.
Enabled Functions require services.functions.auth.type: application.
Read Application authentication in functions/index.md for the configuration, identity model, and deployment requirements.
- Generic connections are declared on the context annotation —
RayfinContext<AppSchema, AudienceType.Sql | AudienceType.Storage>— and read asctx.Tokens.Sql. The annotation is what registers the binding, so the third argument ofudf.func()stays[]. - Supported audiences are
Sql,Storage,Fabric,AzureAI, andADO. ctx.Tokens.*uses the app identity for external resources;ctx.getDataClient()uses the caller's Rayfin token for Rayfin DB access. Keep tokens server-side.- Audiences are resolved by the TypeScript compiler at deploy time, so a type alias works — but prefer literal
AudienceType.Sql, and keep atsconfig.jsonin the functions project. Without one the CLI reads the annotation syntactically, cannot resolve aliases, and warns. - Secrets are declared with
rayfin secret set, recorded inrayfin.yml, and read asctx.Secrets.STRIPE_API_KEY. The CLI generatesrayfin/functions/src/secrets.generated.ts; never hand-edit it and never hard-code a secret name. ctx.getToken()andctx.getSecret()are deprecated and flagged by@typescript-eslint/no-deprecated. Usectx.Tokensandctx.Secrets.
Get the Fabric info for the user
Connection code needs real endpoints — the SQL server or the OneLake path. Resolve these yourself; don't ask the user to paste connection strings. When the user names a Fabric item ("connect to lakehouseA in workspaceB"), turn the workspace + item display names into coordinates:
- If a Fabric CLI (e.g.
fab) or Fabric MCP is already available in the workspace, prefer it — it wraps the same endpoints. - Otherwise call the Fabric REST API directly: base
https://api.fabric.microsoft.com/v1, token fromaz account get-access-token --resource https://api.fabric.microsoft.com.
Only fall back to asking the user when the name matches multiple items, the lookup returns 403 (no access), or you can't determine the workspace. The full lookup workflow is in functions/connections/get-fabric-info.md.
Local functions routing
Read functions/invoking-from-frontend.md before changing frontend routing.
Bundled Vite templates already use rayfinLocalDev() from
@microsoft/rayfin-local-dev. Leave functionsBaseUrl undefined so the SDK
uses /functions/<name>/invoke; the adapter forwards that same-origin route to
the local Functions host selected by rayfin dev.
For custom or older Vite projects, add the adapter as documented. Use
resolveRayfinFunctionsBaseUrl() only when existing code must explicitly
provide a Functions base URL.
For other frameworks, pass the framework-mapped Functions URL only during development.
Guardrails
- Import
RayfinContextfrom@microsoft/fabric-user-data-functions— not from@microsoft/rayfin-functions. - Register every function with
udf.func(name, handler, [])— don't export bare functions. - Use
import typefor data-entity imports — a runtime import pulls the decorator runtime into the functions bundle. - Never hand-edit
rayfin/functions/src/types.ts— typegen regenerates it and will overwrite your edits. - Never expose a local Functions URL in production; leave
functionsBaseUrlundefined soinvoke()targets the deployed backend. - Install resource SDK packages in
rayfin/functions/package.json, not the project root. - Prefer secrets via
rayfin secret set <NAME>read throughctx.Secrets; useprocess.envonly for local debugging.
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
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.
In this repository76 other files it gives its agents.
- common/config/typedoc/AGENTS.mdAGENTS.md
- docs/site/AGENTS.mdAGENTS.md
- .github/skills/react-best-practices/AGENTS.mdAGENTS.md
- packages/docgen/AGENTS.mdAGENTS.md
- packages/guide/AGENTS.mdAGENTS.md
- packages/host-docs/AGENTS.mdAGENTS.md
- packages/tools/AGENTS.mdAGENTS.md
- packages/tools/cli/AGENTS.mdAGENTS.md
- packages/tools/cli/assets/agent-files/AGENTS.mdAGENTS.md
- packages/tools/common/AGENTS.mdAGENTS.md
- packages/tools/docs-lib/AGENTS.mdAGENTS.md
- packages/tools/mcp/AGENTS.mdAGENTS.md
- packages/tools/vscode/AGENTS.mdAGENTS.md
- packages/typescript-sdk/AGENTS.mdAGENTS.md
- packages/typescript-sdk/auth/AGENTS.mdAGENTS.md
- packages/typescript-sdk/core/AGENTS.mdAGENTS.md
- packages/typescript-sdk/data/AGENTS.mdAGENTS.md
- packages/typescript-sdk/storage/AGENTS.mdAGENTS.md
- packages/udf/udf-worker-extension/AGENTS.mdAGENTS.md
- samples/data-app/AGENTS.mdAGENTS.md
- samples/getting-started-auth/AGENTS.mdAGENTS.md
- samples/notes-app/AGENTS.mdAGENTS.md
- samples/todo-app/AGENTS.mdAGENTS.md
- samples/universal-app/template/AGENTS.mdAGENTS.md
- samples/welcome-app-react-auth/AGENTS.mdAGENTS.md
- samples/welcome-app-react-no-auth/AGENTS.mdAGENTS.md
- samples/welcome-app-typescript/AGENTS.mdAGENTS.md
- hotfix-releaseSkill
- launch-vscode-extensionSkill
- openspec-apply-changeSkill
- openspec-archive-changeSkill
- openspec-bulk-archive-changeSkill
- openspec-continue-changeSkill
- openspec-exploreSkill
- openspec-ff-changeSkill
- openspec-new-changeSkill
- openspec-onboardSkill
- openspec-sync-specsSkill
- openspec-verify-changeSkill
- privacy-dfdSkill
- rayfin-cli-uxSkill
- vercel-react-best-practicesSkill
- react-clean-architectureSkill
- run-cli-e2e-locallySkill
- vscode-react-webview-architectureSkill
- vscode-webview-trpc-messagingSkill
- rayfin-connectorsSkill
- rayfinSkill
- rayfin-storageSkill
- rayfin-getting-startedSkill
- app-designSkill
- app-validationSkill
- dax-authoringSkill
- fabric-cliSkill
- fabric-sdkSkill
- playwright-cliSkill
- query-designSkill
- schema-discoverySkill
- visualsSkill
- analyticsSkill
- The first 60 shown.
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.

