本文へ移動
cccskills
無料GitHub で公開

cloud-gcp

使用 gcloud CLI 操作 Google Cloud Platform。

当用户提到 GCP、Google Cloud、gcloud、Google Cloud SDK、GCE、GKE、BigQuery、Cloud Storage、Cloud Run、Cloud Functions、VPC、计算实例、VM、存储桶、部署到 GCP、GCP 项目、GCP 账单、IAM 权限等时触发此技能。

即使用户只说"我的云服务器"、"查看服务器状态"、"云存储"等模糊表述,如果上下文暗示 Google Cloud,也应使用此技能。

インストール方法を見る

含まれるファイル(1)

  • SKILL.md8.0 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Google Cloud Platform Operator Skill

核心理念

这是一个操作型技能,帮助你通过 gcloud CLI 管理 Google Cloud 资源。理解三个原则:

  1. 直接执行 - 不需要 wrapper 脚本,直接运行 gcloud 命令
  2. 安全确认 - 写操作必须先展示命令,用户确认后执行
  3. 问题自愈 - 遇到错误时自动诊断并尝试修复

工作流程

┌─────────────────────────────────────────────────────────────┐
│                    GCP 操作工作流                            │
├─────────────────────────────────────────────────────────────┤
│  1. 检查环境                                                 │
│     └─ which gcloud → 未安装则执行安装流程                    │
│                                                             │
│  2. 检查认证                                                 │
│     └─ gcloud auth list → 未认证则提示 gcloud auth login     │
│                                                             │
│  3. 确定项目                                                 │
│     └─ gcloud config get-value project                      │
│                                                             │
│  4. 执行操作                                                 │
│     ├─ 只读操作 → 直接执行                                   │
│     └─ 写操作 → 展示命令 → 用户确认 → 执行                    │
│                                                             │
│  5. 处理结果                                                 │
│     ├─ 成功 → 表格/JSON 展示结果                             │
│     └─ 失败 → 诊断错误 → 提供解决方案                         │
└─────────────────────────────────────────────────────────────┘

环境准备

快速检查

which gcloud && gcloud --version

安装(推荐官方一键安装)

curl https://sdk.cloud.google.com > install.sh && bash install.sh --disable-prompts

安装后必须配置

# 添加到 PATH(永久)
echo 'source ~/google-cloud-sdk/path.zsh.inc' >> ~/.zshrc
source ~/google-cloud-sdk/path.zsh.inc

# 认证
gcloud auth login

# 设置默认项目(可选)
gcloud config set project PROJECT_ID

常见问题修复

问题解决命令
gcloud not foundsource ~/google-cloud-sdk/path.zsh.inc
Python 版本错误export CLOUDSDK_PYTHON=/opt/homebrew/bin/python3
网络超时检测或设置代理(见下方)
未认证gcloud auth login

网络代理配置

如果遇到网络超时,询问用户代理端口后设置:

export ALL_PROXY=http://127.0.0.1:<端口>

常见代理端口:7890、7897、1087、8080


安全机制(强制遵守)

操作分类

类型示例命令执行方式
只读list, describe, get, ls直接执行
写操作create, delete, update, deploy先确认后执行
销毁操作delete, remove, destroy确认 + 风险提示

写操作确认流程

正确示例:

用户: 创建一个叫 my-bucket 的存储桶

Agent: 即将执行以下命令:
gcloud storage buckets create gs://my-bucket --project=xxx --location=asia-east1

这将创建一个新存储桶,可能产生存储费用。确认执行?(yes/no)

销毁操作额外提示:

用户: 删除 vm-1 实例

Agent: ⚠️ 警告:此操作不可逆!
即将执行:gcloud compute instances delete vm-1 --zone=asia-east1-a

实例上的所有数据将被永久删除。确认执行?(yes/no)

常用命令速查

项目与配置

gcloud projects list                          # 列出所有项目
gcloud config get-value project               # 查看当前项目
gcloud config set project PROJECT_ID          # 切换项目
gcloud config list                            # 查看所有配置

Compute Engine (VM)

gcloud compute instances list                 # 列出所有实例
gcloud compute instances describe NAME --zone=ZONE
gcloud compute instances create NAME --zone=ZONE --machine-type=e2-micro
gcloud compute instances start NAME --zone=ZONE
gcloud compute instances stop NAME --zone=ZONE
gcloud compute instances delete NAME --zone=ZONE

Cloud Storage (GCS)

gcloud storage buckets list                   # 列出存储桶
gcloud storage buckets create gs://BUCKET_NAME --location=LOCATION
gcloud storage ls gs://BUCKET_NAME            # 列出文件
gcloud storage cp LOCAL_FILE gs://BUCKET_NAME/  # 上传
gcloud storage cp gs://BUCKET_NAME/FILE .     # 下载

BigQuery

gcloud bigquery datasets list
gcloud bigquery queries --use_legacy_sql=false 'SELECT * FROM `project.dataset.table` LIMIT 10'

Cloud Run

gcloud run services list
gcloud run deploy SERVICE --image=IMAGE --region=REGION --allow-unauthenticated

GKE (Kubernetes)

gcloud container clusters list
gcloud container clusters get-credentials CLUSTER --region=REGION

IAM 与权限

gcloud iam service-accounts list
gcloud projects get-iam-policy PROJECT_ID     # 查看项目权限

账单与配额

gcloud billing accounts list                  # 列出账单账户
gcloud billing projects describe PROJECT_ID   # 查看项目计费状态
gcloud compute regions describe REGION        # 查看区域配额

输出格式

默认使用 table 格式(人类可读):

gcloud compute instances list --format=table

需要程序处理时使用 json:

gcloud compute instances list --format=json

表格字段筛选:

gcloud compute instances list --format="table(name,zone,status,machineType.basename())"

错误诊断

常见错误速查

错误信息原因解决方案
command not found: gcloud未安装或未添加 PATH安装或 source path.zsh.inc
You do not currently have an active account未认证gcloud auth login
PERMISSION_DENIED权限不足检查 IAM 权限或换账户
Quota exceeded配额用尽申请提高配额或清理资源
Not found资源不存在检查名称/区域是否正确
Python versionPython 版本不兼容export CLOUDSDK_PYTHON=...

诊断命令

# 检查认证状态
gcloud auth list

# 检查当前配置
gcloud config list

# 检查项目权限
gcloud projects get-iam-policy $(gcloud config get-value project)

示例交互

示例 1:查看 VM 实例

用户: 我的 Google Cloud 有哪些服务器?

Agent: [执行 gcloud compute instances list]

示例 2:创建存储桶

用户: 在 GCP 创建一个存储桶 backup-2026

Agent: 即将执行:
gcloud storage buckets create gs://backup-2026 --project=xxx --location=asia-east1

确认执行?(yes/no)

示例 3:查看账单

用户: 帮我看看 GCP 账单情况

Agent: [执行 gcloud billing accounts list 和 gcloud billing projects describe]

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.

日本語の概要は準備中です。原文の説明を表示しています。

Scoheart/agentskills22026年8月4日 更新

ant-bank

無料

蚂蚁银行开户

日本語の概要は準備中です。原文の説明を表示しています。

Scoheart/agentskills22026年8月4日 更新

Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.

日本語の概要は準備中です。原文の説明を表示しています。

Scoheart/agentskills22026年8月4日 更新

Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, or extract information from web pages.

日本語の概要は準備中です。原文の説明を表示しています。

Scoheart/agentskills22026年8月4日 更新

Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.

日本語の概要は準備中です。原文の説明を表示しています。

Scoheart/agentskills22026年8月4日 更新

cloud-aws

無料

仅使用 AWS CLI 操作 AWS。Agent 直接执行 aws 命令(无需脚本)。仅在用户提到 AWS、S3、EC2、Lambda 等时激活。

日本語の概要は準備中です。原文の説明を表示しています。

Scoheart/agentskills22026年8月4日 更新

Scoheart のスキルをすべて見る

このスキルの問題を報告する