rayfin-functions
Skill1 starsChanged 20 days agoMITView on GitHub
Use only when requested to add trusted backend actions, external API calls, or Rayfin Functions; covers opt-in workspace setup, auth, typed invocation, and validation.
- Installs packages
3 other projects use a version of this.
Adopted by
Most recently taken up by
- microsoft/frontiertour27-BRK390-building-ai-applications-with-microsoft-databases-and-fabrictheir own version, first seen Oct 17, 2026
- microsoft/rayfintheir own version, first seen Oct 13, 2026
- microsoft/aitour27-BRK390-building-ai-applications-with-microsoft-databases-and-fabrictheir own version, first seen Sep 25, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
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 repository19 other files it gives its agents.
- src/field-services-app/AGENTS.mdAGENTS.md
- template/field-services-app/AGENTS.mdAGENTS.md
- lab-instructionsSkill
- lab-vm-updateSkill
- app-deploymentSkill
- app-validationSkill
- dax-authoringSkill
- query-designSkill
- rayfin-connectorsSkill
- rayfinSkill
- rayfin-storageSkill
- app-deploymentSkill
- app-validationSkill
- dax-authoringSkill
- query-designSkill
- rayfin-connectorsSkill
- rayfin-functionsSkill
- rayfinSkill
- rayfin-storageSkill
The file
We split this skill into the rules it gives an agent
9 rules. 0 are common, 1 is distinctive, and 8 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
Use installed guide functions/index.md, functions/writing-functions.md, functions/typegen.md, functions/invoking-from-frontend.md, and …
- Distinctive: line 17
After explicit feature approval, run from the app root:
- Very specific: line 25
Keep src/function_app.ts, generated src/types.ts, host.json, and local host settings in packages/functions/.
- Very specific: line 28
Keep Functions scripts build: tsc --build and build:watch: tsc --build --watch.
- Very specific: line 43
Do not replace other services.
- Very specific: line 47
Import UserDataFunctions and type RayfinContext from @microsoft/fabric-user-data-functions, not the frontend adapter:
- Very specific: line 56
Use RayfinContext<FieldServiceSchema> for caller-scoped data and ctx.getDataClient() so database policies apply.
- Very specific: line 60
Use npx rayfin secret set <NAME> with its masked prompt only for an approved target, then read ctx.Secrets.NAME.
- Very specific: line 68
After an approved full deployment exists, npx rayfin dev functions apply runs the host and typegen watcher.
“Common” is measured: kept by at least 6 in 10 of the 3 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
Optional Functions
Functions are disabled in this lab. Do not install their dependencies, enable them, move seed/reset work server-side, or add feature UI for a guidance-only request.
Read before setup
Use installed guide functions/index.md, functions/writing-functions.md, functions/typegen.md, functions/invoking-from-frontend.md, and cli/functions/{init,dev-apply,deploy}.md. Read functions/secrets.md and functions/connections/index.md for sensitive/external work. Resolve docs through package rayfinDocs metadata.
The 2.0.0 guide's init page describes a generic nested project. The installed 2.0.0 CLI's functions init --help additionally supports --path and npm workspaces; use that verified surface here. Require this app's Node >=22.13.0, Azure Functions Core Tools for local hosting, and an approved Fabric deployment for backend access.
Opt in without replacing the app
After explicit feature approval, run from the app root:
npx rayfin functions init --path packages/functionsThis writes files, enables Functions, installs/builds, generates types, and may refresh agent files. It is not a preview. Review the diff and retain this app's curated guidance, MCP pin, auth/data configuration, and lockfile ownership. Do not use --force. The existing packages/* workspace glob covers the new package.
- Keep
src/function_app.ts, generatedsrc/types.ts,host.json, and local host settings inpackages/functions/. Rename the generated generic package to@field-services/functions; retainprivate, ESM, and its actual emittedmainpath (dist/src/function_app.jsin the 2.0.0 CLI scaffold). - The server dependency is
@microsoft/fabric-user-data-functions, matched to CLI 2.0.0 by initialization. Use^2.0.0for subsequent lab additions. Preserve the existing TypeScript 5 toolchain; do not copy scaffold TypeScript 6 settings. - Install the frontend adapter at the root with
npm install @microsoft/rayfin-functions@^2.0.0 --workspace @field-services/frontend. Add@field-services/shared: "*"to Functions when consuming its contracts, and@field-services/functions: "*"to frontend for a type-only contract export. Reconcile all installs with one rootpackage-lock.json; do not maintain a nested lockfile. - Keep Functions scripts
build: tsc --buildandbuild:watch: tsc --build --watch. Add its project to roottsconfig.jsonreferences and the serial root build after shared and before frontend. Add a Functions reference to../sharedwhen importing shared types; do not point at the configuration-onlyrayfin/project. - Export
./typesfrom the Functions package withtypes: "./dist/src/types.d.ts"; frontend imports onlyAppFunctionsSchemafrom@field-services/functions/typeswithimport type. Add../functionsto frontend's TypeScript project references so clean builds produce that declaration first. Never loadfunction_appor server dependencies in the browser. Keep generated contracts browser-safe.
Merge only the Functions block into rayfin/rayfin.yml:
services:
functions:
enabled: true
path: packages/functions
auth:
type: application
buildCommand: npm run buildDo not replace other services. Full approved npx rayfin up is required to sync the remote auth/service setting; up functions deploy alone only uploads code.
Register and authorize
Import UserDataFunctions and type RayfinContext from @microsoft/fabric-user-data-functions, not the frontend adapter:
import { UserDataFunctions } from '@microsoft/fabric-user-data-functions';
const udf = new UserDataFunctions();
udf.func('greet', (name: string): string => `Hello ${name}`, []);Use RayfinContext<FieldServiceSchema> for caller-scoped data and ctx.getDataClient() so database policies apply. Validate input, bound work, stamp owner fields from ctx.user.id, and return safe typed results. Explicitly enforce any operation-specific authorization; sign-in or the manager view alone does not grant a privileged action.
External ctx.Tokens connections run as the app identity (currently the Fabric app item owner), not the invoking user. Declare audiences per the connection guide and grant that identity the required resource permissions; an audience declaration grants nothing. Keep tokens server-side. Do not use raw SQL to bypass caller policies.
Use npx rayfin secret set <NAME> with its masked prompt only for an approved target, then read ctx.Secrets.NAME. The CLI generates src/secrets.generated.ts; never edit it. Local secrets belong under Values in ignored packages/functions/local.settings.json. Never commit local settings or return/log secrets.
Compose and prove
In the existing RayfinClientService.ts factory add functions: functionsService<AppFunctionsSchema>() from @microsoft/rayfin-functions, preserving runtime config, auth, and data. For this custom Vite client, follow the 2.0.0 invocation guide: functionsBaseUrl: resolveRayfinFunctionsBaseUrl() from @microsoft/rayfin-local-dev uses the adapter's local route and returns undefined in production. Preserve the current Vite plugin and loopback binding; do not hard-code a production local-host URL.
client.functions.greet.invoke({ name }) returns output directly and throws on failure. Catch failures at the UI boundary and display actionable errors; do not turn failure into a successful empty result.
After an approved full deployment exists, npx rayfin dev functions apply runs the host and typegen watcher; npm run dev:fabric starts the frontend separately. Alternatively npm run dev starts both and applies backend state. Typegen runs during init/dev, not via a fictitious standalone command; never hand-edit src/types.ts.
Run serial typecheck/build/tests, then invoke a safe function through the browser and verify changed code, invalid inputs, permission denial, and host-down errors. A local host failure must not silently invoke deployed code. After an approved full deploy, invoke again at the actual hosting URL with the intended caller; verify any writes by reload and clean up only disposable test records. npx rayfin up functions deploy is for later code-only retries, not auth migration. Report platform/identity limitations rather than claiming local success proves deployment.
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.

