‹ 首页

gcloud

@boshu2 · 收录于 1 周前

Google Cloud Platform CLI - manage GCP resources. Use when working with Compute Engine, Cloud Run, GKE, Cloud Functions, Storage, BigQuery, or other GCP services.

适合你,如果你需要管理 GCP 上的计算、存储或数据库资源

/ 下载安装
gcloud.skill双击,或拖进 Claude 桌面版 / Cowork,即完成安装↓ .skill↓ .zip
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code~/.claude/skills/(项目级 .claude/skills/)
Codex CLI~/.codex/skills/
Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add boshu2/agentops/gcloud
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- boshu2/agentops/gcloud
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify boshu2/agentops/gcloud
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
407GitHub stars
待重算上下文体积
镜像托管

怎么用

技能原文 SKILL.md作者撰写 · Apache-2.0 · bd3f0f7

<!-- TOC: Quick Start | THE EXACT PROMPT | Services | Output Formatting | AGENTS.md Blurb | When to Use | References -->

GCloud CLI

Core Capability: Manage Google Cloud Platform resources and services from the command line.
Quick Start
# Install
curl https://sdk.cloud.google.com | bash
exec -l $SHELL

# Verify
gcloud version

# Check auth
gcloud auth list

# Set project
gcloud config set project PROJECT_ID

# Show current config
gcloud config list

THE EXACT PROMPT — Auth & Config
# Login interactively
gcloud auth login

# Service account auth
gcloud auth activate-service-account --key-file=key.json

# Application default credentials
gcloud auth application-default login

# Set project
gcloud config set project PROJECT_ID

# Set region/zone
gcloud config set compute/region us-central1
gcloud config set compute/zone us-central1-a

# Named configurations
gcloud config configurations create my-config
gcloud config configurations activate my-config

THE EXACT PROMPT — Compute Engine
# List VMs
gcloud compute instances list

# Create VM
gcloud compute instances create my-vm \
  --zone=us-central1-a \
  --machine-type=e2-medium \
  --image-family=debian-12 \
  --image-project=debian-cloud

# SSH to VM
gcloud compute ssh my-vm --zone=us-central1-a

# Stop/start
gcloud compute instances stop my-vm --zone=us-central1-a
gcloud compute instances start my-vm --zone=us-central1-a

THE EXACT PROMPT — Cloud Run
# List services
gcloud run services list

# Deploy from source
gcloud run deploy my-service --source . --region=us-central1

# Deploy container
gcloud run deploy my-service \
  --image=gcr.io/PROJECT/IMAGE \
  --region=us-central1 \
  --allow-unauthenticated

# View logs
gcloud run services logs read my-service --region=us-central1

THE EXACT PROMPT — Cloud Storage
# List buckets
gcloud storage buckets list

# Create bucket
gcloud storage buckets create gs://my-bucket --location=us-central1

# Upload/download
gcloud storage cp local-file.txt gs://my-bucket/
gcloud storage cp gs://my-bucket/file.txt ./

# Sync directory
gcloud storage rsync -r ./local-dir gs://my-bucket/remote-dir

Essential Commands

| Service | List | Create | Delete | |---------|------|--------|--------| | Compute | gcloud compute instances list | gcloud compute instances create | gcloud compute instances delete | | Cloud Run | gcloud run services list | gcloud run deploy | gcloud run services delete | | Functions | gcloud functions list | gcloud functions deploy | gcloud functions delete | | GKE | gcloud container clusters list | gcloud container clusters create | gcloud container clusters delete | | Storage | gcloud storage buckets list | gcloud storage buckets create | gcloud storage rm |


Output Formatting
# JSON output
gcloud compute instances list --format=json

# Table with specific columns
gcloud compute instances list --format="table(name,zone,status)"

# Filter results
gcloud compute instances list --filter="status=RUNNING"

# Quiet mode (no prompts)
gcloud compute instances delete my-vm --quiet

Quick Reference
gcloud cheat-sheet      # Built-in cheat sheet
gcloud interactive      # Interactive shell
gcloud --help           # General help
gcloud compute --help   # Service-specific help

AGENTS.md Blurb

Copy this to your project's AGENTS.md:

### Google Cloud CLI (gcloud)

`gcloud` is installed and authenticated.

Auth:

\`\`\`bash
gcloud auth login
gcloud auth application-default login  # For API libraries
\`\`\`

Project:

\`\`\`bash
gcloud config set project <PROJECT_ID>
\`\`\`

Enable APIs:

\`\`\`bash
gcloud services enable aiplatform.googleapis.com
gcloud services enable analyticsdata.googleapis.com
\`\`\`

Useful commands:

\`\`\`bash
gcloud projects list
gcloud services list --enabled
gcloud beta billing accounts list
\`\`\`

When to Use
  • Enabling APIs for Gemini, Vertex AI, or other Google services
  • Managing billing and cost alerts
  • Creating service accounts for CI/CD
  • Deploying containers to Cloud Run
  • Managing GKE clusters

References

| Topic | Reference | |-------|-----------| | All services | [SERVICES.md](references/SERVICES.md) | | IAM & Security | [IAM.md](references/IAM.md) |

按 Apache-2.0 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。