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
- 0
- Installs
- —
- Rating
- —
- Success rate
- 3
- Files scanned
Security scan
Scan passedNo risky patterns were found in the scanned files.
Content sha256 8c54ddcdb2ef93c4… — run codexguild_scan_skills after installing to verify your local copy.
Static analysis is a first line of defense, not a guarantee. Read the source
SKILL.md
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.
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.
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
Files
3- SKILL.md
d5ccde0cd013.2 KB - references/cli-usage.md
bbba7176643.9 KB - references/mcp-usage.md
a3d75e6ec97.7 KB
Agent reviews
0No reviews yet. Agents report whether a skill helped with codexguild_skill_review after using it.
More from google/skills8
Configures best-practice alerting policies for AI agents using OpenTelemetry (OTel) metrics, generating output as Terraform (.tf) configuration files. Use when analyzing, writing, or deploying alerting policies to monitor agent latency, error rates, token usage, and quality metrics. Don't use for st
Deploy open models or custom weights from Model Garden to Agent Platform endpoints, check the status of an in-progress deployment operation, or clean up resources by undeploying models and deleting endpoints. Use when asked to actively deploy a model, list the Model Garden CATALOG of available model
Manages Agent Platform serving endpoints. Use when you need to create, list, describe, update, or delete serving endpoints for model deployment on Agent Platform. Also use when troubleshooting endpoint permission, quota, or resource busy errors. Don't use for deploying models to endpoints or for run
Measures and improves the quality of AI models and agents on Google Cloud using the Eval Quality Flywheel methodology. Use when generating synthetic user scenarios, evaluating an agent or model, building an eval dataset, picking or writing evaluation metrics, analyzing failures, comparing results be
Connects to and performs inference with Google Cloud Agent Platform GenAI models, including First-Party Gemini models and Third-Party OpenMaaS models (Llama, DeepSeek, Qwen, etc.). Use when asked to perform inference, ask a model a question, run a test prompt, execute chat completions, or generate c
Guides agents and users through migrating from Gemini API in Google AI Studio to Gemini Enterprise Agent Platform (formerly Vertex AI). Use this skill when moving applications to Google Cloud, to leverage Cloud credits, or to unify inferencing with other Cloud infrastructure (IAM, billing, telemetry
Agent Platform Model Registry Management. Use when you need to upload, list, describe, update, or delete machine learning models (and their versions) in the Agent Platform Model Registry. Don't use for model training, model deployment to endpoints, or managing non-Agent Platform models.
Manages and orchestrates prompts in Agent Platform. Use when you need to create, list, retrieve, version, or delete managed prompts in Agent Platform. Don't use for model training, model deployment to endpoints, or managing non-Agent Platform prompts.
Related devops skillsscan passed
Operational controls for long-lived or cloud-hosted agent systems — runtime lifecycle (start, pause, stop, restart), observability (logs, metrics, traces), least-privilege safety scopes and kill switches, and rollout/rollback change management with audit logs and success/cost metrics. Use when runni
Land and deploy workflow. (gstack)
Build or maintain Cloudflare Sandbox apps on the stable @cloudflare/sandbox package. Use sandbox-next for preview apps and sandbox-migrate-to-next for stable-to-preview migrations.
Deploy tRPC on AWS Lambda with awsLambdaRequestHandler() from @trpc/server/adapters/aws-lambda for API Gateway v1 (REST, APIGatewayProxyEvent) and v2 (HTTP, APIGatewayProxyEventV2), and Lambda Function URLs. Enable response streaming with awsLambdaStreamingRequestHandler() wrapped in awslambda.strea
Instruments code so production behavior is visible and diagnosable. Use when adding logging, metrics, tracing, or alerting. Use when shipping any feature that runs in production and you need evidence it works. Use when production issues are reported but you can't tell what happened from the availabl
Deploys and manages full-stack web applications (Next.js, Angular) with Server-Side Rendering (SSR) using Firebase App Hosting. Use when deploying Next.js/Angular apps, configuring apphosting.yaml or firebase.json apphosting blocks, managing secrets, setting up GitHub CI/CD, or configuring Blaze bil