google/skills/gcloud
Claude Code and agent skill by google/skills
- vendor
Checking that the SKILL.md file is still in the repository.
Provides safety-critical validation, guardrails, and data reduction for gcloud CLI operations across Google Cloud Platform (GCP) services and infrastructure. Use when planning, generating, constructing, proposing, describing, or executing any gcloud CLI commands - including when answering questions about gcloud syntax, or formatting flags. Don't use when writing Google Cloud client library code or raw REST/gRPC API requests.
Install
npx vskill@latest install google/skills/gcloudSKILL.md
The same SKILL.md was published earlier as google/skills/gcloud.
gcloud CLI Skill for AI Agents
[!CAUTION]### MANDATORY PRE-CONDITION: EXPLICIT LEAF-LEVEL SYNTAX VALIDATIONAll pre-existing knowledge ofgcloudcommands, flags, flag values, andpositional argument syntax is stale and prone to hallucination.NEVER propose command parameters, output flag options, execute commands, ORoutline step-by-step plans for anygcloudtask before validating leaf-levelsyntax viagcloud help <command>(or including leaf-level help lookup as amandatory step in the plan).Mandatory Action Rules:1. Direct Execution & Code Generation: ALWAYS invoke `gcloud help<leaf_command>(e.g.gcloud help compute instances createorgcloudhelp sql instances create`) before proposing or executing the finalcommand syntax, UNLESS the user prompt already providesgcloud helpoutput, states to assume command syntax is already validated, or instructsnot to execute any commands. When instructed not to execute any commands,NEVER invokerun_command(not even forgcloud helpor directorylisting commands likels); read bundled reference files(references/cli-usage.md,references/mcp-usage.md, andreferences/attribution.md) directly withread_file.2. Planning & Strategy Queries: When asked for a plan, strategy, or nextsteps to achieve a user goal (e.g., *"What is your plan to accomplishX..."*), the response **MUST explicitly include running `gcloud help<leaf_command>`** as Step 1 of the plan before proposing flags orexecuting commands.3. Non-Transitive Validation: Parent command group help (e.g. `gcloudhelp compute`) is not sufficient for leaf-level syntax validation.Validation must occur at the specific leaf subcommand level.4. FORBIDDEN Web Search Fallback: NEVER usesearch_web, web search, orexternal documentation search tools for gcloud CLI syntax. `gcloud help<leaf_command>` is the EXCLUSIVE authorized authority for commandsyntax.5. User Flag & Project Preservation: When proposing intermediate commandsteps, ALWAYS preserve all user-specified flags (including--project=<project_id>) in the proposed response text.6. Mandatory Plan Template: When generating a plan, the response MUSTcopy this exact 4-step structure:- Step 1: Syntax Validation viagcloud help <leaf_command>- Step 2: Parameter Verification (confirming required and optionalflags, and explicitly checking if the--dry-runor--validate-onlyflag is supported)- Step 3: Dry-Run Command Proposal (If--dry-runor--validate-onlyis supported, there MUST be a--dry-runor--validate-onlyinvocation before the next step.)- Step 4: Command Proposal & Authorization (If the command is on the"Prohibited Operations" denylist, state that autonomous execution isforbidden, and the user MUST be explicitly asked for authorization toproceed. If the command is NOT on the denylist, propose or proceedwith execution, while following ALL "Execution Constraints" below.)
This document provides essential guidelines and best practices for AI agents interacting with the Google Cloud SDK (gcloud CLI). Following these rules is critical to avoid hallucinated commands, flags, flag values, and positional argument syntax, prevent destructive actions, and minimize context window usage.
Usage Attribution
MUST READ: Before executing any gcloud, REST API, or MCP command, you MUST read and follow the instructions in Usage Attribution. If a more specific product or domain skill (e.g., cloud-run-basics, bigquery-basics, gke-basics) is also loaded or active for the current task, ALWAYS use that specific skill's skill:<name> attribution tag instead of skill:gcloud. For commands executed directly in the terminal when no product-specific skill applies (never in generated scripts, Terraform, or user code), prefix gcloud with CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:gcloud)" and append agent-skills/1.0 (skill:gcloud) to User-Agent headers.
Execution Modes
AI agents can interact with Google Cloud resources in two primary ways:
- Direct CLI Execution: Executing
gcloudcommands directly in a local or
automated shell environment. See CLI Usage for installation, authentication flows, and configuration management.
- Model Context Protocol (MCP): Invoking structured tools via the Cloud
CLI remote MCP server (run_gcloud_command). See MCP Usage for tool schemas, parameter rules, and server configuration.
Core Principles
1. Explicit Command Validation (Mandatory)
- Action: ALWAYS call
gcloud help <command>for the exact command
that is intended to be run (e.g., gcloud help compute instances create).
- Verify: Ensure the command, flags, flag values, and positional argument
syntax are valid for that specific leaf command before attempting execution or presenting plans. Validation is not transitive from parent groups.
2. Data Reduction Strategies (Mandatory)
Minimize the volume of data returned by gcloud to save context window space and reduce latency. DO NOT execute any list command without including at least one data reduction flag (--limit, --filter, or --format).
- Projection: Use
--format="json(key1, key2, ...)"to select only the
specific fields needed for the task. To understand the advanced projection and formatting syntax, refer to gcloud topic projections and gcloud topic formats.
- Limiting: Use
--limit=Nto cap the number of resources returned.
- Filtering: Use
--filterto narrow down results server-side. Prioritize
: for pattern matching and never quote the right side of the colon. Treat the entire filter flag as a singular string without quoting or escaping characters. To study the filter expression syntax, refer to gcloud topic filters.
- Schema Discovery: Unconstrained resource lists can quickly exhaust the
context window with redundant data. To prevent this, discover a resource's schema before executing queries. If unsure of the JSON key path for projecting fields (--format) or filtering (--filter), run the targeted resource's list command (if supported) with a single-item limit:
``bash gcloud <GROUP> <RESOURCE> list --limit=1 --format=json ``
Examine this single instance's JSON structure to safely identify the correct schema keys before requesting full or filtered datasets.
3. Execution Constraints
- Single Commands: Execute a single
gcloudcommand at a time. No command
chaining or sequencing.
- No Shell Operators: Do not use command substitution (
$(...)), pipes
(|), or redirection (>, >>, <). This is to increase command safety and ensure commands are more easily understandable and reviewable by users.
- Non-Interactive Execution (`--quiet` / `-q`): Pass the
--quiet(or
-q) global flag on all execution commands (e.g., gcloud pubsub topics delete temp-topic --quiet --project=test-project). AI agents run in headless, non-interactive environments without a TTY or stdin input handler. Without --quiet, commands that prompt for user confirmation (such as deleting resources, approving defaults, or selecting unspecified regions) will pause execution indefinitely waiting for input, causing background task timeouts. Including --quiet forces non-interactive mode, causing gcloud to automatically accept safe default choices or fail immediately with an explicit error if required parameters are missing.
- No Blind Lists: NEVER execute a
listcommand without--limit,
--filter, or --format.
4. Project and Location Scoping (Critical)
To ensure commands are deterministic, non-interactive, and target the correct environment, they must explicitly provide project and location scoping.
- Explicit Project Target: Do not rely on active configuration defaults.
Always append --project=<PROJECT_ID> to all resource-manipulating and querying commands (unless running pure local config commands). This avoids accidental execution against the wrong project.
- Prevent Location Prompts: Many Google Cloud resources are regional or
zonal. If the location flag is omitted (e.g., --region, --zone, or --location), gcloud will trigger an interactive prompt to select a zone/region. This violates the No Interactivity rule. Always provide explicit location flags if the command requires them.
- Location Discovery: If the correct region, zone, or location for a
service is not known, run discovery commands first (remembering to limit results if there are many):
- Compute Engine (VMs, Networks):
-
gcloud compute regions list --project=<PROJECT_ID> -
gcloud compute zones list --project=<PROJECT_ID>
- Other Services (Standard API Style): Many GCP services utilize a
unified locations list command:
-
gcloud <GROUP> locations list --project=<PROJECT_ID> - Examples:
gcloud artifacts locations list, `gcloud kms locations
list, gcloud secrets locations list`.
Safety & Guardrails
[!CAUTION] **Destructive actions (delete, update, remove) MUST be explicitlyauthorized by the user.** Never invoke them autonomously unless explicitlyinstructed to do so in the context of a safe, pre-approved workflow.
Prohibited Operations (Denylist)
NEVER execute the following commands autonomously. These require explicit human-in-the-loop authorization:
- Any IAM policy, role, or binding modification (Security): Risk of
privilege escalation, administrative lockout, service disruption, or unauthorized data exposure.
- No Proactive API Enabling: Assume necessary APIs are enabled. To prevent
unexpected resource provisioning or billing charges, do not proactively try to enable APIs. User approval is required to enable any API.
- No Proactive `gcloud` CLI Installation (Host Modification): Never
autonomously install the Google Cloud CLI (gcloud CLI) or additional gcloud CLI components (gcloud components install, gcloud components update, or system package manager installs of the gcloud CLI). If the gcloud binary or a required CLI component is missing, you must inform the user, ask for explicit user confirmation (e.g., "I am ready to install the Google Cloud CLI (`gcloud`). Do you want me to proceed?"), and strictly stop to wait for the user's positive affirmation before executing any installation commands.
- `gcloud * delete` (Destructive): Irreversible resource destruction
(e.g., project deletion) or data wiping.
- `gcloud billing *` (Financial): Risk of service disruption or unbounded
costs.
- `gcloud organizations *` (Governance): Org-level changes affect security
posture for all users.
- `gcloud kms *` (Encryption): Risk of permanently locking data.
- `gcloud infra-manager deployments apply` (Destructive): Autonomous IaC
execution can destroy managed resources.
Execution Guidelines
- Dry Run (Mandatory): If the
--dry-runor--validate-onlyflag (or
equivalent) is listed in the command help output, ALWAYS include the flag in the proposed command or initial execution step. ALWAYS preview changes with --dry-run or --validate-only prior to actual execution.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files. Certified 14 Nov 2026.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/cloud/gcloud/SKILL.md
Popularity
- Repository stars
- 15,376
- Repository forks
- 1,206
- 7-day trend score
- 48
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/google/skills/gcloud)