Communitygithub.com

YepAPI/skills

Prisma 架構設計、遷移與查詢最佳化。

skills 是什麼?

此技能為 AI 代理提供了一套 Prisma ORM 的專業知識與最佳實踐,主要用於 Prisma 架構設計、資料庫遷移與查詢最佳化。開發者或 AI 代理能遵循嚴格的規則來定義資料模型,避免常見的 N+1 查詢問題,並透過 `select` 取代 `include` 減少不必要的資料擷取。技能涵蓋從交易處理、軟刪除、索引建立到無伺服器環境的連線池設定,確保資料庫操作既高效又安全。支援 Claude Code、Cursor 等 AI 編碼工具,幫助自動產生合規的 Prisma 程式碼與遷移指令。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/YepAPI/skills/tree/HEAD/skills/prisma

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Prisma

規則

  • 架構位於 prisma/schema.prisma — 是唯一的真理來源
  • 優先使用 select 而非 include — 僅擷取需要的欄位
  • 多步驟修改使用交易:prisma.$transaction([...])
  • 軟刪除透過 deletedAt DateTime? 欄位 + 中介軟體過濾器實作
  • 經常查詢的欄位加上索引:@@index([fieldName])
  • 關聯:務必定義雙邊(@relation)
  • 遷移:npx prisma migrate dev --name descriptive-name
  • 無伺服器環境的連線池:使用 Prisma Accelerate 或 PgBouncer
  • 類型生成:更動架構後執行 npx prisma generate

避免

  • 當只需要一個欄位時使用 include: { relation: true } — 改用 select
  • N+1 查詢 — 使用 include 或 select 搭配巢狀關聯
  • 當 Prisma API 能夠處理時使用原始 SQL — 僅在複雜聚合時使用 $queryRaw
  • prisma.table.findMany() 沒有 take 限制 — 務必分頁

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

YepAPI/skills

WCAG 2.1 AA — semantic HTML, keyboard navigation, screen readers.

YepAPI/skills

Experiment setup, variant splitting, statistical significance, and feature flag integration.

YepAPI/skills

CRUD generators, data tables, user management, role-based access, and bulk operations.

YepAPI/skills

Monitor what ChatGPT and Gemini say about your brand using YepAPI.

YepAPI/skills

Queue workers with BullMQ/Inngest/Trigger.dev, job retries, dead letter queues, concurrency.

YepAPI/skills

Commander.js, interactive prompts with Clack, spinners, colors, config files, exit codes, and npm publishing.

YepAPI/skills

cmdk integration, Cmd+K trigger, fuzzy search, grouped actions, keyboard navigation, and dynamic action registration.

YepAPI/skills

Content planning with trend and sentiment data from YepAPI.

YepAPI/skills

Content calendar, keyword-driven planning, and content briefs.

YepAPI/skills

Theme switching with CSS variables, system preference detection, next-themes, and persistence.

YepAPI/skills

Threaded comments, @mentions, reactions, moderation queue, optimistic UI, and cursor pagination.

YepAPI/skills

Competitive analysis between domains using YepAPI.

YepAPI/skills

Layout grids, KPI cards, data tables with sorting/filtering, sidebar navigation, and responsive breakpoints.

YepAPI/skills

Data encryption — TLS everywhere, AES-256-GCM for PII, bcrypt passwords, encrypted backups.

YepAPI/skills

Chart patterns with Recharts/Nivo/D3, responsive containers, color scales, and accessibility.

YepAPI/skills

Drizzle schema definition, push vs migrate, type-safe queries, relations, transactions, and prepared statements.

YepAPI/skills

Upload handling, resize/compress, CDN delivery, blur placeholders, and next/image patterns.

YepAPI/skills

Local business and Google Maps research using YepAPI.

YepAPI/skills

Cursor-based pagination, IntersectionObserver, virtualized lists with @tanstack/react-virtual, and scroll position restoration.

YepAPI/skills

Chat UI components, streaming responses with AI SDK, context window management, and RAG patterns.

相關技能