vitess
Vitess best practices, query optimization, and connection troubleshooting for PlanetScale Vitess databases. Load when working with Vitess databases, sharding, VSchema configuration, keyspace management, or MySQL scaling issues.
Best use case
vitess is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Vitess best practices, query optimization, and connection troubleshooting for PlanetScale Vitess databases. Load when working with Vitess databases, sharding, VSchema configuration, keyspace management, or MySQL scaling issues.
Teams using vitess should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/vitess/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How vitess Compares
| Feature / Agent | vitess | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Vitess best practices, query optimization, and connection troubleshooting for PlanetScale Vitess databases. Load when working with Vitess databases, sharding, VSchema configuration, keyspace management, or MySQL scaling issues.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Vitess Vitess is a MySQL-compatible, cloud-native database system originally built at YouTube to scale MySQL. PlanetScale runs Vitess as a managed service. Core capabilities: - **Horizontal sharding**: Built-in sharding transparent to the application — no sharding logic in app code. - **Connection pooling**: VTTablet multiplexes client connections to MySQL, scaling concurrent connections far beyond native MySQL limits. - **High availability**: Automatic primary failure detection and repair. Resharding and data migrations with near-zero downtime. - **Query rewriting and caching**: VTGate rewrites and optimizes queries before routing to shards. - **Schema management**: Apply schema changes across all shards consistently, in the background, without disrupting workloads. - **Materialized views and messaging**: Cross-shard materialized views and publish/subscribe messaging via VStream. ## Key concepts | Concept | What it is | | -------------- | --------------------------------------------------------------------------------------------- | | **Keyspace** | Logical database mapping to one or more shards. Analogous to a MySQL schema. | | **Shard** | A horizontal partition of a keyspace, each backed by a separate MySQL instance. | | **VSchema** | Configuration defining how tables map to shards, vindex (sharding) keys, and routing rules. | | **Vindex** | Sharding function mapping column values to shards (`hash`, `unicode_loose_xxhash`, `lookup`). | | **VTGate** | Stateless proxy that plans and routes queries to the correct shard(s). | | **Online DDL** | Non-blocking schema migrations. On PlanetScale, use deploy requests for production changes. | ## PlanetScale specifics - **Branching**: Git-like database branches for development; deploy requests for production schema changes. - **Connections**: MySQL protocol, port `3306` (direct) or `443` (serverless). SSL always required. ## SQL compatibility Vitess supports nearly all MySQL syntax — most applications work without query changes. Standard DML, DDL, joins, subqueries, CTEs (including recursive CTEs as of v21+), window functions, and common built-in functions all work as expected. Known limitations: - **Stored procedures / triggers / events**: Not supported through VTGate. - **`LOCK TABLES` / `GET_LOCK`**: Not supported through VTGate. - **`SELECT ... FOR UPDATE`**: Works within a single shard; cross-shard locking is not atomic. - **Cross-shard joins**: Supported but expensive (scatter-gather). Filter by vindex column for single-shard routing. - **Correlated subqueries**: May fail or perform poorly cross-shard. Rewrite as joins when possible. - **IDs**: Use **Vitess Sequences** (a global counter in an unsharded keyspace) or app-generated IDs (UUIDs, snowflake) to avoid collisions on sharded tables. - **Aggregations on sharded tables**: `GROUP BY`/`ORDER BY`/`LIMIT` merge in VTGate memory. Large result sets can be slow. - **Foreign keys**: Limited support. Prefer application-level referential integrity on sharded keyspaces. ## References | Topic | Reference | Use for | | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | | VSchema | [references/vschema.md](https://raw.githubusercontent.com/planetscale/database-skills/main/skills/vitess/references/vschema.md) | VSchema design, vindexes, sequences, sharding strategies | | Schema Changes | [references/schema-changes.md](https://raw.githubusercontent.com/planetscale/database-skills/main/skills/vitess/references/schema-changes.md) | Online DDL, managed migrations, ddl strategies, migration lifecycle | | VReplication | [references/vreplication.md](https://raw.githubusercontent.com/planetscale/database-skills/main/skills/vitess/references/vreplication.md) | MoveTables, Reshard, Materialize, VDiff, VStream | | Architecture | [references/architecture.md](https://raw.githubusercontent.com/planetscale/database-skills/main/skills/vitess/references/architecture.md) | VTGate, VTTablet, Topology Service, VTOrc, component interactions | | Query Serving | [references/query-serving.md](https://raw.githubusercontent.com/planetscale/database-skills/main/skills/vitess/references/query-serving.md) | Query routing, MySQL compatibility, cross-shard performance, EXPLAIN |
Related Skills
typescript-performance
Comprehensive TypeScript performance analysis and optimization. Use when users report slow TypeScript compilation, slow editor experience, or want to investigate TypeScript performance issues. This skill provides diagnostic tools, trace analysis workflows, and optimization strategies. Key triggers include mentions of slow builds, type-checking delays, tsc performance, editor lag with TypeScript, or requests to analyze/improve TypeScript performance. Always prioritize data-driven analysis using --extendedDiagnostics, --generateTrace, and TS Server logs before making optimization recommendations.
watch-ci
CI を監視し、失敗したら自律的に修正してパスするまでループするスキル。push 後・PR 作成後・rebase 後に CI が通るか確認したいとき、CI が落ちていたら直してほしいとき、CI の結果を待ちたいときに使う。「CI 監視して」「CI が通るまで待って」「CI 直して」「push したので CI を見ておいて」など、CI の状態確認・自動修正が必要な場面では必ずこのスキルを呼び出すこと。
vue-style-guide
Vue を書くときは基本的に参考にしてください。 個人的に気に入っている ubgeeei 氏の Vue.js のスタイルガイドです。
triage-pr-reviews
Triages unresolved PR review comments using gh-pr-reviews. Analyzes code context and classifies each comment as Agree / Partially Agree / Disagree. Walks through each comment one-by-one, asking the user what action to take. Use when the user wants to triage, review, or analyze unresolved PR comments.
terraform-test
Comprehensive guide for writing and running Terraform tests. Use when creating test files (.tftest.hcl), writing test scenarios with run blocks, validating infrastructure behavior with assertions, mocking providers and data sources, testing module outputs and resource configurations, or troubleshooting Terraform test syntax and execution.
terraform-style-guide
Generate Terraform HCL code following HashiCorp's official style conventions and best practices. Use when writing, reviewing, or generating Terraform configurations.
terraform-stacks
Comprehensive guide for working with HashiCorp Terraform Stacks. Use when creating, modifying, or validating Terraform Stack configurations (.tfcomponent.hcl, .tfdeploy.hcl files), working with stack components and deployments from local modules, public registry, or private registry sources, managing multi-region or multi-environment infrastructure, or troubleshooting Terraform Stacks syntax and structure.
teach-impeccable
One-time setup that gathers design context for your project and saves it to your AI config file. Run once to establish persistent design guidelines.
stacked-pr
依存関係のある複数の PR を管理・同期するためのスキル。stacked PR のカスケード rebase、PR 間の依存検出、base branch 管理、CI の上流優先修正を行う。PR が別の PR に依存している状況全般で使う — cascade rebase、スタック sync、依存先 PR 更新後のメンテ、PR チェーンの整合性確認などをするときなど。
smart-compact
セッションのコンテキストを分析し、重要な情報を保持するためのプロンプトを生成して /compact コマンドの実行を支援するスキル。コンテキストウィンドウが逼迫してきた時や、セッションを整理したい時に使用。
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
semgrep
Run Semgrep static analysis scans and create custom detection rules. Use when asked to scan code with Semgrep, find security vulnerabilities, write custom YAML rules, or detect specific bug patterns. IMPORTANT: Also use this skill when users ask to 'scan for bugs', 'check code quality', 'find vulnerabilities', 'static analysis', 'lint for security', 'audit this code', or want to enforce coding standards — even if they don't mention Semgrep by name. Semgrep is the right tool for pattern-based code scanning across 30+ languages.