kb-cloud-skills
Execute real operations against the KubeBlocks Cloud API. Use this skill when users need to query, create, modify, or delete KubeBlocks Cloud resources.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Execute real operations against the KubeBlocks Cloud API. Use this skill when users need to query, create, modify, or delete KubeBlocks Cloud resources.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | kb-cloud-skills |
| description | Execute real operations against the KubeBlocks Cloud API. Use this skill when users need to query, create, modify, or delete KubeBlocks Cloud resources. |
| metadata | {"author":"apecloud"} |
Execute real operations against the KubeBlocks Cloud API using DigestAuth. This skill teaches the agent how to authenticate, navigate the reference docs, construct curl commands, and present results.
This project includes auto-generated API reference docs:
references/
├── openapi/ # User-facing API (/api/v1/)
│ ├── resources/ # 77 resource index files
│ ├── operations/ # 720 operation detail files
│ └── schemas/ # 572 schema groups
└── adminapi/ # Admin-facing API (/admin/v1/)
├── resources/ # 88 resource index files
├── operations/ # 851 operation detail files
└── schemas/ # 669 schema groups
Navigation order: resource → operation → schema. Start from the resource list below, find the operation you need, then read schemas for request/response details.
KubeBlocks Cloud is a cloud-native database management platform supporting multiple database engines (MySQL, PostgreSQL, Redis, MongoDB, Kafka, etc.).
Core concepts:
| API | Prefix | Purpose | Typical resources |
|---|---|---|---|
| openapi | /api/v1/ | User-facing, manage database resources | cluster, backup, account, restore, kafka, redis... |
| adminapi | /admin/v1/ | Admin-facing, manage platform config | environment, engine, organization, SLA, pricing... |
Before any operation, verify these environment variables are set:
| Variable | Description |
|---|---|
KB_CLOUD_BASE_URL | API base URL |
KB_CLOUD_ACCESS_KEY | API accessKey (get it from Personal Settings → API Keys) |
KB_CLOUD_SECRET_KEY | API secretKey (get it from Personal Settings → API Keys) |
If any are missing, prompt the user to set them:
export KB_CLOUD_BASE_URL="YOUR_BASE_URL"
export KB_CLOUD_ACCESS_KEY="YOUR_ACCESS_KEY"
export KB_CLOUD_SECRET_KEY="YOUR_SECRET_KEY"
Follow these steps for every user request:
This step is critical — getting it wrong means all subsequent operations will fail.
Determine whether the key is an admin key or a user key by probing in order:
1. Probe /admin/v1/user first:
curl -s -o /dev/null -w "%{http_code}" --digest \
-u "$KB_CLOUD_ACCESS_KEY:$KB_CLOUD_SECRET_KEY" \
"$KB_CLOUD_BASE_URL/admin/v1/user"
/admin/v1/). Done — skip step 2.2. Probe /api/v1/user (only if step 1 was not 200):
curl -s -o /dev/null -w "%{http_code}" --digest \
-u "$KB_CLOUD_ACCESS_KEY:$KB_CLOUD_SECRET_KEY" \
"$KB_CLOUD_BASE_URL/api/v1/user"
Each command outputs a single number (e.g. 200, 401). No parsing needed. The -o /dev/null -w "%{http_code}" flags ensure only the final HTTP status is printed — DigestAuth's challenge-response 401 is hidden by curl's automatic retry.
Decision table:
Step 1 (/admin/v1/user) | Step 2 (/api/v1/user) | Meaning | Action |
|---|---|---|---|
| 200 | (skipped) | Admin key | Use adminapi (/admin/v1/) |
| Not 200 | 200 | User key | Use openapi (/api/v1/) |
| 401 | 401 | Invalid key | Tell user to check KB_CLOUD_ACCESS_KEY / KB_CLOUD_SECRET_KEY |
| 404 or connection error | 404 or connection error | Wrong URL | Tell user to check KB_CLOUD_BASE_URL |
Cache the result: once determined, remember the key type for the rest of the session. Only re-probe if the user explicitly changes KB_CLOUD_ACCESS_KEY or KB_CLOUD_BASE_URL.
From this step, derive these variables for the rest of the session:
{prefix} = admin/v1 if admin key, or api/v1 if user key{api_doc} = adminapi if admin key, or openapi if user keyAnalyze what the user wants and determine the resource + operation:
If the user's intent is unclear, ask for clarification.
Follow the resource → operation → schema chain under the references directory corresponding to the API determined in Step 0 (references/adminapi/ or references/openapi/).
Let {api_doc} = adminapi or openapi, from Step 0.
2a. Find the resource
List the resources directory to see available resources, then read the one matching the user's intent:
ls references/{api_doc}/resources/
Pick the resource file that matches, then read it:
Read references/{api_doc}/resources/cluster.md
Resource files list all available operations for that resource (method + path + summary).
2b. Read the operation file
Read references/{api_doc}/operations/listCluster.md
Operation files contain:
2c. Read schema files (as needed)
When an operation has a request body, you must read the referenced schema to understand the body structure:
Read references/{api_doc}/schemas/clusterCreate/clusterCreate.md
Schema files list all fields, their types, and whether they are required. If a field's type links to another schema (e.g. [clusterType](clusterType.md)), follow the link and read that schema as needed.
When an operation references a response schema, read it as well to understand the return structure for better output formatting.
All requests use DigestAuth. Construct curl commands as follows:
GET request (no body):
curl -s --digest \
-u "$KB_CLOUD_ACCESS_KEY:$KB_CLOUD_SECRET_KEY" \
-H "Content-Type: application/json" \
"$KB_CLOUD_BASE_URL/{prefix}/organizations/{orgName}/clusters?clusterDefinition=mysql"
POST/PATCH request (with body):
curl -s --digest \
-u "$KB_CLOUD_ACCESS_KEY:$KB_CLOUD_SECRET_KEY" \
-H "Content-Type: application/json" \
-X POST \
-d '{
"name": "my-cluster",
"engine": "mysql",
"environmentName": "dev",
"version": "8.0.30"
}' \
"$KB_CLOUD_BASE_URL/{prefix}/organizations/{orgName}/clusters"
DELETE request:
curl -s --digest \
-u "$KB_CLOUD_ACCESS_KEY:$KB_CLOUD_SECRET_KEY" \
-X DELETE \
"$KB_CLOUD_BASE_URL/{prefix}/organizations/{orgName}/clusters/{clusterName}"
⚠️ Destructive operations require user confirmation:
Non-GET operations (POST, PATCH, PUT, DELETE) modify or destroy resources. Before executing any of these, you must:
prod-db in org my-org. This action is irreversible.")$KB_CLOUD_BASE_URL to show the real URL so the user can verify the target. Keep $KB_CLOUD_ACCESS_KEY:$KB_CLOUD_SECRET_KEY unexpanded — never reveal the actual key and secret values.Do NOT execute non-GET requests without confirmed user consent. GET requests may be executed directly.
Key points:
--digest -u "$KB_CLOUD_ACCESS_KEY:$KB_CLOUD_SECRET_KEY"-H "Content-Type: application/json" and -d with a JSON body{orgName}) with actual valuesFormatting JSON responses:
curl ... | python3 -m json.toolcurl ... | jqcurl -s --digest \
-u "$KB_CLOUD_ACCESS_KEY:$KB_CLOUD_SECRET_KEY" \
"$KB_CLOUD_BASE_URL/{prefix}/organizations/{orgName}/clusters" \
| python3 -m json.tool
Presentation guidelines:
Error handling:
| Status | Meaning | Action |
|---|---|---|
| 200 | Success | Display normally |
| 201 | Created | Show the new resource |
| 400 | Bad request | Show error details, verify parameters |
| 401 | Unauthorized | API key authentication failed, prompt user to check |
| 403 | Forbidden | Authenticated but lacks business permission for this operation |
| 404 | Not found | Verify resource name / org name |
| 409 | Conflict | Resource name already exists |
| 5xx | Server error | Retry later |
Operation files contain paths with {param} placeholders:
{orgName}: organization name{clusterName}: cluster name{instanceName}: instance name{clusterID}: cluster ID (UUID format)Never guess or fabricate parameter values. When a required parameter is unknown, follow this priority:
{orgName}? → list organizations{clusterName}? → list clusters{environmentName}? → list environmentsmy-org")The same applies to query parameters and JSON body fields for POST/PATCH requests. Always resolve values from real data or user input — never send a request with made-up values.
List endpoints typically support pagination:
limit: items per page (default is usually 10 or 20)offset: pagination offsetIf the user needs all data, fetch the first page, check pageResult for more, and continue fetching.
When constructing a POST/PATCH body:
[type](type.md) links) may require reading sub-schemasUser: "List my clusters"
Execution flow:
references/{api_doc}/resources/cluster.md → find GET /{prefix}/organizations/{orgName}/clustersreferences/{api_doc}/operations/listCluster.md → understand parameterscurl -s --digest \
-u "$KB_CLOUD_ACCESS_KEY:$KB_CLOUD_SECRET_KEY" \
"$KB_CLOUD_BASE_URL/{prefix}/organizations/my-org/clusters" \
| python3 -m json.tool
items[], present as a tableUser: "Create a MySQL cluster for me"
Execution flow:
POST /{prefix}/organizations/{orgName}/clustersclusterCreatereferences/{api_doc}/schemas/clusterCreate/clusterCreate.md