← スキル一覧に戻る

manage-crud-architecture
by firstloophq
Claude Code plug-ins we use across projects at Firstloop
⭐ 0🍴 0📅 2026年1月16日
SKILL.md
name: manage-crud-architecture description: Add or modify CRUD entities following the layered architecture pattern. Use when adding new database models, creating API endpoints, or implementing data access layers.
CRUD Architecture
This skill guides implementing CRUD operations following the layered architecture pattern.
Architecture Overview
1. Prisma Schema → apps/server/src/db/prisma/schema.prisma
2. Zod Schemas → packages/common/src/types/<entity>/ (shared types)
3. Repository Layer → apps/server/src/repositories/
4. Controller Layer → apps/server/src/controllers/
5. tRPC Router → apps/server/src/routers/
6. DI Container → apps/server/src/di/container.ts
Checklist for Adding New CRUD Entity
- Add Prisma model in
apps/server/src/db/prisma/schema.prisma - Run migration:
cd apps/server && bun run db:migrate - Regenerate client:
cd apps/server && bun run db:generate - Create Zod schemas in
packages/common/src/types/<entity>/ - Export from
packages/common/src/index.ts - Create Repository in
apps/server/src/repositories/ - Create Controller in
apps/server/src/controllers/ - Create tRPC Router in
apps/server/src/routers/ - Register router in
apps/server/src/routers/_app.ts - Add to DI container in
apps/server/src/di/container.ts - Run build to verify:
cd apps/server && bun run build
Critical Gotchas
1. Clerk Integration
- Organization IDs are NOT UUIDs - Clerk uses
org_xxxxxformat. Usez.string().min(1)notz.string().uuid() - Don't pass organizationId in inputs - Get it from
ctx.auth.orgIdin routers - Webhooks may not have synced (optional consideration) - Use
getOrCreatepatterns for users/orgs when webhooks aren't guaranteed
2. Foreign Key Constraints (optional)
- If entity has FK to
users(e.g.,created_by), user must exist first - Use
ensureUserandensureOrganizationutilities before creating records - See
apps/server/src/utils/ensure-user.tsandensure-organization.ts
3. tRPC Procedures
- Use
authenticatedProcedurefor routes requiring login - Use
organizationProcedurefor routes requiring org context (auto-checksctx.auth.orgId) - Don't use
publicProcedurewith manual auth checks - Procedures defined in
apps/server/src/trpc.ts
For detailed implementation patterns, see reference.md.
スコア
総合スコア
45/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
○言語
プログラミング言語が設定されている
0/5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です