planetscale

Design schemas and write queries for PlanetScale serverless MySQL using branch-based workflows. Ensures index coverage, avoids foreign key anti-patterns, and treats every schema change as a reviewable, reversible deploy request.

Best use case

planetscale is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Design schemas and write queries for PlanetScale serverless MySQL using branch-based workflows. Ensures index coverage, avoids foreign key anti-patterns, and treats every schema change as a reviewable, reversible deploy request.

Teams using planetscale 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

$curl -o ~/.claude/skills/planetscale/SKILL.md --create-dirs "https://raw.githubusercontent.com/nvdigitalsolutions/mcp-ai-wpoos/main/includes/bundled-skills/planetscale/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/planetscale/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How planetscale Compares

Feature / AgentplanetscaleStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Design schemas and write queries for PlanetScale serverless MySQL using branch-based workflows. Ensures index coverage, avoids foreign key anti-patterns, and treats every schema change as a reviewable, reversible deploy request.

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

# PlanetScale Database Skills

Use this skill for any work involving PlanetScale (or MySQL-compatible / Postgres databases) to ensure schemas scale, queries use indexes, and every change goes through a safe branching workflow.

## Prerequisites

```bash
# Install PlanetScale CLI
brew install planetscale/tap/pscale   # macOS
# or: https://github.com/planetscale/cli#installation

# Authenticate
pscale auth login
```

Install the agent skill:

```bash
npx skills add planetscale/agent-skill
```

## Core Workflow: Branch Every Change

PlanetScale's branching model maps directly to git. Never modify the production schema directly.

```bash
# 1. Create a branch for the feature
pscale branch create mydb add-user-prefs

# 2. Connect to the branch
pscale connect mydb add-user-prefs --port 3309

# 3. Apply schema changes (via your ORM or raw SQL)
mysql -h 127.0.0.1 -P 3309 -u root < migration.sql

# 4. Open a deploy request
pscale deploy-request create mydb add-user-prefs

# 5. Review and merge in the PlanetScale dashboard (or CLI)
pscale deploy-request deploy mydb <deploy-request-number>
```

## Schema Design Principles

### Always include these on new tables

```sql
CREATE TABLE user_preferences (
  id          VARCHAR(36) PRIMARY KEY DEFAULT (UUID()),
  user_id     VARCHAR(36) NOT NULL,
  theme       ENUM('light', 'dark', 'system') DEFAULT 'system',
  created_at  TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  updated_at  TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  INDEX idx_user_id (user_id)   -- index every foreign-key-like column
);
```

### PlanetScale conventions

- **No foreign key constraints** — PlanetScale disables them for horizontal scale. Use application-level integrity instead.
- **VARCHAR(36) UUIDs** — prefer over auto-increment INT for distributed systems
- **Always index** columns used in WHERE, JOIN ON, or ORDER BY clauses
- Use `ENUM` for small, stable value sets (avoids join tables for simple statuses)

## Index-Aware Query Writing

Before writing a query, identify the WHERE and ORDER BY columns and ensure a covering index exists.

```sql
-- BAD: full table scan at scale
SELECT * FROM orders WHERE status = 'pending' AND created_at > '2026-01-01';

-- GOOD: only needed columns, index covers the filter
SELECT id, user_id, total, created_at
FROM orders
WHERE status = 'pending'
  AND created_at > '2026-01-01';

-- Required index
ALTER TABLE orders ADD INDEX idx_status_created (status, created_at);
```

**Always explain**: after creating a query, state the index it relies on and estimated impact at scale.

## Query Checklist

After writing any query:

- [ ] Does `SELECT *` appear? Replace with specific columns
- [ ] Does the WHERE clause have an index? Create one if not
- [ ] Is there an ORDER BY without a matching index? Add one
- [ ] Is this a JOIN? Ensure both join columns are indexed
- [ ] Could this return millions of rows? Add LIMIT or pagination

## Branching Cheat Sheet

```bash
pscale branch list mydb                         # List branches
pscale branch create mydb <branch-name>         # Create branch
pscale branch delete mydb <branch-name>         # Delete branch
pscale connect mydb <branch-name> --port 3309  # Local connection
pscale deploy-request create mydb <branch>      # Open deploy request
pscale deploy-request list mydb                 # List open requests
pscale deploy-request deploy mydb <number>      # Merge to production
```

## Migrations Best Practices

- **One concern per migration** — don't combine unrelated changes
- **Additive first** — add new columns/tables before removing old ones
- **Backfill separately** — data migrations run after schema migrations
- **Test rollback** — ensure dropping the column is safe before merging

## Connection Strings

```bash
# Local development (branch connection)
DATABASE_URL=mysql://root:@127.0.0.1:3309/mydb

# Production (PlanetScale connection string from dashboard)
DATABASE_URL=mysql://username:password@host/mydb?ssl={"rejectUnauthorized":true}
```

## Tips

- Estimate query time at scale (e.g., "~2ms with index vs ~8s without at 10M rows")
- Use `EXPLAIN` to verify index usage before committing a query
- In PlanetScale, schema changes are non-blocking (online DDL) — still test on a branch first
- Set up Insights in the PlanetScale dashboard to catch slow queries in production

Related Skills

webapp-testing

5
from nvdigitalsolutions/mcp-ai-wpoos

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

web-artifacts-builder

5
from nvdigitalsolutions/mcp-ai-wpoos

Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.

valyu

5
from nvdigitalsolutions/mcp-ai-wpoos

Search the live web and 36+ specialised data sources including SEC filings, PubMed, ChEMBL, clinical trials, FRED economic indicators, and patent databases. Use when current, authoritative, or paywalled data is required.

ui-ux-pro-max

5
from nvdigitalsolutions/mcp-ai-wpoos

AI-powered design intelligence with 67 UI styles, 161 color palettes, 57 font pairings, 99 UX guidelines, and 25 chart types across 15+ tech stacks. Generates complete design systems for any product type with industry-specific reasoning rules.

theme-factory

5
from nvdigitalsolutions/mcp-ai-wpoos

Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.

slack-gif-creator

5
from nvdigitalsolutions/mcp-ai-wpoos

Knowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."

skill-creator

5
from nvdigitalsolutions/mcp-ai-wpoos

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, update 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.

shannon

5
from nvdigitalsolutions/mcp-ai-wpoos

Autonomous AI security pen testing. Executes real exploits against web applications to find SQL injection, XSS, SSRF, authentication flaws, and IDOR vulnerabilities. Reports only confirmed, reproducible findings — no false positives.

remotion

5
from nvdigitalsolutions/mcp-ai-wpoos

Create programmatic videos using React and Remotion. Translate natural language descriptions into working Remotion components for product demos, release announcements, explainer videos, and animated content.

mcp-builder

5
from nvdigitalsolutions/mcp-ai-wpoos

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

karpathy-coding-principles

5
from nvdigitalsolutions/mcp-ai-wpoos

Apply Karpathy-inspired coding behavior guidelines — think before coding, prefer simplicity, make surgical changes, and execute toward verifiable goals. Reduces wrong assumptions, overengineering, and unintended side-effects.

internal-comms

5
from nvdigitalsolutions/mcp-ai-wpoos

A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).