用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/rudderjs/rudder --skill orm-models命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Setting up authentication with guards, sessions, registration, password reset, gates/policies, and vendor views in Rudder
Building MCP servers with tools, resources, prompts, decorators, and HTTP/stdio transports in Rudder
Creating controller-returned views with route overrides, multi-framework support, and the html tagged template in Rudder
基于 SOC 职业分类
正在显示 SKILL.md
| name | orm-models |
| description | Creating Eloquent-style models, queries, relationships, casts, factories, and API resources in Rudder |
| license | MIT |
| appliesTo | ["@rudderjs/orm","@rudderjs/orm-prisma"] |
| trigger | creating or editing a `Model` class under `app/Models/`, writing queries / relationships, defining casts / accessors / factories, or building `JsonResource` API resources |
| skip | a route handler that only reads a model — controller-views is enough |
| metadata | {"author":"rudderjs"} |
Load when you're creating or editing a Model class under app/Models/, writing queries, defining casts / accessors / factories, or building JsonResource API resources. For depth, open the rule file matching your task.
| Task | Open |
|---|---|
Define a model — static table, fillable, hidden, casts, soft deletes, decorators, custom casts | rules/defining-models.md |
Query the database — find / where / paginate, eager loading, scopes, soft-delete filters | rules/querying.md |
CRUD + observers — create / update / delete, observer lifecycle, atomic counters | rules/crud-and-observers.md |
Test data — ModelFactory, sequence, states, .make() vs .create() | rules/factories.md |
API output — JsonResource, ResourceCollection, when / whenLoaded / mergeWhen | rules/resources.md |
ModelRegistry.set(adapter) plugs in the DB driver. @rudderjs/orm has no runtime DB dependency.find/first/all/where(...).get()/paginate) returns Model instances, not plain records. Use Model.hydrate(record) to wrap external data (cached JSON, fixtures).static fillable (allowlist) / static guarded (denylist; ['*'] locks all) drop keys outside policy on create / update / fill. instance.forceFill bypasses.Model.create/update/delete fire lifecycle events. query().create() bypasses them. increment / decrement deliberately do not fire — pure data-plane operations.'string', 'integer', 'float', 'boolean', 'date', 'datetime', 'json', 'array', 'collection', 'encrypted', 'encrypted:array', 'encrypted:object'. Encrypted casts need @rudderjs/crypt.See playground/app/Models/User.ts for a working model and playground/routes/console.ts for factory-based seeding.