Reference and routing guide for Checkly CLI and Monitoring as Code workflows.
Data & analysis
PlanetScale CLI Skills
pscale command reference and workflows for branches, deploy requests, schema changes, SQL, insights, diagnostics, and D1 imports.
What it does
A consolidated reference for the PlanetScale CLI. It routes pscale work across auth, branch, deploy-request, database, sql, insights, inspect, backup, password, org, and service-token sub-skills, and includes decision trees for choosing between branches and deploy requests, service tokens and passwords, and direct promotion versus review. It documents schema migration, branch development, CI/CD integration, and Cloudflare D1 to PlanetScale Postgres import flows, and calls out credential safety, JSON error-code handling, and context-saving automation scripts.
When to use it
- Choosing a branch or a deploy request for a schema change
- Resizing VTGates or managing Vitess read-only regions and region-scoped passwords
- Running non-interactive SQL, inspect diagnostics, or production query insights
- Importing Cloudflare D1 SQLite exports into PlanetScale Postgres
The skill document
PlanetScale CLI Skills
Comprehensive pscale command reference and workflows for managing PlanetScale databases via terminal.
Overview
The PlanetScale CLI brings database branches, deploy requests, and schema migrations to your fingertips. This skill provides command references, automation scripts, and decision trees for all pscale operations.
Configuration and credential safety
- Directory-local
.pscale.ymlfiles are project configuration, not trusted credential configuration. The CLI accepts onlyorg,database, andbranchfrom them and warns while ignoring keys such as API endpoints or tokens. - Keep API URLs and credentials in the user config, environment/secret manager, or explicit approved flags. Never commit them to a repository-local config.
pscale apifollows cross-host redirects without forwarding authentication or caller-supplied headers. Even with this protection, pass secret-bearing headers only to an explicitly verified API host and do not expose them in logs.- When
--format jsonis active, API error codes are preserved in the top-levelcodefield instead of being collapsed toCOMMAND_FAILED. Branch automation should branch on exact codes when present; forschema_mutation_blocked, wait for the active vtctld mutation or deploy to finish before retrying.
Sub-Skills
| Command | Skill | Use When |
|---|---|---|
| auth | pscale-auth | Login, logout, service tokens, authentication management |
| branch | pscale-branch | Create, delete, promote, diff, list branches, inspect branch infra, manage Postgres size/replicas/parameters, resize Vitess VTGates, manage Vitess tablet throttling, download/query-stream query pattern reports, manage Vitess MoveTables workflows |
| deploy-request | pscale-deploy-request | Create, review, deploy, revert schema changes |
| database | pscale-database | Create, list, show, delete, and dump databases, including Vitess read-only-region dumps |
| sql | pscale-sql | Run non-interactive SQL queries with JSON output and ephemeral credentials |
| insights | pscale-insights | Analyze production query statistics, errors, anomalies, and schema recommendations |
| inspect | pscale-inspect | Run point-in-time, read-only MySQL/Vitess and PostgreSQL diagnostic checks |
| import d1 | pscale-import-d1 | Import Cloudflare D1 SQLite exports into PlanetScale Postgres |
| backup | pscale-backup | Create, list, show, delete branch backups |
| password | pscale-password | Create, list, delete, and scope Vitess connection passwords to read-only regions |
| org | pscale-org | List, show, switch organizations |
| service-token | pscale-service-token | Create, manage CI/CD service tokens |
Decision Trees
Should I use a branch or deploy request?
What's your goal?
├─ Experimenting with schema changes → Create branch (pscale-branch)
├─ Testing schema in isolation → Create branch (pscale-branch)
├─ Ready to deploy schema to production → Create deploy request (pscale-deploy-request)
└─ Reviewing schema changes before production → Review deploy request (pscale-deploy-request)
Service token vs password?
What's your use case?
├─ CI/CD pipeline → Service token (pscale-service-token)
├─ Local development → Password (pscale-password)
├─ Production application → Service token (rotatable, secure)
└─ One-off admin task → Password (temporary)
Direct promotion vs deploy request?
Production readiness?
├─ Immediate promotion (dangerous) → pscale branch promote (pscale-branch)
├─ Review + approval workflow → pscale deploy-request create (pscale-deploy-request)
└─ Safe production deployment → Always use deploy requests
Common Workflows
Schema Migration Workflow
Complete workflow from branch creation to production deployment:
# 1. Create development branch
pscale branch create
# 2. Make schema changes (via shell, ORM, or direct SQL)
pscale shell
# 3. View schema diff
pscale branch diff
# 4. Create deploy request
pscale deploy-request create
# 5. Review and deploy
pscale deploy-request deploy
# 6. Verify deployment
pscale deploy-request show
See scripts/ directory for automation.
Branch Development Workflow
# Create branch from main
pscale branch create --from main
# Work on schema changes
pscale shell
# Check diff before deploying
pscale branch diff
# Create deploy request when ready
pscale deploy-request create
CI/CD Integration
# Create service token for CI/CD
pscale service-token create --org
# Use in CI/CD pipelines (GitHub Actions, GitLab CI, etc.)
export PLANETSCALE_SERVICE_TOKEN_ID=
export PLANETSCALE_SERVICE_TOKEN=
# Create and deploy via CI/CD after review/approval gates pass
pscale deploy-request create --format json
pscale deploy-request deploy
Cloudflare D1 to PlanetScale Postgres import
# Lint and dry-run first; review the JSON migration ID and warnings
pscale import d1 lint --input ./d1-export.sql --format json
pscale import d1 start --input ./d1-export.sql --dry-run --format json
# After explicit confirmation, run and verify the import
pscale import d1 start --input ./d1-export.sql --migration-id --format json
pscale import d1 verify --migration-id --input ./d1-export.sql --format json
Quick Reference
Most Common Commands
# Authentication
pscale auth login
pscale auth logout
# Branch management
pscale branch create [--from ]
pscale branch list
pscale branch delete
pscale branch parameters list --format json
pscale branch resize status --format json
pscale branch vtgate show --format json
# Discover and use a Vitess read-only region
pscale keyspace read-only-regions --format json
pscale password create --read-only-region --format json
# Deploy requests
pscale deploy-request create
pscale deploy-request list
pscale deploy-request deploy
# Database operations
pscale database create --org
pscale database list
pscale shell
# Non-interactive read query for agents/scripts
pscale sql --org --format json --query "SELECT 1"
# Point-in-time diagnostics plus server-side production-traffic analysis
pscale inspect all --org --format json
pscale insights queries --org --sort p99Latency --period 1h --format json
pscale insights recommendations --org --format json
# Cloudflare D1 import dry-run
pscale import d1 start --input ./d1-export.sql --dry-run --format json
Related Skills
- drizzle-kit - ORM schema management and migrations
- gitlab-cli-skills - GitLab MR workflow integration
- github - GitHub PR and CI/CD integration
Automation Scripts
See scripts/ directory for token-efficient automation:
create-branch-for-mr.sh- Create PlanetScale branch matching your MR/PR branch namedeploy-schema-change.sh- Complete schema migration workflowsync-branch-with-main.sh- Create a replacement branch from main/base for conflict resolution
Scripts execute without loading into context (~90% token savings).
Resources
- Official docs: https://planetscale.com/docs/reference/planetscale-cli
- GitHub: https://github.com/planetscale/cli
- Community: https://github.com/planetscale/discussion
Related skills
Publish a web app via a curl-based JSON-RPC API and get a hosted URL.
Decides whether to plan or act directly, then sizes plans to risk with steps, estimates, and rollbacks.
Provision instant temporary Postgres databases via Claimable Postgres by Neon (neon.new) with no login, signup, or credit card. Supports REST API, CLI, and SDK. Use when users ask for a quick Postgres environment, a throwaway DATABASE_URL for prototyping/tests, or "just give me a DB now". Triggers include: "quick postgres", "temporary postgres", "no signup database", "no credit card database", "instant DATABASE_URL", "npx neon-new", "neon.new", "neon.new API", "claimable postgres API".
Prisma schema design, type-safe queries, and fixes for migrations, connection pools, and N+1 in Node and TypeScript.
Guides and best practices for working with Lakebase Postgres, the database behind Neon. Covers setup, connection methods and drivers, pooled vs direct connections, branching, autoscaling, scale-to-zero, instant restore, read replicas, connection pooling, IP allow lists, and logical replication. Use when users ask about "Lakebase Postgres", "Neon setup", "connect to Neon", "Neon project", "DATABASE_URL", "serverless Postgres", "Neon CLI", "neon", "Neon MCP", "Neon Auth", "@neondatabase/serverless", "@neondatabase/neon-js", "scale to zero", "Neon autoscaling", "Neon read replica", or "Neon connection pooling".