关于 app-platform-router
App Platform Skills — Router 将 AI 助手的 DigitalOcean App Platform 任务分派给专门技能,覆盖开发、迁移、部署、数据服务和故障排查,并说明如何串联技能及交接产物。
主要功能
- 01将请求路由到专门技能
- 02跨项目阶段串联技能
- 03支持应用设计与迁移
- 04涵盖部署和故障排查
- 05提供数据与 AI 服务指引
- 06定义产物交接方式
适用场景
- 01设计并部署新的 App Platform 应用
- 02迁移现有 Heroku 应用
- 03为应用添加托管数据库
- 04诊断已部署服务的故障
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ digitalocean-labs/ do-app-platform-skills --skill app-platform-router安装后在 Claude Code 中输入/app-platform-router确认已加载。
详细介绍
App Platform 技能 — 路由器
概述
此技能会将 DigitalOcean App Platform 任务路由到专用子技能。每个子技能都针对特定工作流进行了优化,让上下文更聚焦、响应更精准。
理念:这些技能是有主见的操作手册,而非文档的复制品。它们会替你做出决策(默认使用 VPC、使用 GitHub Actions 进行 CI/CD 等),仅在处理边缘情况时才参考文档。
核心原则:技能只包含大模型无法从训练中获得的 DO 专属知识。这里不会重复通用的 SQL、SDK 模式和编程概念。
信任 AI:AI 助手应推理完整工作流,并在需要时串联多个技能,再根据上下文(全新项目、已有项目或故障排查)进行调整。技能提供领域知识,而非要求盲目遵循的固定脚本。
可用技能
开发阶段
| 技能 | 用途 | 关键产物 |
|---|---|---|
| devcontainers | 具备生产环境一致性的本地开发环境 | .devcontainer/、docker-compose.dev.yml |
架构阶段
| 技能 | 用途 | 关键产物 |
|---|---|---|
| designer | 将自然语言转化为可用于生产环境的 App Spec | .do/app.yaml |
| migration | 将现有应用(Heroku、AWS 等)迁移到 App Platform。深入介绍 Heroku,包括 Procfile/app.json/heroku.yml 解析、附加组件映射和流水线迁移 | .do/app.yaml、迁移清单 |
| planner | 生成从设计到部署的分阶段项目计划 | Plan/*.md 阶段文件 |
运维阶段
| 技能 | 用途 | 关键产物 |
|---|---|---|
| deployment | 通过 GitHub Actions 将代码发布到生产环境 | .github/workflows/deploy.yml |
| troubleshooting | 使用预构建的调试容器排查运行中应用的问题,并分析日志 | 修复方案、诊断报告 |
| sandbox | 用于 AI Agent 执行代码和测试的隔离容器 | 临时沙箱 |
数据服务
| 技能 | 用途 | 关键产物 |
|---|---|---|
| postgres | 完整的 PostgreSQL 设置:模式、用户、权限、多租户 | SQL 脚本(由用户执行) |
| managed-db-services | MySQL、MongoDB、Valkey、Kafka、OpenSearch(可绑定变量) | App spec 代码片段 |
| spaces | 兼容 S3 的对象存储配置 | CORS 配置、App spec 代码片段 |
AI 服务
| 技能 | 用途 | 关键产物 |
|---|---|---|
| ai-services | Gradient AI 推理端点 | App spec 代码片段 |
面向 AI 助手的 Console SDK
重要:AI 助手无法使用 doctl apps console——它会打开一个需要人工输入的交互式 WebSocket 会话。请改用 do-app-sandbox Python 包。
# Install
uv pip install do-app-sandbox # or: pip install do-app-sandbox
两种用例(同一个包,不同技能)
| 用例 | SDK 方法 | 技能 |
|---|---|---|
| 调试现有应用 | Sandbox.get_from_id(app_id, component) | troubleshooting |
| 创建新沙箱 | Sandbox.create()、SandboxManager | sandbox |
# Debug existing app (troubleshooting skill)
app = Sandbox.get_from_id(app_id="your-app-id", component="web")
# Create new isolated sandbox (sandbox skill)
sandbox = Sandbox.create(image="python")
完整指南:参见 shared/console-sdk-patterns.md
路由决策树
┌─────────────────────────────────────────────────────────────────┐
│ USER REQUEST │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────┐
│ Setting up development? │
└─────────────────────────┘
│
"local" / "devcontainer"
▼
┌───────────┐
│devcontainers│
└───────────┘
│
▼
┌─────────────────────────┐
│ Designing or creating? │
└─────────────────────────┘
│ │ │
"new app"│ │ "migrate" │ "plan" / "staged"
▼ ▼ ▼
┌───────────┐ ┌───────────┐ ┌───────────┐
│ designer │ │ migration │ │ planner │
└───────────┘ └───────────┘ └───────────┘
│
▼
┌─────────────────────────┐
│ Shipping code? │
└─────────────────────────┘
│
"deploy" / "ship" / "release"
▼
┌───────────┐
│deployment │
└───────────┘
│
▼
┌─────────────────────────┐
│ Something broken? │
└─────────────────────────┘
│
"broken" / "failing" / "debug" / "logs"
▼
┌───────────────┐
│troubleshooting│
└───────────────┘
│
▼
┌─────────────────────────┐
│ Need isolated execution?│
└─────────────────────────┘
│
"sandbox" / "isolated" / "execute code" / "code interpreter"
▼
┌───────────┐
│ sandbox │
└───────────┘
│
▼
┌─────────────────────────┐
│ Configuring data? │
└─────────────────────────┘
│ │ │
"postgres" │ "mysql" │ │ "storage" / "S3" / "spaces"
(complex) │ "mongo" │ │
│ "valkey" │ │
│ "kafka" │ │
│ "opensearch" │
▼ ▼ ▼
┌───────────┐ ┌─────────────────────┐ ┌───────────┐
│ postgres │ │ managed-db-services │ │ spaces │
└───────────┘ └─────────────────────┘ └───────────┘
│
▼
┌─────────────────────────┐
│ AI inference needed? │
└─────────────────────────┘
│
"gradient" / "LLM" / "inference"
▼
┌─────────────┐
│ ai-services │
└─────────────┘
工作流串联
AI 助手应推理完整工作流,而非仅路由到单个技能。
工作流类型
| 请求类型 | 工作流 | 技能链 |
|---|---|---|
| 全新构建 | “从头开始构建一个新应用” | devcontainers → designer → planner → deployment |
| 迁移 | “从 Heroku/AWS 迁移” | migration →(然后执行完整的全新构建工作流) |
| 既有项目 | “部署我现有的应用” | planner → deployment |
| 功能增强 | “为我的应用添加 Kafka” | managed-db-services → 更新 app.yaml → deployment |
| 故障排查 | “我的应用出问题了” | troubleshooting(独立执行) |
| AI Agent 执行 | “在隔离环境中运行代码” | sandbox(独立执行) |
| 特定任务 | “设置 PostgreSQL” | postgres(独立执行) |
串联逻辑
┌─────────────────────────────────────────────────────────────────┐
│ UNDERSTAND THE GOAL │
│ Is this a single task or a multi-phase workflow? │
└─────────────────────────────────────────────────────────────────┘
│
┌───────────────┴───────────────┐
│ │
▼ ▼
┌─────────────┐ ┌─────────────┐
│ Single Task │ │ Workflow │
│ │ │ │
│ Route to │ │ Chain │
│ one skill │ │ multiple │
└─────────────┘ └─────────────┘
│ │
▼ ▼
troubleshooting migration → designer →
postgres planner → deployment
spaces
etc.
示例
“我想构建一个使用 Kafka 的新事件驱动型应用”
- 从 designer 开始 → 创建包含 Kafka 的
.do/app.yaml - 使用 managed-db-services 获取 Kafka 专用的可绑定变量
- 使用 planner → 生成分阶段的 Plan/ 文件
- 使用 deployment 技能执行
“将我的 Heroku 应用迁移到 DigitalOcean”
- 从 migration 开始 → Heroku 深入章节会根据意图自动路由(问答、引导式、自动迁移)
- 解析 Procfile、app.json、heroku.yml,映射附加组件,并生成
.do/app.yaml - 使用 planner → 规划分阶段部署
- 使用 deployment 技能执行
“我部署的应用一直返回 502”
- 直接路由到 troubleshooting(单个技能,不串联)
- 使用调试容器,分析日志并修复问题
“为我现有的应用添加 PostgreSQL”
- 使用 postgres 设置架构和用户
- 更新
.do/app.yaml,添加数据库绑定 - 使用 deployment 技能重新部署
核心原则
AI 助手应该:
- 理解整体目标(而不只是眼前的请求)
- 判断需要哪些技能以及使用顺序
- 串联技能,并在它们之间传递产物
- 根据现有内容进行调整(全新构建与既有项目)
相信 AI 的推理能力。 这些技能提供领域知识,而不是僵化的脚本。
触发短语参考
| 路由到 | 触发短语 |
|---|---|
| devcontainers | “本地开发”、“docker compose”、“本地运行”、“devcontainer” |
| designer | “设计我的应用”、“创建应用规范”、“新应用”、“架构设计” |
| migration | “迁移”、“转换”、“从 Heroku 迁移”、“从 AWS 迁移”、“Heroku”、“Procfile”、“heroku.yml”、“dynos”、“Heroku 附加组件”、“Heroku 流水线” |
| planner | “创建计划”、“规划此项目”、“分阶段方案”、“规划部署”、“应该如何部署” |
| deployment | “部署”、“发布”、“上线”、“GitHub Actions”、“CI/CD” |
| troubleshooting | “出问题”、“失败”、“调试”、“日志”、“502”、“崩溃”、“错误” |
| sandbox | “沙箱”、“隔离环境”、“执行代码”、“代码解释器”、“运行不可信代码”、“Agent 执行”、“热池” |
| postgres | “postgres”、“postgresql”、“架构隔离”、“多租户数据库” |
| managed-db-services | “mysql”、“mongodb”、“mongo”、“valkey”、“redis”、“kafka”、“opensearch” |
| spaces | “对象存储”、“S3”、“Spaces”、“文件上传”、“存储桶” |
| ai-services | “gradient”、“推理”、“大模型端点”、“AI 平台” |
第三方集成(无需技能)
对于没有专用技能覆盖的集成(DataDog、Sentry、New Relic、Stripe 等):
- 获取凭据:从供应商处获取
- 添加到 GitHub Secrets(仓库 → Settings → Secrets → Actions)
- 在应用规范中引用:
envs: - key: DATADOG_API_KEY scope: RUN_TIME value: ${DATADOG_API_KEY} # From GitHub Secrets - 按照供应商文档设置 SDK/Agent
→ Agent 的训练涵盖特定供应商的模式,无需技能。
凭据处理原则
重要:这些技能旨在让 Agent 无法接触凭据。
优先顺序(从最推荐到最不推荐)
1. GITHUB SECRETS (RECOMMENDED DEFAULT)
├── Agent never sees credentials
├── User manually adds: Repo → Settings → Secrets → Actions
├── Workflow references: ${{ secrets.DATABASE_URL }}
└── Agent generates workflow, user handles secrets
2. APP PLATFORM BINDABLE VARIABLES
├── For DO Managed Databases (Postgres, MySQL, MongoDB, etc.)
├── Credentials injected via ${db.DATABASE_URL}
├── Agent configures app spec, never sees credentials
└── Best for: Apps using DO managed services
3. LOCAL .ENV + EPHEMERAL APP SPEC
├── User maintains .env file locally
├── Agent creates temp app spec with placeholders
└── Substitutes values → Deploys → Deletes temp file
4. EXTERNAL SERVICES
├── Same patterns as #1 or #3
└── User responsible for credential management
工件约定
所有技能都会以统一的命名方式生成和使用工件:
| 工件 | 文件名 | 生成方 | 使用方 |
|---|---|---|---|
| 应用规范 | .do/app.yaml | designer、migration | deployment、planner |
| 部署按钮 | .do/deploy.template.yaml | designer、migration | GitHub |
| 部署计划 | Plan/0N-*.md | planner | 用户、deployment |
| 开发环境 | .devcontainer/devcontainer.json | devcontainers | VS Code、Cursor |
| Docker Compose | docker-compose.yml | devcontainers | Docker Desktop |
| CI/CD 工作流 | .github/workflows/deploy.yml | deployment、planner | GitHub Actions |
| SQL 脚本 | db-*.sql | postgres | 用户(手动执行) |
| CORS 配置 | spaces-cors.json | spaces | DO 控制台 |
交接协议
技能完成后,应当:
- 说明生成的工件:“已创建
.do/app.yaml,采用 3 组件架构” - 注明文件路径:相对于项目根目录
- 适用时建议下一项技能:“要部署此项目,请使用 deployment skill”
插件/工具要求
| 技能 | 必需 | 可选 |
|---|---|---|
| devcontainers | filesystem、docker、git | gh |
| designer | filesystem | — |
| migration | filesystem、doctl、git、python | gh、DigitalOcean MCP |
| deployment | filesystem、doctl、git、python | gh、GitHub MCP |
| troubleshooting | filesystem、python、doctl | — |
| sandbox | filesystem、python、doctl | — |
| postgres | filesystem、psql | —(仅脚本) |
| managed-db-services | filesystem、doctl | — |
| spaces | filesystem | s3cmd(用于存储桶操作;doctl 仅管理密钥) |
| ai-services | filesystem | — |
子技能位置
app-platform-skills/
├── SKILL.md # This file (router)
├── skills/
│ ├── devcontainers/SKILL.md
│ ├── designer/SKILL.md
│ ├── migration/SKILL.md
│ ├── deployment/SKILL.md
│ ├── planner/SKILL.md # Staged project plans (design to deployment)
│ │ └── templates/ # Local + Tier 1, 2, 3 stage templates
│ ├── troubleshooting/SKILL.md
│ ├── sandbox/SKILL.md # Isolated containers for AI agent execution
│ ├── postgres/SKILL.md
│ ├── managed-db-services/SKILL.md # MySQL, MongoDB, Valkey, Kafka, OpenSearch
│ ├── spaces/SKILL.md
│ └── ai-services/SKILL.md # Gradient AI
└── shared/
├── app-spec-schema.yaml
├── artifact-contracts.md
└── credential-patterns.md
默认选项概览
| 领域 | 默认值 | 覆盖条件 |
|---|---|---|
| 网络 | 仅限 VPC,内部路由 | 用户明确要求公开访问 |
| CI/CD | GitHub + GitHub Actions | 用户指定 GitLab/Bitbucket |
| 密钥 | GitHub Secrets | 用户已有密钥库 |
| 构建 | Dockerfile | 用户明确偏好 buildpacks |
| 数据库 | DO Managed + Bindable Variables | 用户使用外部数据库 |
| Monorepo | 默认支持(source_dir) | 不适用 |
| Python 环境 | 使用 uv 管理包和虚拟环境 | 用户偏好 pip/poetry |
| Node 环境 | 使用 nvm 管理版本 | 用户偏好 n/volta |
升级处理
如果任务不适用于任何技能,或涉及多个技能且范围不明确:
- 提出澄清问题,以确定主要意图
- 如果任务分为多个阶段,建议技能使用顺序
- 对于真正新颖的任务,转而参考 App Platform 文档:https://docs.digitalocean.com/products/app-platform/