AGENT SKILL

Rayfin 应用创建与入门

rayfin-getting-started

当开始或创建全新的 Rayfin 应用,或遇到 Rayfin 任务但尚未进入 Rayfin 项目时使用。通过 Rayfin CLI 帮助你进入项目,然后移交给权威的、版本锁定的项目内 rayfin 技能/文档来负责所有项目内工作。触发词:build a Rayfin app、start a Rayfin project、create a new Rayfin app、create-rayfin、npm create @microsoft/rayfin、rayfin init、scaffold rayfin、rayfin CLI、rayfin template、universal app、awesome-rayfin gallery、get started with Rayfin

使用场景代码实现
License 许可
MIT
所属仓库
microsoft/rayfin
最近更新
2026-11-12
Stars
★ 662
Forks
77

01 前言 Front Matter

name
rayfin-getting-started
metadata
{ "author": "microsoft", "version": "0.4.0" }
description
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/docs 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/rayfin, rayfin init, scaffold rayfin, rayfin CLI, rayfin template, universal app, awesome-rayfin gallery, get started with Rayfin

03 SKILL.md 正文

Rayfin (Getting Started)

Rayfin is a Backend-as-a-Service: define your data model with TypeScript decorators and Rayfin provides auth, a typed data API, storage, and Fabric hosting.

This skill only handles getting started — getting you from zero into a working Rayfin project, then handing off. The moment you're in a project, the authoritative, version-locked skill at .agents/skills/rayfin/SKILL.md — alongside the package docs in node_modules and the rayfin docs CLI — owns everything else: schema, auth, storage, querying, deployment. Load it and stop using this one.

Route, don't improvise

Rayfin's specifics are version-locked per project — schema/decorator syntax, the typed data API and client queries, auth, storage, and deployment all live in the project's own skill and rayfin docs. Never answer them from memory; remembered Rayfin APIs are routinely wrong against the installed version. Get into a project, read .agents/skills/rayfin/SKILL.md, then follow it for version-matched signatures. The in-project skill file and the rayfin docs CLI are available the moment a project exists — including right after you scaffold one, in the same session. The rayfin MCP server is an optional extra that most projects do not install; if it happens to be available it is a convenience, never a prerequisite. Lean on the in-project skill file plus rayfin docs.

Being blocked does not unlock memory. Only treat yourself as blocked if you can reach none of the version-matched sources — you can't read .agents/skills/rayfin/SKILL.md and can't run rayfin docs (e.g. tool permissions denied). The rayfin MCP server not being installed or loaded is not a blocker. When genuinely blocked, say you need those sources to answer accurately and stop there — don't offer a "general approach" or example code "in the meantime"; that stopgap is exactly the fabrication this skill exists to prevent.

Already in a Rayfin project?

Check this first — before scaffolding anything, even when the user says "build" or "set up a new app". A directory is a Rayfin project if it has rayfin/rayfin.yml or a package.json depending on @microsoft/rayfin-*. Environment signals alone are enough: if the workspace context shows either — even when you can't open the files yet — treat it as an existing project and continue in place. Never stand up a nested or sibling project.

  • Already in one → load .agents/skills/rayfin/SKILL.md and use rayfin docs (or the rayfin MCP, if already installed). Stop using this skill.
  • Existing non-Rayfin app here → add Rayfin in place with npx rayfin init (don't scaffold a separate project), then load the in-project skill.
  • Empty directory → scaffold (below), then load the in-project skill from the project root.

Scaffold a new project

npm create @microsoft/rayfin@latest is a thin wrapper around rayfin init. As an agent you run non-interactively (stdin isn't a TTY), so use the npx -y form — npm create can mishandle piped stdin and strip flags, and --project-name is required non-interactively.

# Create non-interactively. --project-name is required; the template is pinned.
npx -y @microsoft/create-rayfin@latest --project-name <app-name> --template universal-app

# Or add Rayfin into an existing/empty directory
npx rayfin init [directory]

Always scaffold universal-app. Don't browse the gallery and don't pick a domain-specific template. The Universal App is a deliberately small React + Vite base with a built-in capability router that pulls in the right Rayfin services, npm modules, and skills on demand, so the domain shape (analytics, CRUD, storage, functions) gets decided inside the project rather than at scaffold time. The project's own .agents/skills/ own that decision, and they are version-matched in a way a scaffold-time template choice is not.

Mind the project root before loading the in-project skill: create-rayfin creates a child project directory (named from --project-name, slugified), so cd into it; an in-place rayfin init scaffolds in the current directory, so you're already there. Once at the project root, load its .agents/skills/rayfin/SKILL.md and let its capability router take over.

04 同仓库更多 Skills

microsoft
microsoft/rayfin

Rayfin 应用创建与入门

rayfin-getting-started

在启动或创建新的 Rayfin 应用时使用,或在出现 Rayfin 任务但尚未进入 Rayfin 项目时使用。它会通过 Rayfin CLI 带你进入项目,然后移交给项目内权威的、版本锁定的 rayfin 技能/文档,由它们负责所有项目内工作。触发词:构建 Rayfin 应用、启动 Rayfin 项目、创建新的 Rayfin 应用、create-rayfin、npm create @microsoft/rayfin、rayfin init、scaffold rayfin、rayfin CLI、rayfin template、universal app、awesome-rayfin gallery、get started with Rayfin。

软件开发工程师开发环境与工具链管理
★ 662
microsoft
microsoft/rayfin

数据可视化图表实现

visuals

当用户想要在项目中加入图表、图形、数据网格或其他数据可视化表示时使用。使用 VegaVisual 和 DataGrid 组件创建这些可视化,利用共享的 DataTable 输入、格式设置、主题和交互性。涵盖宿主应用消费的 onInteraction 选择/点击事件、用于分层叠加和参考线的命名多表数据输入,以及 Vega-Lite 原生选择。触发词:chart、graph、plot、dashboard、KPI、metric、trend、scorecard、data grid、visualize。

软件开发工程师前端开发与界面实现
★ 662
microsoft
microsoft/rayfin

Power BI 语义模型探查

schema-discovery

使用 DAX INFO 函数探索 Power BI 语义模型架构。包括渐进式元数据发现策略、范围估计,以及针对表、列、度量值和关系的缩小范围技巧。

数据分析师数据分析与报告
★ 662
microsoft
microsoft/rayfin

Power BI 查询设计

query-design

将 DAX 数据获取与 TypeScript 呈现相分离。指导何时使用 DAX、TypeScript 或 Vega-Lite 来进行聚合、总计行、FORMAT()、SELECTCOLUMNS、BLANK 处理、筛选、多粒度查询、交叉筛选与交叉高亮的子集/覆盖查询,以及格式字符串。

数据分析师数据分析与报告
★ 662
microsoft
microsoft/rayfin

Universal App 函数能力开发

functions-capability

应用并构建 Universal App 的函数能力。用于可信的服务器端逻辑、密钥(secrets)、外部 API、自定义模型端点、已发布的 Fabric 数据智能体、Webhook 或特权操作。

软件开发工程师代码实现
★ 662
microsoft
microsoft/rayfin

Fabric 语义模型 DAX 查询

fabric-sdk

如何通过运行中的应用里的 Rayfin connectors 客户端查询 Fabric 数据。使用 getRayfinClient().connectors.<name>.executeQuery 对语义模型执行 DAX 查询,并使用 toQueryResult 规范化响应。

数据工程师数据分析与报告
★ 662