Implement GitOps workflows with ArgoCD and Flux for automated, declarative Kubernetes...
npx skills add pingcap/agent-rules --skill "tidbx-kysely"
Install specific skill from multi-skill repository
# Description
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.
# SKILL.md
name: tidbx-kysely
description: 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.
TiDB Cloud + Kysely
Use this skill when a user wants to connect Kysely to TiDB Cloud (TiDB X). Default to
standard TCP (Node server/runtime). Only use the TiDB Cloud serverless driver over
HTTP for serverless or edge runtimes.
Workflow
- Confirm runtime and deployment target (Node server vs serverless/edge).
- Confirm cluster type. The serverless HTTP driver applies to Starter/Essential clusters.
- Collect connection info (prefer a
mysql://URL inDATABASE_URL). - Choose the path:
- Normal usage (default): TCP +
mysql2pool + KyselyMysqlDialect. - Serverless/edge:
@tidbcloud/kyselydialect over HTTP. - Show only the matching snippet first. Include the other path only if the user asks.
Usereferences/kysely-usage.mdfor full examples.
Normal usage (default)
Use this for Node servers, long-lived runtimes, or when TCP is available. This is the
primary path unless the user explicitly needs serverless/edge. Uses TCP with a mysql2
pool.
import { Kysely, MysqlDialect } from 'kysely'
import { createPool } from 'mysql2'
const pool = createPool({ uri: process.env.DATABASE_URL })
const db = new Kysely({ dialect: new MysqlDialect({ pool }) })
Serverless/edge usage (HTTP)
Use this only when the runtime cannot keep TCP connections (serverless/edge). Requires
the TiDB Cloud serverless driver and Starter/Essential clusters. Use from backend
services only (browser origins may be blocked by CORS). See
references/serverless-kysely-tutorial.md for the full walkthrough.
import { Kysely } from 'kysely'
import { TiDBCloudServerlessDialect } from '@tidbcloud/kysely'
const db = new Kysely({
dialect: new TiDBCloudServerlessDialect({ url: process.env.DATABASE_URL }),
})
Notes
- Many users say "instance" to mean "cluster"; treat them as the same.
- Keep instructions concise; move any long docs into references.
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.