data-modeling
Skill108 starsChanged 5 months agoMITView on GitHub
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.
- Installs packages
We split this skill into the rules it gives an agent
3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.
0
Common
Most of the 12 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 45
Create one file per entity under rayfin/data/, e.g.
- Distinctive: line 105
When the user wants "each person sees only their own …", first turn on
- Very specific: line 142
Stable features only: Use @authenticated / @role('authenticated', …).
“Common” is measured: kept by at least 6 in 10 of the 12 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
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 an authenticated user (there's no anonymous/public data access on Fabric — see Notes). So adding data isn't complete until authentication is wired in: follow the
authenticationskill (AuthProvider+bootstrapAuth()insrc/main.tsx, the route guard insrc/App.tsx). Per-user rows and row-level security key off the signed-in identity. Only a purely static page over public data (no Rayfin data) can skip auth.
Step 1 — install the data package
npm install @microsoft/rayfin-data(@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:
import { entity, role, text, boolean, date, uuid } from '@microsoft/rayfin-core';
@entity()
export class Note {
@uuid() id!: string;
@text({ min: 1, max: 200 }) title!: string;
@text() body!: string;
@boolean() pinned!: boolean;
@date() createdAt!: Date;
}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 { Note } from './Note.js';
export type UniversalAppSchema = {
Note: Note;
};
export const schema = [Note];Import entities with the
.jsextension ('./Note.js') — Rayfin compiles the data model as ESM. The client's generic type comes fromUniversalAppSchema(already referenced bysrc/services/rayfinClient.ts).
Step 4 — read and write with the client
import { getRayfinClient } from '@/services/rayfinClient';
const client = getRayfinClient();
// query
const notes = await client.data.Note
.select(['id', 'title', 'body', 'pinned', 'createdAt'])
.orderBy({ createdAt: 'desc' })
.execute();
// create / update / delete
const note = await client.data.Note.create({ title, body, pinned: false, createdAt: new Date() });
await client.data.Note.update({ id }, { pinned: true });
await client.data.Note.delete({ id });
const one = await client.data.Note.findById(id);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:
import { entity, role, text, boolean, date, uuid } from '@microsoft/rayfin-core';
@entity()
@role('authenticated', '*', {
policy: (claims, item) => claims.sub.eq(item.user_id),
})
export class Note {
@uuid() id!: string;
@text({ min: 1, max: 200 }) title!: string;
@text() body!: string;
@boolean() pinned!: boolean;
@date() createdAt!: Date;
@text() user_id!: string;
}@role('authenticated', '*', { policy })grants all operations ('*') to authenticated users, but thepolicyrestricts each row to its owner —claims.sub(the signed-in user id) must equal the row'suser_id.Stamp
user_idfrom the session on create: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.
Other versions13 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- microsoft/rayfin★ 64614% same
Wrote their own version · 12
- nimadorostkar/Claude-Skills-collection★ 29same name
- jdm4pku/RE-Skills★ 26same name
- khuynh22/agent-dev-team★ 9same name
- MartinOlivero/saas-builder★ 4same name
- bjornjee/skills★ 2same name
- mmondora/claude-skills★ 1same name
- SWEStash/swe-workflow-skills★ 1same name
- anurag-azure/skills★ 0same name
- LucSena/how-to-build-software★ 0same name
- MANVENDRA-github/agentry★ 0same name
2 more not listed
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.
Used alongsideProjects with it also use containerization, incident-response and 4 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
mmondoraSkillcontainerization
Docker best practices for cloud-native applications. Multi-stage builds, distroless images, security scanning, non-root users, Cloud Run orchestration. Use when writing Dockerfiles, configuring container builds, or deploying to Cloud Run/GKE.
Also in 3 projects that use this
AnthropicSkillincident-response
Run an incident response workflow — triage, communicate, and write postmortem. Trigger with "we have an incident", "production is down", an alert that needs severity assessment, a status update mid-incident, or when writing a blameless postmortem after resolution.
Also in 6 projects that use this
OpenAISkillobservability
Vercel Observability expert guidance — Drains (logs, traces, speed insights, web analytics), Web Analytics, Speed Insights, runtime logs, custom events, OpenTelemetry integration, and monitoring dashboards. Use when instrumenting, debugging, or optimizing application performance and user experience on Vercel.
Also in 6 projects that use this
ElasticSkillaccessibility
Accessibility guidance for Kibana. Use this skill when working with or reviewing EUI components, resolving a11y-related (@elastic/eui) ESLint issues, and ensuring proper use of ARIA attributes, focus management, keyboard interactions, and accessible naming conventions.
Also in 5 projects that use this
MicrosoftSkillapi-design
Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.
Also in 8 projects that use this
Microsoft AzureSkillgit-workflow
Squad branching model: dev-first workflow with insiders preview channel
Also in 3 projects that use this
In this repository33 other files it gives its agents.
- AGENTS.mdAGENTS.md
- templates/angular-blankapp/AGENTS.mdAGENTS.md
- templates/angular-dashboard/AGENTS.mdAGENTS.md
- templates/campus-scheduler/AGENTS.mdAGENTS.md
- templates/fabric-atlas/AGENTS.mdAGENTS.md
- templates/field-technician/AGENTS.mdAGENTS.md
- templates/finance-analytics/AGENTS.mdAGENTS.md
- templates/ibcs-trainer/AGENTS.mdAGENTS.md
- templates/maritime-insights/AGENTS.mdAGENTS.md
- templates/paragliding-insights/AGENTS.mdAGENTS.md
- templates/slide-deck/AGENTS.mdAGENTS.md
- templates/static-blankapp/AGENTS.mdAGENTS.md
- templates/todo-local-experimental/AGENTS.mdAGENTS.md
- templates/universal-app/AGENTS.mdAGENTS.md
- template-gallerySkill
- rayfinSkill
- rayfinSkill
- rayfinSkill
- rayfinSkill
- rayfinSkill
- rayfinSkill
- rayfinSkill
- rayfinSkill
- analyticsSkill
- app-designSkill
- authenticationSkill
- build-workflowSkill
- capability-routerSkill
- daxSkill
- fabric-dataSkill
- graphein-visualsSkill
- headless-previewSkill
- visualsSkill
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.

