PlanetScale CLI 技能:精通数据库分支与 pscale 操作 - Openclaw Skills
作者:互联网
2026-03-29
什么是 PlanetScale CLI 技能?
PlanetScale CLI 技能包为开发人员提供了一个强大的界面,以便使用官方 pscale 工具管理其数据库基础设施。通过将 Openclaw 技能集成到您的开发环境中,您可以访问结构化的命令参考以及用于数据库分支、部署请求和安全身份验证的自动化工作流。此技能简化了复杂的数据库操作,让您能够通过类 Git 的分支和合并功能,像对待应用程序代码一样严谨地处理数据库模式更改。
该技能专为效率而生,填补了基于终端的数据库管理与高级 AI 编排之间的空白。无论您是进行快速的模式差异对比,还是管理大规模组织服务令牌,这些 Openclaw 技能都能确保每个 pscale 命令在执行时具备技术精准性和最佳的上下文感知。
下载入口:https://github.com/openclaw/skills/tree/main/skills/vince-winkintel/planetscale-cli-skills
安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install planetscale-cli-skills
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
3. 提示词安装
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 planetscale-cli-skills。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
PlanetScale CLI 技能 应用场景
- 管理数据库分支以进行功能开发和隔离测试。
- 在 CI/CD 流水线中自动化模式迁移和部署请求。
- 为团队环境处理安全身份验证和服务令牌管理。
- 将开发分支与生产模式同步,以防止迁移冲突。
- 执行快速的数据库管理任务,如创建备份或管理连接密码。
- 代理在用户提示中检测到与 PlanetScale 相关的任务,例如 pscale 命令或数据库分支请求。
- Openclaw 技能为所需的特定 pscale 子命令(如 auth、branch 或 deploy-request)提供必要的上下文和命令语法。
- 对于复杂操作,该技能利用捆绑的 bash 脚本来自动化多步骤工作流,例如为特定的拉取请求或合并请求创建分支。
- 解析 pscale CLI 的输出结果,以便在迁移生命周期中提供可操作的反馈或后续步骤,例如确认部署成功。
PlanetScale CLI 技能 配置指南
确保已安装 PlanetScale CLI 并在系统路径中可用。使用 Openclaw 技能配置身份验证和环境访问:
# 如果尚未安装,请安装 PlanetScale CLI
# 使用您的 PlanetScale 账号登录
pscale auth login
对于 CI/CD 环境或自动化工作流,请设置以下环境变量以绕过交互式登录:
export PLANETSCALE_SERVICE_TOKEN_ID=<您的-令牌-id>
export PLANETSCALE_SERVICE_TOKEN=<您的-令牌-密钥>
PlanetScale CLI 技能 数据架构与分类体系
此技能与 PlanetScale API 和本地配置文件交互以管理状态。关键数据元素包括:
| 组件 | 描述 | 存储位置 |
|---|---|---|
| 身份验证 | OAuth 令牌和会话数据 | ~/.config/planetscale/ |
| 分支 | 数据库分支元数据和状态 | PlanetScale 云端 |
| 部署请求 | 模式更改日志和审批状态 | PlanetScale 云端 |
| 自动化脚本 | 用于工作流的预配置 Shell 脚本 | /scripts/ 目录 |
| 环境 | 服务令牌和组织 ID | 环境变量 |
name: planetscale-cli-skills
description: 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.
requirements:
binaries:
- pscale
binaries_optional:
- grep
env_optional:
- PLANETSCALE_SERVICE_TOKEN_ID
- PLANETSCALE_SERVICE_TOKEN
notes: |
Requires PlanetScale CLI authentication via 'pscale auth login' (stores token in ~/.config/planetscale/).
Scripts require PCRE-enabled grep (grep -oP) - may need adjustment on BSD/macOS systems.
metadata:
openclaw:
purpose: >
Provide command reference and automation for PlanetScale CLI (pscale) operations only.
Scope is limited to: database and branch management, deploy requests, backups, passwords,
service tokens, and organization management via the pscale CLI tool.
capabilities:
- Run pscale CLI commands to manage PlanetScale databases, branches, and deploy requests
- Execute bundled automation scripts (create-branch-for-mr.sh, deploy-schema-change.sh, sync-branch-with-main.sh)
- Read PlanetScale CLI output and help users interpret results
install_mechanism: >
Skill files are loaded into agent context when a matching PlanetScale/pscale task is detected.
Automation scripts are executed directly via shell (bash). No network access beyond pscale CLI calls.
Scripts do not use eval or dynamic code execution; all pscale arguments are passed as discrete tokens.
requires:
credentials:
- name: PLANETSCALE_SERVICE_TOKEN_ID
description: >
PlanetScale service token ID for CI/CD authentication. Optional — interactive login
via 'pscale auth login' can be used instead. Token stored in environment variable only;
this skill does not read, store, or transmit credentials beyond passing them to pscale CLI.
required: false
- name: PLANETSCALE_SERVICE_TOKEN
description: >
PlanetScale service token secret for CI/CD authentication. Optional — interactive login
via 'pscale auth login' can be used instead. Token stored in environment variable only;
this skill does not read, store, or transmit credentials beyond passing them to pscale CLI.
required: false
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
# 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=
# Deploy via CI/CD
pscale deploy-request create --auto-approve
Quick Reference
Most Common Commands
# Authentication
pscale auth login
pscale auth logout
# Branch management
pscale branch create [--from ]
pscale branch list
pscale branch delete
# 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
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- Sync development branch with main
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
相关推荐
专题
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
最新数据
相关文章
读取 Intercom 对话:提取支持数据 - Openclaw Skills
DocuClaw: 本地 AI 文档智能与归档 - Openclaw 技能
Pywayne Cross Comm:WebSocket 多语言消息通信 - Openclaw Skills
ERC-8004:区块链 AI 代理身份与声誉 - Openclaw Skills
行动建议器:人工智能驱动的潜客跟进建议 - Openclaw Skills
会话成本追踪器:优化 Token 投资回报率 - Openclaw Skills
Memoria: AI 智能体结构化记忆系统 - Openclaw Skills
Deno 运行时专家:安全 TypeScript 开发 - Openclaw Skills
为 AI 代理部署 Spark Bitcoin L2 代理 - Openclaw Skills
加密货币价格技能:实时市场数据集成 - Openclaw Skills
AI精选
