microsoft/awesome-rayfin/data-modeling
Claude Code and agent skill by microsoft/awesome-rayfin
- vendor
Checking that the SKILL.md file is still in the repository.
Use when the app needs to store or read data — records, a database, entities, CRUD, lists, "save/remember X", or per-user data with row-level security. This app's data layer is Rayfin's: you declare entities as TypeScript classes with decorators in rayfin/data/, register them in the schema, and read/write them through the typed rayfin-client. Covers: defining an @entity, field decorators, registering it, per-entity access with @role, owner-only row-level security, and the client query/mutation API. Triggers: data, database, model, entity, schema, table, record, CRUD, create, read, update, delete, list, store, save, persist, per-user, row-level security, RLS, access control, ownership.
Install
npx vskill@latest install microsoft/awesome-rayfin/data-modelingSKILL.md
The same SKILL.md was published earlier as microsoft/awesome-rayfin/data-modeling.
Data modeling — entities, schema, and row-level security
This app persists data with Rayfin data. You define entities as decorated TypeScript classes under rayfin/data/, register them in rayfin/data/schema.ts, and read/write them with the typed client from src/services/rayfinClient.ts (getRayfinClient()).
The data service is already enabled in rayfin/rayfin.yml (data: { enabled: true, dialect: mssql }), so you don't need to turn anything on — just add entities.
Data means auth — wire it in. Rayfin data is always accessed as anauthenticated user (there's no anonymous/public data access on Fabric — seeNotes). So adding data isn't complete until authentication is wired in: followthe `authentication` skill (AuthProvider+bootstrapAuth()insrc/main.tsx, the route guard insrc/App.tsx). Per-user rows and row-levelsecurity key off the signed-in identity. Only a purely **static page overpublic data** (no Rayfin data) can skip auth.
Step 1 — install the data package
(@microsoft/rayfin-core — which provides the decorators — and @microsoft/rayfin-client are already in the base app.)
Step 2 — define an entity
Create one file per entity under rayfin/data/, e.g. rayfin/data/Note.ts:
Common field decorators: @uuid(), @text({ min, max }), @boolean(), @date(), plus number/relation decorators. If you're unsure of a decorator or option, check the docs: rayfin docs search '<topic>' --module guide.
Step 3 — register it in the schema
rayfin/data/schema.ts starts empty. Add each entity to the exported schema array and the schema type so the client is typed:
Import entities with the.jsextension ('./Note.js') — Rayfin compiles thedata model as ESM. The client's generic type comes fromUniversalAppSchema(already referenced bysrc/services/rayfinClient.ts).
Step 4 — read and write with the client
Row-level security (owner-only data)
When the user wants "each person sees only their own …", first turn on authentication (see the authentication skill), then add an owner column and a @role policy so the platform enforces access server-side:
@role('authenticated', '*', { policy })grants all operations ('*') to
authenticated users, but the policy restricts each row to its owner — claims.sub (the signed-in user id) must equal the row's user_id.
- Stamp
user_idfrom the session on create:
``ts const session = client.auth.getSession(); if (!session.isAuthenticated || !session.user) throw new Error('Not signed in.'); await client.data.Note.create({ /* … */, user_id: session.user.id }); ``
Row-level security is enforced by Rayfin on the server — the client can't read or write another user's rows regardless of what the UI does.
Notes
- Stable features only. Use
@authenticated/@role('authenticated', …);
don't reach for experimental anonymous/public access (it doesn't deploy on Fabric). If asked for public data, say so and use authenticated access.
- Deploy with
npm run rayfin:upwhen ready; a data-model change ships and
migrates on that deploy.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files. Certified 19 Sep 2026.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingtemplates/universal-app/.agents/skills/data-modeling/SKILL.md
Popularity
- Repository stars
- 95
- Repository forks
- 24
- 7-day trend score
- 23
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/microsoft/awesome-rayfin/data-modeling)