gcloud-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGoogle Cloud CLI Skill
Google Cloud CLI 技能
Installation
安装
The skill invokes the CLI. Install and initialize:
gcloud- Linux/macOS: then restart shell and run
curl https://sdk.cloud.google.com | bashgcloud init - Windows: Download Google Cloud SDK installer or use PowerShell to download and run
Verify: . Configure:
gcloud --versiongcloud init本技能调用 CLI,安装并初始化步骤:
gcloud- Linux/macOS: 执行 ,随后重启 shell 并运行
curl https://sdk.cloud.google.com | bashgcloud init - Windows: 下载 Google Cloud SDK 安装程序 或使用 PowerShell 下载运行
验证命令:,配置命令:
gcloud --versiongcloud initCheat Sheet & Best Practices
速查表与最佳实践
Config: ; ; — switch projects.
gcloud config set project <id>gcloud config listgcloud config configurations create/activate <name>Auth: ; use for SA; for CI.
gcloud auth login--impersonate-service-account--access-token-fileHacks: Use or + jq to cut output. Use for long or repeated flags. Use named configurations for dev/staging/prod. Run periodically.
--format="table(name,zone,status)"--format=json--flags-file=file.yamlgcloud components update配置: ; ; — 切换项目。
gcloud config set project <id>gcloud config listgcloud config configurations create/activate <name>认证: ;服务账户认证使用 参数;CI 场景使用 参数。
gcloud auth login--impersonate-service-account--access-token-file实用技巧: 使用 或 + jq 裁剪输出内容;长参数或重复参数可使用 读取;为开发/测试/生产环境配置命名配置项;定期执行 更新组件。
--format="table(name,zone,status)"--format=json--flags-file=file.yamlgcloud components updateCertifications & Training
认证与培训
Free: Google Cloud Learn and Google Skills — Innovators Program (35 credits/month). Certs: Cloud Digital Leader, Cloud Engineer (associate), Cloud Architect/DevOps (professional). Skill data: Config, auth, compute/storage/IAM; no exposed service-account keys.
免费资源: Google Cloud Learn 和 Google Skills — 创新者计划(每月35积分)。认证: 云数字领导者、云工程师(助理级)、云架构师/DevOps(专业级)。技能数据: 配置、认证、计算/存储/IAM;不暴露服务账户密钥。
Hooks & Workflows
钩子与工作流
Suggested hooks: Pre-deploy: . Use when devops is routed for GCP tasks (contextual: ).
gcloud config get-value projectgcp_projectWorkflows: Use with devops (contextual: ). Flow: detect GCP → load gcloud-cli → run CLI via skill script.
gcp_project建议钩子: 部署前执行 。当 devops 路由到 GCP 任务时使用(上下文参数:)。
gcloud config get-value projectgcp_project工作流: 配合 devops 使用(上下文参数:)。流程:检测到 GCP → 加载 gcloud-cli → 通过技能脚本运行 CLI 命令。
gcp_projectOverview
概述
Google Cloud Platform CLI operations. 90%+ context savings.
Google Cloud Platform CLI 操作能力,可节省90%以上的上下文处理时间。
Requirements
要求
- gcloud CLI installed
- GOOGLE_PROJECT_ID environment variable
- Authenticated via gcloud auth
- 已安装 gcloud CLI
- 配置 GOOGLE_PROJECT_ID 环境变量
- 已通过 gcloud auth 完成认证
Tools (Progressive Disclosure)
工具(渐进式披露)
Compute
计算
| Tool | Description | Confirmation |
|---|---|---|
| instances-list | List VM instances | No |
| instances-create | Create VM | Yes |
| instances-delete | Delete VM | REQUIRED |
| 工具名称 | 描述 | 需确认 |
|---|---|---|
| instances-list | 列出 VM 实例 | 否 |
| instances-create | 创建 VM | 是 |
| instances-delete | 删除 VM | 必填 |
Storage
存储
| Tool | Description | Confirmation |
|---|---|---|
| storage-ls | List buckets/objects | No |
| storage-cp | Copy objects | Yes |
| storage-rm | Delete objects | Yes |
| 工具名称 | 描述 | 需确认 |
|---|---|---|
| storage-ls | 列出存储桶/对象 | 否 |
| storage-cp | 复制对象 | 是 |
| storage-rm | 删除对象 | 是 |
IAM
IAM
| Tool | Description |
|---|---|
| iam-list | List IAM policies |
| service-accounts | List service accounts |
| 工具名称 | 描述 |
|---|---|
| iam-list | 列出 IAM 策略 |
| service-accounts | 列出服务账户 |
Logging
日志
| Tool | Description |
|---|---|
| logs-read | Read logs |
| logs-tail | Tail logs in real-time |
| 工具名称 | 描述 |
|---|---|
| logs-read | 读取日志 |
| logs-tail | 实时追踪日志 |
BLOCKED
已封禁
| Tool | Status |
|---|---|
| projects delete | BLOCKED |
| iam-policy delete | BLOCKED |
| 工具名称 | 状态 |
|---|---|
| projects delete | 已封禁 |
| iam-policy delete | 已封禁 |
Agent Integration
Agent 集成
- devops (primary): Cloud operations
- gcp-cloud-agent (primary): GCP specific
- cloud-integrator (secondary): Multi-cloud
- devops(主要):云操作
- gcp-cloud-agent(主要):GCP 专属场景
- cloud-integrator(次要):多云场景
Security
安全
⚠️ Never expose service account keys
⚠️ Resource deletion requires confirmation
⚠️ 永远不要暴露服务账户密钥
⚠️ 资源删除操作需要确认
Memory Protocol (MANDATORY)
内存协议(强制要求)
Before starting:
Read
.claude/context/memory/learnings.mdAfter completing:
- New pattern ->
.claude/context/memory/learnings.md - Issue found ->
.claude/context/memory/issues.md - Decision made ->
.claude/context/memory/decisions.md
ASSUME INTERRUPTION: If it's not in memory, it didn't happen.
开始前:
读取
.claude/context/memory/learnings.md完成后:
- 新的使用模式 → 写入
.claude/context/memory/learnings.md - 发现问题 → 写入
.claude/context/memory/issues.md - 做出决策 → 写入
.claude/context/memory/decisions.md
假设存在中断风险:未写入内存的内容等同于未发生。