
gcloud
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.
- Installs
- 11.2K
- Last 24h
- +122
- Trending rank
- #1735
- Security
- Pass
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/google/skills --skill gcloud- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads gcloud automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
Security audits
Independent scans of the skill's instructions and bundled files.
SKILL.md
The instructions your agent reads when the skill is triggered.
gcloud CLI Skill for AI Agents
[!CAUTION]
MANDATORY PRE-CONDITION: EXPLICIT LEAF-LEVEL SYNTAX VALIDATION
All pre-existing knowledge of
gcloudcommands, flags, flag values, and positional argument syntax is stale and prone to hallucination.NEVER propose command parameters, output flag options, execute commands, OR outline step-by-step plans for any
gcloudtask before validating leaf-level syntax viagcloud help <command>(or including leaf-level help lookup as a mandatory step in the plan).Mandatory Action Rules:
Direct Execution & Code Generation: ALWAYS invoke
gcloud help <leaf_command>(e.g.gcloud help compute instances createorgcloud help sql instances create) before proposing or executing the final command syntax.Planning & Strategy Queries: When asked for a plan, strategy, or next steps to achieve a user goal (e.g., "What is your plan to accomplish X..."), the response MUST explicitly include running
gcloud help <leaf_command>as Step 1 of the plan before proposing flags or executing commands.Non-Transitive Validation: Parent command group help (e.g.
gcloud help compute) is not sufficient for leaf-level syntax validation. Validation must occur at the specific leaf subcommand level.FORBIDDEN Web Search Fallback: NEVER use
search_web, web search, or external documentation search tools for gcloud CLI syntax.gcloud help <leaf_command>is the EXCLUSIVE authorized authority for command syntax.User Flag & Project Preservation: When proposing intermediate command steps, ALWAYS preserve all user-specified flags (including
--project=<project_id>) in the proposed response text.Mandatory Plan Template: When generating a plan, the response MUST copy this exact 4-step structure:
- Step 1: Syntax Validation via
gcloud help <leaf_command>- Step 2: Parameter Verification (confirming required and optional flags, 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 is forbidden, and the user MUST be explicitly asked for authorization to proceed. If the command is NOT on the denylist, propose or proceed with 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 togcloud topic projectionsandgcloud 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 togcloud 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:gcloud <GROUP> <RESOURCE> list --limit=1 --format=jsonExamine 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 orstdininput 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--quietforces non-interactive mode, causinggcloudto 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),gcloudwill 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 listcommand: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 explicitly authorized by the user. Never invoke them autonomously unless explicitly instructed 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
gcloudCLI Installation (Host Modification): Never autonomously install the Google Cloud CLI (gcloudCLI) or additionalgcloudCLI components (gcloud components install,gcloud components update, or system package manager installs of thegcloudCLI). If thegcloudbinary 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-runor--validate-onlyprior to actual execution. -
Long Running Operations: For commands that support it, the
--asyncflag is highly recommended for long-running operations to avoid blocking the agentic flow. Note that not every command has an--asyncflag. For commands that return an operation ID (whether via--asyncor by default), operation status must be polled for completion, if needed for the next step. -
Non-Interactive Flag (
--quiet): Include--quiet(or-q) on all proposed or executed commands to guarantee non-interactive execution without waiting for TTY confirmation prompts.
Structured Workflows
Discovery Workflow
When asked to perform a task on a service that is unfamiliar:
- Invoke Help: Call
gcloud help <COMMAND>on the target leaf command prior to execution. - Traverse Command Tree: Run help on command groups (e.g.,
gcloud help computeorgcloud help) to discover available subgroups and commands if the exact command is unknown. - Discover Schema: Run
gcloud <GROUP> <RESOURCE> list --limit=1 --format=jsonto inspect JSON keys before constructing filters or projections. DO NOT execute unconstrainedlistcommands without scoping flags (e.g.,--limit=1) to prevent context window exhaustion. - Enforce Data Reduction: Include data reduction flags (
--limit,--filter,--format) on all command executions.
Quick Reference / Cheat Sheet
| Task | Command Template |
|---|---|
| Discover Schema | gcloud <GROUP> <RESOURCE> list --limit=1 --format=json |
| Filtered List | gcloud <GROUP> <RESOURCE> list --filter="status:RUNNING" |
| Specific Columns | gcloud <GROUP> <RESOURCE> list --format="json(name, id)" |
| Learn Filters | gcloud topic filters |
| Learn Formats | gcloud topic formats |
| Learn Projections | gcloud topic projections |
| Asynchronous Op | gcloud <COMMAND> --async |
| Check Operation | gcloud operations describe <OPERATION_ID> |
| Common commands | gcloud cheat-sheet |
| List Regions (GCE) | gcloud compute regions list --project=<PROJECT_ID> |
| List Zones (GCE) | gcloud compute zones list --project=<PROJECT_ID> |
| List Locations | gcloud <GROUP> locations list --project=<PROJECT_ID> |
Refer to the gcloud CLI Scripting Guide for guidance on using the gcloud CLI in automation.
Reference Directory
-
CLI Usage: Platform installation, authentication methods (interactive, headless, ADC, service account keys, impersonation), and local configuration management.
-
MCP Usage: Using the Cloud CLI remote MCP server (
run_gcloud_command), project parameter scoping, input files, and execution guidelines. -
Usage Attribution: Standardized usage attribution tags and multi-skill precedence rules for
gcloudCLI, REST API, and MCP requests.
FAQ
What does the gcloud skill do?
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.
How do I install gcloud?
Run npx skills add https://github.com/google/skills --skill gcloud in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/gcloud/ (personal) or .claude/skills/gcloud/ (project).
Which AI agents can use gcloud?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is gcloud safe to install?
Security partners have reviewed it: Gen Agent Trust Hub passed; Socket passed; Snyk passed. As with any skill, read the SKILL.md and bundled scripts before installing.
Who maintains gcloud?
It is published by google in google/skills. It has 11,237 recorded installs.
More from google/skills
bigquery-basics
google/skills
Manages datasets, tables, and jobs in BigQuery. Use when you need to interact with BigQuery, run SQL queries, manage BigQuery resources (datasets, tables, views), or perform basic data ingestion and analysis.
cloud-run-basics
google/skills
Manages Cloud Run services, jobs, and worker pools. Use when you need to deploy applications responding to HTTP requests (services), run event-triggered or scheduled tasks (jobs), or handle always-on pull-based background processing (worker pools).
gemini-api
google/skills
Use when the user asks about using Gemini in an enterprise environment or explicitly mentions Vertex AI, Google Cloud, or Agent Platform. Guides the usage of the Gemini API on Agent Platform with the Google Gen AI SDK. Covers SDK usage (Python, JS/TS, Go, Java, C), capabilities like multimodal inputs, tools, media generation, caching, batch prediction, and Live API.
google-cloud-recipe-auth
google/skills
Provides expert guidance on Identity and Access Management (IAM) and authenticating and authorizing to Google Cloud services and APIs, covering human users, service identities, Application Default Credentials (ADC), and best practices for secure access.
google-cloud-recipe-onboarding
google/skills
Guides a developer's first steps on Google Cloud, covering account creation, billing setup, project management, and deploying a first resource. Use when a new developer wants to initialize their first Google Cloud project, configure billing, and verify deployment. Don't use for enterprise organization setup (use Google Cloud Setup guided flow for that instead). Don't use for complex multi-project architectures.
cloud-sql-basics
google/skills
This file generates or explains Cloud SQL resources. Use this file when the user asks to create a Cloud SQL instance or database for MySQL, PostgreSQL, or SQL Server. Cloud SQL manages third-party MySQL, PostgreSQL, and SQL Server instances as resources in Cloud SQL. For example, when Cloud SQL creates an open-source MySQL instance, the resulting resource is a Cloud SQL for MySQL instance that Google Cloud manages. Cloud SQL handles backups, high availability, and secure connectivity for relational database workloads.
Popular devops & cloud skills
microsoft-foundry
microsoft/azure-skills
Build, deploy, evaluate, optimize, fine-tune, and manage Microsoft Foundry agents, models, and resources end to end. USE FOR: foundry, azd ai agent, azd provision/deploy, hosted agent scaffold/develop/run/deploy/troubleshoot, prompt agent create, managed harness agent create, GitHub Copilot harness agent, create agent, update agent, add tool to agent, invoke agent, agent insights, evaluate agent, batch eval, continuous eval, continuous monitoring, agent CI/CD, optimize prompt, improve prompt, optimize agent instructions, Agent Optimizer scaffold, dataset curation from traces, deploy model, model fine-tuning (SFT/DPO/RFT), Foundry project, RBAC, role assignment, permissions, quota, capacity, region, deployment failure, AI Services, create Foundry resource, knowledge index, customize deployment, onboard, availability, training-data, grader, distillation, large file upload. DO NOT USE FOR: Azure Functions, App Service, general Azure deploy (use azure-deploy), general Azure prep (use azure
azure-diagnostics
microsoft/azure-skills
Debug Azure production issues on Azure using AppLens, Azure Monitor, resource health, and safe triage. WHEN: debug production issues, troubleshoot app service, app service high CPU, app service deployment failure, troubleshoot container apps, container app 503 or target port mismatch, troubleshoot functions, function telemetry missing or stopped after a config/connection-string change, troubleshoot AKS, VM RDP, Linux SSH, VM black screen, can't connect to VM, reset VM password, NSG or firewall blocking, kubectl cannot connect, kube-system/CoreDNS failures, pod pending, crashloop, node not ready, upgrade failures, analyze logs, KQL, insights, image pull failures, cold start issues, health probe failures, resource health, root cause of errors, troubleshoot event hubs, troubleshoot service bus, messaging SDK error, AMQP connection failure, message lock lost, lock renewal during long-running processing, service bus dead letter.
azure-prepare
microsoft/azure-skills
Prepare azd-based Azure projects for deployment: generates azure.yaml, infrastructure (Bicep/Terraform), and Dockerfiles for the Azure Developer CLI (azd) workflow. USE ONLY when the user explicitly wants to use azd as the deployment tool, or the project already has an azure.yaml file. DO NOT USE FOR: non-azd deployments, Python App Service code-only deploys (use python-appservice-deploy), or cross-cloud migration (use azure-cloud-migrate). WHEN: prepare app for azd, create azure.yaml, set up azd infrastructure, modernize app for Azure with azd, deploy with azd, function app, timer trigger, service bus trigger, event-driven function, managed identity, generate Bicep, generate Terraform, create and deploy to Azure.
azure-ai
microsoft/azure-skills
Use for Azure AI: Search, Speech, OpenAI, Document Intelligence. Helps with search, vector/hybrid search, speech-to-text, text-to-speech, transcription, OCR. WHEN: AI Search, query search, vector search, hybrid search, semantic search, speech-to-text, text-to-speech, transcribe, OCR, convert text to speech.
azure-deploy
microsoft/azure-skills
Execute Azure deployments for ALREADY-PREPARED applications that have existing .azure/deployment-plan.md and infrastructure files. DO NOT use this skill when the user asks to CREATE a new application — use azure-prepare instead. This skill runs azd up, azd deploy, terraform apply, and az deployment commands with built-in error recovery. Requires .azure/deployment-plan.md from azure-prepare and validated status from azure-validate. WHEN: "run azd up", "run azd deploy", "execute deployment", "push to production", "push to cloud", "go live", "ship it", "bicep deploy", "terraform apply", "publish to Azure", "launch on Azure". DO NOT USE WHEN: "create and deploy", "build and deploy", "create a new app", "set up infrastructure", "create and deploy to Azure using Terraform" — use azure-prepare for these.
azure-validate
microsoft/azure-skills
Pre-deployment validation for Azure readiness. Run deep checks on configuration, infrastructure (Bicep or Terraform), RBAC role assignments, managed identity permissions, and prerequisites before deploying. WHEN: validate my app, check deployment readiness, run preflight checks, verify configuration, check if ready to deploy, validate azure.yaml, validate Bicep, test before deploying, troubleshoot deployment errors, validate Azure Functions, validate function app, validate serverless deployment, verify RBAC roles, check role assignments, review managed identity permissions, what-if analysis, validate Container Apps deployment.