skills/tidb-sql/SKILL.md
Write, review, and adapt SQL for TiDB with correct handling of TiDB-vs-MySQL differences (VECTOR type + vector indexes/functions, full-text search, AUTO_RANDOM, optimistic/pessimistic transactions, foreign keys, views, DDL limitations, and unsupported MySQL features like procedures/triggers/events/GEOMETRY/SPATIAL). Use when generating SQL that must run on TiDB, migrating MySQL SQL to TiDB, or debugging TiDB SQL compatibility errors.
npx skillsauth add pingcap/agenticstore tidb-sqlInstall 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.
Goal: generate SQL that runs correctly on TiDB by default, and avoid "works on MySQL but breaks on TiDB" constructs.
SELECT VERSION();TiDB, treat it as TiDB and parse the version (needed for feature gates like Vector / Foreign Key).skills/tidb-sql/references/tidb-cloud-ssl.md).EXPLAIN FORMAT = "tidb_json" for structured plans and operator trees.EXPLAIN ANALYZE to compare estRows vs actRows (it executes the query).ANALYZE TABLE ... to refresh statistics.VECTOR / VECTOR(D) types and vector functions/indexes; MySQL does not.GEOMETRY, spatial functions, and SPATIAL indexes.FULLTEXT works everywhere.UPDATE/INSERT/DELETE against views.AUTO_RANDOM over AUTO_INCREMENT for write-hotspot avoidance when appropriate.COMMIT failures in application logic.skills/tidb-sql/references/vector.md - VECTOR types, functions, vector index DDL, and query patterns.skills/tidb-sql/references/full-text-search.md - Full-text search SQL patterns and availability gotchas.skills/tidb-sql/references/auto-random.md - AUTO_RANDOM rules, DDL patterns, and restrictions.skills/tidb-sql/references/transactions.md - pessimistic vs optimistic mode and session/global knobs.skills/tidb-sql/references/mysql-compatibility-notes.md - other "MySQL vs TiDB" differences that commonly break SQL.skills/tidb-sql/references/explain.md - EXPLAIN / EXPLAIN ANALYZE usage, tidb_json and dot formats.skills/tidb-sql/references/flashback.md - FLASHBACK TABLE/DATABASE and FLASHBACK CLUSTER recovery playbooks.skills/tidb-sql/references/tidb-cloud-ssl.md - TiDB Cloud SSL verification requirements and client flags.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.
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.