skills/tidbx-prisma/SKILL.md
Prisma ORM setup and usage for TiDB from Node.js/TypeScript. Covers configuring prisma/schema.prisma (MySQL provider), DATABASE_URL formatting for TiDB Cloud TLS (sslaccept=strict and optional sslcert), migrations (prisma migrate), Prisma Client generation, CRUD patterns, and safe raw SQL ($queryRaw) plus runnable templates.
npx skillsauth add pingcap/agenticstore tidbx-prismaInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Comprehensive Prisma ORM setup for TiDB with guided workflows.
DATABASE_URLPrisma is an ORM (models + migrations + typed client). If you only need a low-level MySQL driver, use:
tidbx-javascript-mysql2 (promise-native)tidbx-javascript-mysqljs (callback-based)guides/quickstart.md -- new project: install -> init -> migrate -> run TS quickstartguides/troubleshooting.md -- common TLS/connection/client-generation issuesI'll pick the smallest guide that matches your request, then use templates/scripts as needed.
DATABASE_URL TLS paramsprisma migrate devIn prisma/schema.prisma, use the MySQL connector and read DATABASE_URL:
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
For TiDB Cloud public endpoints, configure TLS via query params in DATABASE_URL:
?sslaccept=strict?sslaccept=strict&sslcert=/absolute/path/to/ca.pemExamples:
DATABASE_URL='mysql://USER:PASSWORD@HOST:4000/DATABASE?sslaccept=strict'
DATABASE_URL='mysql://USER:PASSWORD@HOST:4000/DATABASE?sslaccept=strict&sslcert=/absolute/path/to/ca.pem'
npm i @prisma/client
npm i -D prisma typescript ts-node @types/node
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
try {
// ... queries ...
} finally {
await prisma.$disconnect()
}
$queryRaw with template literals (parameterized).$queryRawUnsafe unless you fully control the SQL.const rows = await prisma.$queryRaw`SELECT VERSION() AS version`
templates/schema.prisma -- example schema (Player/Profile) mapped to TiDB tablestemplates/quickstart.ts -- minimal Prisma app: connect -> version -> CRUD (run with ts-node)scripts/validate_connection.ts -- connects and prints SELECT VERSION() (run with ts-node)tidbx-nextjs -- Next.js App Router integration patterns (route handlers, runtimes, deployment)tidbx-kysely -- typed query builder alternative to Prismatidbx-javascript-mysql2 -- low-level driver (promise API)tidbx-javascript-mysqljs -- low-level driver (callback API)I will:
guides/quickstart.md or guides/troubleshooting.md)devops
Provision TiDB Cloud Serverless clusters and related resources. Use when creating, deleting, or listing clusters/branches, or managing SQL users via the console.
devops
Guidance for using the TiDB Cloud Serverless Driver (Beta) in Node.js, serverless, and edge environments. Use when connecting to TiDB Cloud Starter/Essential over HTTP with @tidbcloud/serverless, or when integrating with Prisma/Kysely/Drizzle serverless adapters in Vercel/Cloudflare/Netlify/Deno/Bun. Use this skill for serverless driver setup and edge runtime guidance.
development
Build and deploy Next.js (App Router) apps that connect to TiDB. Covers Route Handlers (app/api/*/route.ts), Node vs Edge runtime selection for database access, environment variable handling, and production-safe DB patterns on Vercel/serverless. Prefer Prisma/Kysely integration, with optional mysql2 for minimal examples. Includes guides and TypeScript templates.
testing
Set up Kysely with TiDB Cloud (TiDB X), including @tidbcloud/kysely over the TiDB Cloud serverless HTTP driver for serverless or edge environments, plus standard TCP usage. Use for Kysely + TiDB Cloud connection setup, demo snippets, and environment-specific guidance.