add-crud-feature
Skill1 starsChanged 5 months agoMITView on GitHub
Generate a complete CRUD resource (Drizzle model + server actions + dashboard table/form UI) from a natural-language description, following AgentStack's conventions. Use when the user asks to add a new resource/entity to the app (e.g. "add an Invoice resource", "I need a Task model with title, status, due date").
In this repository3 other files it gives its agents.
- AGENTS.mdAGENTS.md
- add-dashboard-pageSkill
- add-email-templateSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 1 is distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Always add organizationId (FK to organizations.id) — every resource in this app is scoped to an organization.
- Very specific: line 27
Schema: create src/db/schema/<resource-plural>.ts exporting a pgTable named <resourcePlural>.
- Very specific: line 29
Migration: after writing the schema, tell the user to run pnpm db:generate then pnpm db:push (or run it yourself if you have shell access …
- Very specific: line 31
Server actions: create src/app/(dashboard)/dashboard/<resource-plural>/actions.ts with a "use server" directive.
- Very specific: line 32
Call requireOrganization() from @/lib/session and filter/scope by organizationId.
- Very specific: line 34
Use createId() from @/lib/id for new primary keys.
- Very specific: line 41
Navigation: add an entry to src/components/dashboard/nav-items.ts pointing at /dashboard/<resource-plural>, with a sensible lucide-react …
- Distinctive: line 50
Don't add features beyond what was asked (no soft-delete, no audit log, no pagination) unless the user requested it.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
add-crud-feature
Generates a full vertical slice for a new business resource: database table, server actions, dashboard page, table, and form — wired into navigation. Read AGENTS.md first for the project-wide conventions this skill assumes.
Inputs
Parse from the user's natural-language request:
- Resource name (singular, PascalCase for types, kebab-case for files/routes, snake_case for the DB table). E.g. "Invoice" →
Invoice,invoice,invoices. - Fields: name, type (text/number/boolean/date/enum), required/optional. Infer reasonable types if the user is vague (e.g. "amount" → numeric in cents, "status" → enum).
- Always add
organizationId(FK toorganizations.id) — every resource in this app is scoped to an organization. Never create a resource without it.
Reference files (read these before generating anything)
src/db/schema/organizations.ts— table definition pattern (pgTable, id as text PK viacreateId(), timestamps, FK withonDelete: "cascade").src/app/(dashboard)/dashboard/settings/organization/page.tsx— server component reading data with Drizzle +requireOrganization().src/app/(dashboard)/dashboard/settings/billing/billing-actions.tsx+billing/page.tsx— pattern for a server page + a"use client"actions component.src/components/shared/data-table.tsx— genericDataTablecomponent to reuse for the listing table.src/components/dashboard/nav-items.ts— where to register the new nav entry.
Steps
- Schema: create
src/db/schema/<resource-plural>.tsexporting apgTablenamed<resourcePlural>. Columns:id text primaryKey, the requested fields,organizationId text notNull references(() => organizations.id, { onDelete: "cascade" }),createdAt/updatedAt timestamps notNull defaultNow(). Re-export it fromsrc/db/schema/index.ts. - Migration: after writing the schema, tell the user to run
pnpm db:generatethenpnpm db:push(or run it yourself if you have shell access and aDATABASE_URLis configured) — do not hand-write SQL migrations. - Server actions: create
src/app/(dashboard)/dashboard/<resource-plural>/actions.tswith a"use server"directive. Implementcreate<Resource>,update<Resource>,delete<Resource>,list<Resource>s. Every query/mutation must:- Call
requireOrganization()from@/lib/sessionand filter/scope byorganizationId. - Validate input with a Zod schema before touching the DB.
- Use
createId()from@/lib/idfor new primary keys.
- Call
- UI:
src/app/(dashboard)/dashboard/<resource-plural>/page.tsx— server component, fetches rows via the list action, renders<<Resource>Table>.src/components/<resource-plural>/<resource>-table.tsx— uses the sharedDataTablecomponent, one column per field plus an actions column (edit/delete via a dialog usingsrc/components/ui/dialog.tsx).src/components/<resource-plural>/<resource>-form.tsx—"use client"form usingInput/Label/Select/Switchfromsrc/components/ui/*matched to field types, calling the server actions, withuseStatefor pending/error state (mirrorbilling-actions.tsx's fetch+loading pattern, but call server actions directly viastartTransitioninstead offetch).
- Navigation: add an entry to
src/components/dashboard/nav-items.tspointing at/dashboard/<resource-plural>, with a sensiblelucide-reacticon. - Report back: list every file created/modified and the exact migration commands the user still needs to run.
Conventions to enforce
- No
any. Derive row types withtypeof <table>.$inferSelect/$inferInsert. - Files: kebab-case. Component names inside files: PascalCase.
- Server actions live in
actions.tscolocated with the page, never inlib/. - Don't add features beyond what was asked (no soft-delete, no audit log, no pagination) unless the user requested it.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

