[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M699WVQD0AARRCAPRHY6XP2S":3,"skill-same:01M699WVQD0AARRCAPRHY6XP2S":59},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":29,"linkOnly":30,"markdownContent":31,"markdownBody":32,"frontMatter":33,"refName":36,"commitSha":37,"skillDirectory":38,"forksCount":39,"repositoryHtmlUrl":40,"repositoryHomepageUrl":6,"ownerHtmlUrl":41,"ownerBlogUrl":42,"ownerDescription":43,"updatedAt":44,"install":45,"resources":58},"01M699WVQD0AARRCAPRHY6XP2S","rayfin-functions",null,"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\u002Ffunctions\u002F, FunctionClient, FunctionsSchema, fabric-user-data-functions, functionsBaseUrl, rayfinLocalDev, resolveRayfinFunctionsBaseUrl, VITE_RAYFIN_FUNCTIONS_URL","microsoft\u002Frayfin","microsoft","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6154722?v=4","01M698VYDXZ6JW5WH3CRV650R8","Microsoft","01M699VK9NEV8GH0Y5JKT1G8XG",662,"MIT","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Frayfin\u002Fblob\u002Fmain\u002Fpackages\u002Ftools\u002Fcli\u002Fassets\u002Fagent-files\u002Fskills\u002Frayfin-functions\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000009","前端开发","SCENARIO","使用场景",[24,25,26,27,9,28],"rayfin functions","frontend","writing","cli","init","2026-11-10 10:12:30",false,"---\nname: rayfin-functions\ndescription: \"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\u002Ffunctions\u002F, FunctionClient, FunctionsSchema, fabric-user-data-functions, functionsBaseUrl, rayfinLocalDev, resolveRayfinFunctionsBaseUrl, VITE_RAYFIN_FUNCTIONS_URL\"\nmetadata:\n  author: microsoft\n  version: \"0.2.0\"\n---\n\n# Rayfin Functions\n\nServer-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.\n\nThe 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\u002F@microsoft\u002Frayfin-guide\u002Fassets\u002Fdocs\u002F\u003Cpath>`, or fetch it with `rayfin docs get --module guide --path '\u003Cpath>'` — or `get_doc` with `module: \"guide\"` via MCP.\n\n## Where to read\n\n| Task | Doc path |\n| --- | --- |\n| Overview, auth configuration and identities, project structure, first function | `functions\u002Findex.md` |\n| `udf.func()` API, `RayfinContext`, data access, importing entities | `functions\u002Fwriting-functions.md` |\n| How `types.ts` is generated and kept in sync | `functions\u002Ftypegen.md` |\n| Reading secrets inside a function | `functions\u002Fsecrets.md` |\n| Calling functions from the frontend (`client.functions.*.invoke`) | `functions\u002Finvoking-from-frontend.md` |\n| Connecting to external resources — audiences, recipe chooser, per-resource walkthroughs | `functions\u002Fconnections\u002Findex.md` |\n| CLI: scaffold, local host, deploy | `cli\u002Ffunctions\u002Findex.md`, `init.md`, `dev-apply.md`, `deploy.md` |\n\n## Connections and secrets\n\n**Read `functions\u002Fconnections\u002Findex.md` before writing any connection code, and `functions\u002Fsecrets.md` before reading a secret.** Both are the source of truth; the summary below exists only so you know what to look for.\n\nEnabled Functions require `services.functions.auth.type: application`.\nRead **Application authentication** in `functions\u002Findex.md` for the configuration, identity model, and deployment requirements.\n\n- Generic connections are declared **on the context annotation** — `RayfinContext\u003CAppSchema, AudienceType.Sql | AudienceType.Storage>` — and read as `ctx.Tokens.Sql`.\n  The annotation is what registers the binding, so the third argument of `udf.func()` stays `[]`.\n- Supported audiences are `Sql`, `Storage`, `Fabric`, `AzureAI`, and `ADO`.\n- `ctx.Tokens.*` uses the app identity for external resources; `ctx.getDataClient()` uses the caller's Rayfin token for Rayfin DB access.\n  Keep tokens server-side.\n- Audiences are resolved by the TypeScript compiler at deploy time, so a type alias works — but prefer literal `AudienceType.Sql`, and keep a `tsconfig.json` in the functions project. Without one the CLI reads the annotation syntactically, cannot resolve aliases, and warns.\n- Secrets are declared with `rayfin secret set`, recorded in `rayfin.yml`, and read as `ctx.Secrets.STRIPE_API_KEY`. The CLI generates `rayfin\u002Ffunctions\u002Fsrc\u002Fsecrets.generated.ts`; **never hand-edit it and never hard-code a secret name**.\n- `ctx.getToken()` and `ctx.getSecret()` are **deprecated** and flagged by `@typescript-eslint\u002Fno-deprecated`. Use `ctx.Tokens` and `ctx.Secrets`.\n\n### Get the Fabric info for the user\n\nConnection code needs real endpoints — the SQL server or the OneLake path.\n**Resolve these yourself; don't ask the user to paste connection strings.**\nWhen the user names a Fabric item (\"connect to lakehouseA in workspaceB\"), turn the workspace + item display names into coordinates:\n\n- If a **Fabric CLI** (e.g. `fab`) or **Fabric MCP** is already available in the workspace, prefer it — it wraps the same endpoints.\n- Otherwise call the **Fabric REST API** directly: base `https:\u002F\u002Fapi.fabric.microsoft.com\u002Fv1`, token from `az account get-access-token --resource https:\u002F\u002Fapi.fabric.microsoft.com`.\n\nOnly 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\u002Fconnections\u002Fget-fabric-info.md`.\n\n## Local functions routing\n\nRead `functions\u002Finvoking-from-frontend.md` before changing frontend routing.\nBundled Vite templates already use `rayfinLocalDev()` from\n`@microsoft\u002Frayfin-local-dev`. Leave `functionsBaseUrl` undefined so the SDK\nuses `\u002Ffunctions\u002F\u003Cname>\u002Finvoke`; the adapter forwards that same-origin route to\nthe local Functions host selected by `rayfin dev`.\nFor custom or older Vite projects, add the adapter as documented. Use\n`resolveRayfinFunctionsBaseUrl()` only when existing code must explicitly\nprovide a Functions base URL.\nFor other frameworks, pass the framework-mapped Functions URL only during development.\n\n## Guardrails\n\n- Import `RayfinContext` from `@microsoft\u002Ffabric-user-data-functions` — **not** from `@microsoft\u002Frayfin-functions`.\n- Register every function with `udf.func(name, handler, [])` — don't export bare functions.\n- Use `import type` for data-entity imports — a runtime import pulls the decorator runtime into the functions bundle.\n- Never hand-edit `rayfin\u002Ffunctions\u002Fsrc\u002Ftypes.ts` — typegen regenerates it and will overwrite your edits.\n- Never expose a local Functions URL in production; leave `functionsBaseUrl` undefined so `invoke()` targets the deployed backend.\n- Install resource SDK packages in `rayfin\u002Ffunctions\u002Fpackage.json`, not the project root.\n- Prefer secrets via `rayfin secret set \u003CNAME>` read through `ctx.Secrets`; use `process.env` only for local debugging.\n","# Rayfin Functions\n\nServer-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.\n\nThe 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\u002F@microsoft\u002Frayfin-guide\u002Fassets\u002Fdocs\u002F\u003Cpath>`, or fetch it with `rayfin docs get --module guide --path '\u003Cpath>'` — or `get_doc` with `module: \"guide\"` via MCP.\n\n## Where to read\n\n| Task | Doc path |\n| --- | --- |\n| Overview, auth configuration and identities, project structure, first function | `functions\u002Findex.md` |\n| `udf.func()` API, `RayfinContext`, data access, importing entities | `functions\u002Fwriting-functions.md` |\n| How `types.ts` is generated and kept in sync | `functions\u002Ftypegen.md` |\n| Reading secrets inside a function | `functions\u002Fsecrets.md` |\n| Calling functions from the frontend (`client.functions.*.invoke`) | `functions\u002Finvoking-from-frontend.md` |\n| Connecting to external resources — audiences, recipe chooser, per-resource walkthroughs | `functions\u002Fconnections\u002Findex.md` |\n| CLI: scaffold, local host, deploy | `cli\u002Ffunctions\u002Findex.md`, `init.md`, `dev-apply.md`, `deploy.md` |\n\n## Connections and secrets\n\n**Read `functions\u002Fconnections\u002Findex.md` before writing any connection code, and `functions\u002Fsecrets.md` before reading a secret.** Both are the source of truth; the summary below exists only so you know what to look for.\n\nEnabled Functions require `services.functions.auth.type: application`.\nRead **Application authentication** in `functions\u002Findex.md` for the configuration, identity model, and deployment requirements.\n\n- Generic connections are declared **on the context annotation** — `RayfinContext\u003CAppSchema, AudienceType.Sql | AudienceType.Storage>` — and read as `ctx.Tokens.Sql`.\n  The annotation is what registers the binding, so the third argument of `udf.func()` stays `[]`.\n- Supported audiences are `Sql`, `Storage`, `Fabric`, `AzureAI`, and `ADO`.\n- `ctx.Tokens.*` uses the app identity for external resources; `ctx.getDataClient()` uses the caller's Rayfin token for Rayfin DB access.\n  Keep tokens server-side.\n- Audiences are resolved by the TypeScript compiler at deploy time, so a type alias works — but prefer literal `AudienceType.Sql`, and keep a `tsconfig.json` in the functions project. Without one the CLI reads the annotation syntactically, cannot resolve aliases, and warns.\n- Secrets are declared with `rayfin secret set`, recorded in `rayfin.yml`, and read as `ctx.Secrets.STRIPE_API_KEY`. The CLI generates `rayfin\u002Ffunctions\u002Fsrc\u002Fsecrets.generated.ts`; **never hand-edit it and never hard-code a secret name**.\n- `ctx.getToken()` and `ctx.getSecret()` are **deprecated** and flagged by `@typescript-eslint\u002Fno-deprecated`. Use `ctx.Tokens` and `ctx.Secrets`.\n\n### Get the Fabric info for the user\n\nConnection code needs real endpoints — the SQL server or the OneLake path.\n**Resolve these yourself; don't ask the user to paste connection strings.**\nWhen the user names a Fabric item (\"connect to lakehouseA in workspaceB\"), turn the workspace + item display names into coordinates:\n\n- If a **Fabric CLI** (e.g. `fab`) or **Fabric MCP** is already available in the workspace, prefer it — it wraps the same endpoints.\n- Otherwise call the **Fabric REST API** directly: base `https:\u002F\u002Fapi.fabric.microsoft.com\u002Fv1`, token from `az account get-access-token --resource https:\u002F\u002Fapi.fabric.microsoft.com`.\n\nOnly 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\u002Fconnections\u002Fget-fabric-info.md`.\n\n## Local functions routing\n\nRead `functions\u002Finvoking-from-frontend.md` before changing frontend routing.\nBundled Vite templates already use `rayfinLocalDev()` from\n`@microsoft\u002Frayfin-local-dev`. Leave `functionsBaseUrl` undefined so the SDK\nuses `\u002Ffunctions\u002F\u003Cname>\u002Finvoke`; the adapter forwards that same-origin route to\nthe local Functions host selected by `rayfin dev`.\nFor custom or older Vite projects, add the adapter as documented. Use\n`resolveRayfinFunctionsBaseUrl()` only when existing code must explicitly\nprovide a Functions base URL.\nFor other frameworks, pass the framework-mapped Functions URL only during development.\n\n## Guardrails\n\n- Import `RayfinContext` from `@microsoft\u002Ffabric-user-data-functions` — **not** from `@microsoft\u002Frayfin-functions`.\n- Register every function with `udf.func(name, handler, [])` — don't export bare functions.\n- Use `import type` for data-entity imports — a runtime import pulls the decorator runtime into the functions bundle.\n- Never hand-edit `rayfin\u002Ffunctions\u002Fsrc\u002Ftypes.ts` — typegen regenerates it and will overwrite your edits.\n- Never expose a local Functions URL in production; leave `functionsBaseUrl` undefined so `invoke()` targets the deployed backend.\n- Install resource SDK packages in `rayfin\u002Ffunctions\u002Fpackage.json`, not the project root.\n- Prefer secrets via `rayfin secret set \u003CNAME>` read through `ctx.Secrets`; use `process.env` only for local debugging.\n",{"name":5,"metadata":34,"description":7},{"author":9,"version":35},"0.2.0","main","0979439a7a0806abd0ee48c2619b37f297ae1324","packages\u002Ftools\u002Fcli\u002Fassets\u002Fagent-files\u002Fskills\u002Frayfin-functions",77,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Frayfin","https:\u002F\u002Fgithub.com\u002Fmicrosoft","https:\u002F\u002Fopensource.microsoft.com","Open source projects and samples from Microsoft","2026-11-12 01:21:10",{"source":8,"skillName":5,"commands":46,"prompt":56,"zipAvailable":57},[47,50,53],{"tool":48,"command":49},"npx","npx skills add microsoft\u002Frayfin --skill rayfin-functions",{"tool":51,"command":52},"bunx","bunx skills add microsoft\u002Frayfin --skill rayfin-functions",{"tool":54,"command":55},"pnpm","pnpm dlx skills add microsoft\u002Frayfin --skill rayfin-functions","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Frayfin\u002Fblob\u002Fmain\u002Fpackages\u002Ftools\u002Fcli\u002Fassets\u002Fagent-files\u002Fskills\u002Frayfin-functions\u002FSKILL.md",true,[],[60,71,89,98,117,125],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":29},"01M699YEY2QDVPKTZS3HR9AX84","rayfin-getting-started","Use when starting or creating a NEW Rayfin app, or when a Rayfin task comes up and you are not yet inside a Rayfin project. Gets you into a project with the Rayfin CLI, then hands off to the authoritative, version-locked in-project rayfin skill\u002Fdocs that own all in-project work. Triggers: build a Rayfin app, start a Rayfin project, create a new Rayfin app, create-rayfin, npm create @microsoft\u002Frayfin, rayfin init, scaffold rayfin, rayfin CLI, rayfin template, universal app, awesome-rayfin gallery, get started with Rayfin","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Frayfin\u002Fblob\u002Fmain\u002Fskills\u002Frayfin-getting-started\u002FSKILL.md",[],[67,68,69,28,9,70,27],"rayfin getting started","rayfin","scaffold","docs",{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":85,"publishedAt":29},"01M699YCN4ZDW2AMDP4NVJ2QGC","visuals","Use when user wants to incorporate charts, graphs, data grid,  or other visual representations of data into their project. Use VegaVisual and DataGrid components to create these visuals,  utilizing the shared DataTable input, formatting, theme, and interactivity. Covers the onInteraction selection\u002Fclick events host apps consume, named multi-table data input for layered overlays and reference lines, and Vega-Lite native selections. Triggers: chart, graph, plot, dashboard, KPI, metric, trend, scorecard, data grid, visualize.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Frayfin\u002Fblob\u002Fmain\u002Fsamples\u002Funiversal-app\u002Ftemplate\u002F.agents\u002Fskills\u002Fvisuals\u002FSKILL.md",[77,80],{"categoryNo":78,"categoryName":79,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000013","分析与可视化",{"categoryNo":81,"categoryName":82,"taxonomyType":83,"taxonomyTypeDesc":84},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",[73,86,87,88],"components","dashboard","visualize",{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":29},"01M699YBEP146MJZJNN8YEBZ2G","schema-discovery","Explore Power BI semantic model schemas using DAX INFO functions. Progressive metadata discovery strategy, scope estimation, and narrowing techniques for tables, columns, measures, and relationships.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Frayfin\u002Fblob\u002Fmain\u002Fsamples\u002Funiversal-app\u002Ftemplate\u002F.agents\u002Fskills\u002Fschema-discovery\u002FSKILL.md",[],[96,97],"schema discovery","dax",{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":113,"publishedAt":29},"01M699Y9E80WYFKD1S4MT4B1CS","query-design","Separates DAX data-fetching from TypeScript presentation. Guides when to use  DAX vs. TypeScript vs. Vega-Lite for aggregation, total rows, FORMAT(), SELECTCOLUMNS,  BLANK handling, filtering, multi-grain queries, cross-filtering and cross-highlight subset\u002Foverlay queries, and format strings.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Frayfin\u002Fblob\u002Fmain\u002Fsamples\u002Funiversal-app\u002Ftemplate\u002F.agents\u002Fskills\u002Fquery-design\u002FSKILL.md",[104,107,110],{"categoryNo":105,"categoryName":106,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000003","演示文稿",{"categoryNo":108,"categoryName":109,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000015","视觉设计",{"categoryNo":111,"categoryName":112,"taxonomyType":83,"taxonomyTypeDesc":84},"01JBSEEDCAT000000000000032","设计师",[114,115,97,116],"query design","design","typescript",{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":123,"publishedAt":29},"01M699Y7CKZ55QSYFE827RRVJE","functions-capability","Apply and build the Universal App functions capability. Use for trusted server-side logic, secrets, external APIs, custom model endpoints, published Fabric data agents, webhooks, or privileged operations.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Frayfin\u002Fblob\u002Fmain\u002Fsamples\u002Funiversal-app\u002Ftemplate\u002F.agents\u002Fskills\u002Ffunctions-capability\u002FSKILL.md",[],[124],"functions capability",{"skillNo":126,"name":127,"nameZh":6,"description":128,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":129,"categories":130,"keywords":131,"publishedAt":29},"01M699Y5R87YE620T78Z30KQSA","fabric-sdk","How to query Fabric data from a running app through the Rayfin connectors client. Use getRayfinClient().connectors.\u003Cname>.executeQuery to run DAX against a semantic model, and toQueryResult to normalize the response.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Frayfin\u002Fblob\u002Fmain\u002Fsamples\u002Funiversal-app\u002Ftemplate\u002F.agents\u002Fskills\u002Ffabric-sdk\u002FSKILL.md",[],[132,133,97,134,68,135],"sdk","fabric sdk","rayfin connectors","connectors"]