agent-health
Reads production/traces/agent-metrics.jsonl and displays a per-agent performance summary table for the current or a specified…
Provides Prisma ORM patterns for schema design, migrations, query optimization, and relation modeling. Use when working with Prisma schema files (schema.prisma) or when the user mentions Prisma, Prisma migrations, or Prisma queries.
Claude Code
$ npx -y skills add tranhieutt/software_development_department --skill prisma-expert --agent claude-code
Codex
$ npx skills add tranhieutt/software_development_department --skill prisma-expert -a codex -y
Cursor
$ npx skills add tranhieutt/software_development_department --skill prisma-expert -a cursor -y
Gemini CLI
$ npx skills add tranhieutt/software_development_department --skill prisma-expert -a gemini-cli -y
GitHub Copilot
$ npx skills add tranhieutt/software_development_department --skill prisma-expert -a github-copilot -y
OpenCode
$ npx skills add tranhieutt/software_development_department --skill prisma-expert -a opencode -y
Windsurf
$ npx skills add tranhieutt/software_development_department --skill prisma-expert -a windsurf -y
name: prisma-expert type: reference description: "Provides Prisma ORM patterns for schema design, migrations, query optimization, and relation modeling. Use when working with Prisma schema files (schema.prisma) or when the user mentions Prisma, Prisma migrations, or Prisma queries." paths: ["**/prisma/**", "**/*.prisma", "**/schema.prisma"] when_to_use: "When working with Prisma ORM for schema design, migrations, query optimization, or troubleshooting database operations" allowed-tools: Read, Glob, Grep, Write, Edit, Bash user-invocable: true effort: 3
model User {
id String @id @default(cuid())
email String @unique
role Role @default(USER)
posts Post[] @relation("UserPosts")
profile Profile? @relation("UserProfile")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([email])
@@map("users")
}
model Post {
id String @id @default(cuid())
title String
content String?
published Boolean @default(false)
author User @relation("UserPosts", fields: [authorId], references: [id], onDelete: Cascade)
authorId String
@@index([authorId])
@@map("posts")
}
enum Role { USER ADMIN MODERATOR }// ❌ N+1
const users = await prisma.user.findMany();
for (const user of users) {
const posts = await prisma.post.findMany({ where: { authorId: user.id } });
}
// ✅ Include (fetches all post fields)
const users = await prisma.user.findMany({ include: { posts: true } });
// ✅✅ Select (fetch only needed fields — best for performance)
const users = await prisma.user.findMany({
select: {
id: true, email: true,
posts: { select: { id: true, title: true } },
},
});
// ✅ Complex aggregations → use raw
const result = await prisma.$queryRaw<{ id: string; count: number }[]>`
SELECT u.id, COUNT(p.id)::int as count
FROM users u LEFT JOIN posts p ON p.author_id = u.id
GROUP BY u.id
`;// Sequential (auto-atomic, no rollback control)
const [user, profile] = await prisma.$transaction([
prisma.user.create({ data: userData }),
prisma.profile.create({ data: profileData }),
]);
// Interactive (full control, rollback on throw)
const result = await prisma.$transaction(async (tx) => {
const user = await tx.user.create({ data: userData });
if (user.email.endsWith("@blocked.com")) throw new Error("Blocked domain");
return tx.profile.create({ data: { ...profileData, userId: user.id } });
}, {
maxWait: 5000,
timeout: 10000,
isolationLevel: "Serializable", // use ReadCommitted for most cases
});// lib/prisma.ts
import { PrismaClient } from "@prisma/client";
const globalForPrisma = globalThis as unknown as { prisma: PrismaClient };
export const prisma = globalForPrisma.prisma ?? new PrismaClient({
log: process.env.NODE_ENV === "development" ? ["query"] : [],
});
if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;# Development: creates migration file + applies npx prisma migrate dev --name add_role_to_users # Production: apply pending migrations only (safe) npx prisma migrate deploy # Check migration status npx prisma migrate status # Fix stuck migration npx prisma migrate resolve --applied "20240115_migration_name" # Validate schema (no DB connection needed) npx prisma validate # Format schema npx prisma format
| Pitfall | Fix | |---|---| | `migrate dev` in production | Use `migrate deploy` | | New `PrismaClient()` per request | Use global singleton | | `include: { all: true }` on large models | Use `select` to fetch only needed fields | | P2034 (transaction conflict) | Retry with exponential backoff | | Shadow database error in dev | Set `shadowDatabaseUrl` or use Neon branching | | Enum not syncing | Run `migrate dev` after enum changes |
Reads production/traces/agent-metrics.jsonl and displays a per-agent performance summary table for the current or a specified…
Provides the vendored agent-style v0.3.5 prose rule pack as a portable Claude skill. Use when installing, syncing, applying, or…
Provides Angular best practices for components, modules, services, and reactive patterns. Use when working with Angular…
Records unexpected API behaviors, undocumented caveats, version bugs, or non-obvious workarounds into…
Defines REST and GraphQL API contracts including endpoints, request/response schemas, auth flows, and versioning strategy. Use…
Manages the ADR (Architecture Decision Record) registry. Use when recording tech-stack choices, design patterns, or…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.