Prisma
Designs Prisma schemas, writes type-safe queries, and fixes migrations, connection pools, and N+1 relation loads in Node and TypeScript. Use when editing…
от clawic★ 23 звезды на GitHub
Установить Prisma в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
User preferences and memory live in ~/Clawic/data/prisma/ (see setup.md on first use, memory-template.md for the file format). If you have data at an old location (~/prisma/ or ~/clawic/prisma/), move it to ~/Clawic/data/prisma/, and say in one line that you moved it and from where.
When To Use
- Writing or reviewing
schema.prisma: models, relations, referential actions, indexes, enums, JSON, money and time columns - Getting a schema change into a database safely:
db pushvsmigrate devvsmigrate deploy, renames, backfills, baselining, drift, failed migrations - Writing Prisma Client queries: filters, pagination, nested writes, upserts, aggregation, and the raw escape hatch
- Diagnosing runtime failures by error code (P1xxx connectivity, P2xxx query, P3xxx migrate) or by symptom (slow, too many queries, pool exhausted, transaction timeout)
- Deploying Prisma: generate in CI and Docker, engine targets, serverless and edge, poolers, test databases
- Extending the client: soft delete, audit logs, tenant scoping, computed fields — and porting existing
$usemiddleware - Not for tuning the database server itself (
EXPLAINplans, vacuum, index internals) or hand-written SQL optimization — see Related Skills
Quick Reference
| Situation | Play |
|---|---|
| Schema edited, database unchanged | Dev: npx prisma migrate dev; prod/CI: migrate deploy; throwaway prototype only: db push (→ Core Rules 1) |
| "Unknown argument" or a model missing on the client | Client is stale generated code — npx prisma generate (→ Core Rules 2) |
| Renaming a field or table with rows in it | Prisma diffs by name: rename = DROP + ADD. @map to keep the column, or hand-edit the SQL (→ Core Rules 3) |
Existing database, no prisma/migrations folder |
db pull to introspect, then baseline the first migration as applied (→ migrations.md) |
"Drift detected" or migrate dev wants to reset prod-like data |
Someone changed the DB out of band; diff before you accept anything (→ migrations.md) |
| P3009 — failed migration blocks every deploy | Fix the SQL by hand, then migrate resolve --applied or --rolled-back (→ errors.md) |
| P2002 unique constraint failed | Genuine duplicate or an upsert race — catch the code, retry once (→ errors.md) |
| P2025 record not found on update/delete | Row gone, or an extra where filter did not match — this is the optimistic-locking signal (→ transactions.md) |
| P2024 timed out fetching a new connection | Pool exhausted: long transactions, too many client instances, or a limit below concurrency (→ connections.md) |
| "Too many connections" on Lambda, Vercel or Next.js dev | One client per process behind a globalThis singleton, plus an external pooler (→ connections.md) |
| Query log shows hundreds of queries per request | Relation loads in a loop, not include — measure before rewriting (→ performance.md) |
Relation is undefined at runtime |
Prisma never loads relations implicitly; include or select it (→ queries.md) |
| List endpoint gets slower as the table grows | take missing, offset pagination, or count() scanning (→ performance.md) |
| Transaction times out at 5s or deadlocks under load | Shrink the body, raise timeout deliberately, retry P2034 (→ transactions.md) |
| Soft delete, audit trail, tenant scoping, computed fields | Client extensions ($extends), not middleware (→ extensions.md) |
include result does not narrow in TypeScript |
GetPayload / validator instead of hand-written interfaces (→ typescript.md) |
Do not know how to serialize a BigInt, or Decimal arrives as an object |
Prisma returns BigInt and Decimal, not numbers (→ typescript.md) |
| Query the schema cannot express (CTE, window, DISTINCT ON, upsert-heavy batch) | $queryRaw tagged template, or TypedSQL for typed results (→ raw-sql.md) |
| Deploy fails with "Query engine could not be located" | prisma generate missing from the build, or wrong binaryTargets for the image (→ deployment.md) |
| Tests interfere with each other or need a real database | Per-worker database or schema, rollback-per-test, deterministic seed (→ testing.md) |
| Works on PostgreSQL, breaks on MySQL, SQLite, or MongoDB | Provider capability gap, not a Prisma bug (→ providers.md) |
| Anything else | Turn on query logging and read the SQL Prisma actually sent, then run that SQL by hand: the answer is almost always in the gap between what you expressed and what was emitted (→ performance.md) |
Depth on demand, by phase:
- Model —
schema.mdrelations, referential actions, keys, indexes, types, multi-tenancy ·providers.mdwhat PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and PlanetScale each refuse to do - Change —
migrations.mdpush vs migrate, renames, baselining, drift, zero-downtime sequences ·testing.mdtest databases, isolation, seeding, mocking ·deployment.mdgenerate in CI and Docker, engines, serverless, edge, mo
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- _meta.json
- connections.md
- deployment.md
- errors.md
- extensions.md
- memory-template.md
- migrations.md
- performance.md
- providers.md
- queries.md
- raw-sql.md
- schema.md
- setup.md
- testing.md
- transactions.md
- typescript.md
FAQ
Что делает скилл Prisma?
Designs Prisma schemas, writes type-safe queries, and fixes migrations, connection pools, and N+1 relation loads in Node and TypeScript. Use when editing schema.prisma, modeling relations, indexes, enums, JSON or Decimal columns, or choosing between db push, migrate dev and migrate deploy; when a migration drifts, fails, or would drop a column on rename, or a database needs baselining; on errors P2002, P2025, P2024, P2034 or P3009; when connections run out on Lambda, Vercel or behind PgBouncer; when queries are slow or include loads too much; on transaction timeouts, deadlocks and optimistic locking; when Decimal or BigInt break JSON.stringify; for $queryRaw and TypedSQL; when porting $use middleware to client extensions; when prisma generate fails in Docker, Alpine or CI; and for seeding and test isolation. Not for database-server tuning or hand-written SQL (pg, sql), or other ORMs.
Как установить скилл Prisma?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Prisma запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…