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.
Sub-Skills
| Command |
Skill |
Use When |
| auth |
pscale-auth |
Login, logout, service tokens, authentication management |
| branch |
pscale-branch |
Create, delete, promote, diff, list database branches |
| deploy-request |
pscale-deploy-request |
Create, review, deploy, revert schema changes |
| database |
pscale-database |
Create, list, show, delete databases |
| backup |
pscale-backup |
Create, list, show, delete branch backups |
| password |
pscale-password |
Create, list, delete connection passwords |
| 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 <database> <branch-name>
# 2. Make schema changes (via shell, ORM, or direct SQL)
pscale shell <database> <branch-name>
# 3. View schema diff
pscale branch diff <database> <branch-name>
# 4. Create deploy request
pscale deploy-request create <database> <branch-name>
# 5. Review and deploy
pscale deploy-request deploy <database> <deploy-request-number>
# 6. Verify deployment
pscale deploy-request show <database> <deploy-request-number>
See scripts/ directory for automation.
Branch Development Workflow
# Create branch from main
pscale branch create <database> <feature-branch> --from main
# Work on schema changes
pscale shell <database> <feature-branch>
# Check diff before deploying
pscale branch diff <database> <feature-branch>
# Create deploy request when ready
pscale deploy-request create <database> <feature-branch>
CI/CD Integration
# Create service token for CI/CD
pscale service-token create --org <org>
# Use in CI/CD pipelines (GitHub Actions, GitLab CI, etc.)
export PLANETSCALE_SERVICE_TOKEN_ID=<token-id>
export PLANETSCALE_SERVICE_TOKEN=<token>
# Deploy via CI/CD
pscale deploy-request create <database> <branch> --auto-approve
Quick Reference
Most Common Commands
# Authentication
pscale auth login
pscale auth logout
# Branch management
pscale branch create <database> <branch> [--from <source-branch>]
pscale branch list <database>
pscale branch delete <database> <branch>
# Deploy requests
pscale deploy-request create <database> <branch>
pscale deploy-request list <database>
pscale deploy-request deploy <database> <number>
# Database operations
pscale database create <database> --org <org>
pscale database list
pscale shell <database> <branch>
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 name
deploy-schema-change.sh - Complete schema migration workflow
sync-branch-with-main.sh - Sync development branch with main
Scripts execute without loading into context (~90% token savings).
Resources
1---
2name: planetscale-cli-skills
3description: Comprehensive PlanetScale CLI (pscale) command reference and workflows for database management via terminal. Use when user mentions PlanetScale CLI, pscale commands, database branches, deploy requests, schema migrations, or any PlanetScale terminal operations. Routes to specialized sub-skills for auth, branches, deploy requests, databases, backups, and 10+ other pscale commands. Triggers on pscale, PlanetScale CLI, database branch, deploy request, schema migration, PlanetScale automation.
4requirements:
5 binaries:
6 - pscale
7 binaries_optional:
8 - grep
9 env_optional:
10 - PLANETSCALE_SERVICE_TOKEN_ID
11 - PLANETSCALE_SERVICE_TOKEN
12 notes: |
13 Requires PlanetScale CLI authentication via 'pscale auth login' (stores token in ~/.config/planetscale/).
14 Scripts require PCRE-enabled grep (grep -oP) - may need adjustment on BSD/macOS systems.
15metadata:
16 source: https://skillmd.com/skills/modbender/planetscale-cli-skills
17 openclaw:
18 purpose: >
19 Provide command reference and automation for PlanetScale CLI (pscale) operations only.
20 Scope is limited to: database and branch management, deploy requests, backups, passwords,
21 service tokens, and organization management via the pscale CLI tool.
22 capabilities:
23 - Run pscale CLI commands to manage PlanetScale databases, branches, and deploy requests
24 - Execute bundled automation scripts (create-branch-for-mr.sh, deploy-schema-change.sh, sync-branch-with-main.sh)
25 - Read PlanetScale CLI output and help users interpret results
26 install_mechanism: >
27 Skill files are loaded into agent context when a matching PlanetScale/pscale task is detected.
28 Automation scripts are executed directly via shell (bash). No network access beyond pscale CLI calls.
29 Scripts do not use eval or dynamic code execution; all pscale arguments are passed as discrete tokens.
30 requires:
31 credentials:
32 - name: PLANETSCALE_SERVICE_TOKEN_ID
33 description: >
34 PlanetScale service token ID for CI/CD authentication. Optional — interactive login
35 via 'pscale auth login' can be used instead. Token stored in environment variable only;
36 this skill does not read, store, or transmit credentials beyond passing them to pscale CLI.
37 required: false
38 - name: PLANETSCALE_SERVICE_TOKEN
39 description: >
40 PlanetScale service token secret for CI/CD authentication. Optional — interactive login
41 via 'pscale auth login' can be used instead. Token stored in environment variable only;
42 this skill does not read, store, or transmit credentials beyond passing them to pscale CLI.
43 required: false
44---
45
46# PlanetScale CLI Skills
47
48Comprehensive `pscale` command reference and workflows for managing PlanetScale databases via terminal.
49
50## Overview
51
52The 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.
53
54## Sub-Skills
55
56| Command | Skill | Use When |
57|---------|-------|----------|
58| **auth** | `pscale-auth` | Login, logout, service tokens, authentication management |
59| **branch** | `pscale-branch` | Create, delete, promote, diff, list database branches |
60| **deploy-request** | `pscale-deploy-request` | Create, review, deploy, revert schema changes |
61| **database** | `pscale-database` | Create, list, show, delete databases |
62| **backup** | `pscale-backup` | Create, list, show, delete branch backups |
63| **password** | `pscale-password` | Create, list, delete connection passwords |
64| **org** | `pscale-org` | List, show, switch organizations |
65| **service-token** | `pscale-service-token` | Create, manage CI/CD service tokens |
66
67## Decision Trees
68
69### Should I use a branch or deploy request?
70
71```
72What's your goal?
73├─ Experimenting with schema changes → Create branch (pscale-branch)
74├─ Testing schema in isolation → Create branch (pscale-branch)
75├─ Ready to deploy schema to production → Create deploy request (pscale-deploy-request)
76└─ Reviewing schema changes before production → Review deploy request (pscale-deploy-request)
77```
78
79### Service token vs password?
80
81```
82What's your use case?
83├─ CI/CD pipeline → Service token (pscale-service-token)
84├─ Local development → Password (pscale-password)
85├─ Production application → Service token (rotatable, secure)
86└─ One-off admin task → Password (temporary)
87```
88
89### Direct promotion vs deploy request?
90
91```
92Production readiness?
93├─ Immediate promotion (dangerous) → pscale branch promote (pscale-branch)
94├─ Review + approval workflow → pscale deploy-request create (pscale-deploy-request)
95└─ Safe production deployment → Always use deploy requests
96```
97
98## Common Workflows
99
100### Schema Migration Workflow
101
102Complete workflow from branch creation to production deployment:
103
104```bash
105# 1. Create development branch
106pscale branch create <database> <branch-name>
107
108# 2. Make schema changes (via shell, ORM, or direct SQL)
109pscale shell <database> <branch-name>
110
111# 3. View schema diff
112pscale branch diff <database> <branch-name>
113
114# 4. Create deploy request
115pscale deploy-request create <database> <branch-name>
116
117# 5. Review and deploy
118pscale deploy-request deploy <database> <deploy-request-number>
119
120# 6. Verify deployment
121pscale deploy-request show <database> <deploy-request-number>
122```
123
124See `scripts/` directory for automation.
125
126### Branch Development Workflow
127
128```bash
129# Create branch from main
130pscale branch create <database> <feature-branch> --from main
131
132# Work on schema changes
133pscale shell <database> <feature-branch>
134
135# Check diff before deploying
136pscale branch diff <database> <feature-branch>
137
138# Create deploy request when ready
139pscale deploy-request create <database> <feature-branch>
140```
141
142### CI/CD Integration
143
144```bash
145# Create service token for CI/CD
146pscale service-token create --org <org>
147
148# Use in CI/CD pipelines (GitHub Actions, GitLab CI, etc.)
149export PLANETSCALE_SERVICE_TOKEN_ID=<token-id>
150export PLANETSCALE_SERVICE_TOKEN=<token>
151
152# Deploy via CI/CD
153pscale deploy-request create <database> <branch> --auto-approve
154```
155
156## Quick Reference
157
158### Most Common Commands
159
160```bash
161# Authentication
162pscale auth login
163pscale auth logout
164
165# Branch management
166pscale branch create <database> <branch> [--from <source-branch>]
167pscale branch list <database>
168pscale branch delete <database> <branch>
169
170# Deploy requests
171pscale deploy-request create <database> <branch>
172pscale deploy-request list <database>
173pscale deploy-request deploy <database> <number>
174
175# Database operations
176pscale database create <database> --org <org>
177pscale database list
178pscale shell <database> <branch>
179```
180
181## Related Skills
182
183- **drizzle-kit** - ORM schema management and migrations
184- **gitlab-cli-skills** - GitLab MR workflow integration
185- **github** - GitHub PR and CI/CD integration
186
187## Automation Scripts
188
189See `scripts/` directory for token-efficient automation:
190
191- `create-branch-for-mr.sh` - Create PlanetScale branch matching your MR/PR branch name
192- `deploy-schema-change.sh` - Complete schema migration workflow
193- `sync-branch-with-main.sh` - Sync development branch with main
194
195Scripts execute without loading into context (~90% token savings).
196
197## Resources
198
199- Official docs: https://planetscale.com/docs/reference/planetscale-cli
200- GitHub: https://github.com/planetscale/cli
201- Community: https://github.com/planetscale/discussion