skills/tidbx-nextjs/SKILL.md
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.
npx skillsauth add pingcap/agenticstore tidbx-nextjsInstall 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.
Set up a Next.js app (App Router) that connects to TiDB, with clear guidance on where database code can run (Node runtime) and how to avoid common serverless pitfalls.
app/api/*/route.ts.tidbx-prismatidbx-kyselymysql2) only for minimal demos or when you need raw SQL without an ORM.idleTimeout: 300_000).connectionLimit: 1 is enough per function/container).guides/quickstart.md -- create a Next.js app and add TiDB (Prisma-first; mysql2 alternative)guides/troubleshooting.md -- runtime/env/caching/connection issuestemplates/route-handler-mysql2.ts -- App Router Route Handler that queries TiDB with mysql2 (Node runtime)templates/tidb-mysql2-pool.ts -- mysql2 pool helper with TLS and serverless-friendly defaultstemplates/prisma-client.ts -- PrismaClient singleton for Next.js (dev hot reload safe)templates/route-handler-prisma.ts -- Route Handler using Prisma ($queryRaw + CRUD)tidbx-prisma -- Prisma ORM (models + migrations + typed client)tidbx-kysely -- Kysely (typed query builder)tidbx-serverless-driver -- TiDB Cloud serverless HTTP driver (for edge-like runtimes)tidbx -- provision/manage TiDB Cloud clustersI will:
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.
tools
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.
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.