Skip to main content
BuildOfficialCertifiedReviewed Jul 21, 2026

gcloud

v1.0.8New

Install this skill

No account required. Pick your tool, then copy.

Run in your terminal. It detects your AI tool.

npx @skills-hub-ai/cli install google-cloud-skills-gcloud

What this does: 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.

Or get the file:
Browse all CLI commands →
Manual setup by platform

Claude Code

~/.claude/skills/google-cloud-skills-gcloud/SKILL.md

Setup guide →

Signing

SignedSLSA L2
Signed by
skills-hub.ai distributor
Method
Distributor-signed by skills-hub.aiSigned with the skills-hub.ai Ed25519 distributor key over this exact slug, version and content. Check it with `npx @skills-hub-ai/cli verify`.
Key
skills-hub-ed25519-2026-11
Signed
0Save

Instructions

gcloud CLI Skill for AI Agents

[!CAUTION]

MANDATORY PRE-CONDITION: EXPLICIT LEAF-LEVEL SYNTAX VALIDATION

All pre-existing knowledge of gcloud commands, 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 gcloud task before validating leaf-level
syntax via gcloud help <command> (or including leaf-level help lookup as a
mandatory step in the plan).

Mandatory Action Rules:

  1. Direct Execution & Code Generation: ALWAYS invoke gcloud help <leaf_command> (e.g. gcloud help compute instances create or gcloud help sql instances create) before proposing or executing the final
    command syntax, UNLESS the user prompt already provides gcloud help
    output, states to assume command syntax is already validated, or instructs
    not to execute any commands. When instructed not to execute any commands,
    NEVER invoke run_command (not even for gcloud help or directory
    listing commands like ls); read bundled reference files
    (references/cli-usage.md, references/mcp-usage.md, and
    references/attribution.md) directly with read_file.

  2. 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.

  3. 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.

  4. 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.

  5. User Flag & Project Preservation: When proposing intermediate command
    steps, 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 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-run or --validate-only
      flag is supported)
    • Step 3: Dry-Run Command Proposal (If --dry-run or
      --validate-only is supported, there MUST be a --dry-run or
      --validate-only invocation 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 gcloud commands 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=N to cap the number of resources returned.

  • Filtering: Use --filter to 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:

    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 gcloud command 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 list command 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 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 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-run or --validate-only flag (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.

  • Long Running Operations: For commands that support it, the --async
    flag is highly recommended for long-running operations to avoid blocking the
    agentic flow. Note that not every command has an --async flag. For
    commands that return an operation ID (whether via --async or 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:

  1. Invoke Help: Call gcloud help <COMMAND> on the target leaf command
    prior to execution.
  2. Traverse Command Tree: Run help on command groups (e.g., gcloud help compute or gcloud help) to discover available subgroups and commands if
    the exact command is unknown.
  3. Discover Schema: Run gcloud <GROUP> <RESOURCE> list --limit=1 --format=json to inspect JSON keys before constructing filters or
    projections. DO NOT execute unconstrained list commands without scoping
    flags (e.g., --limit=1) to prevent context window exhaustion.
  4. Enforce Data Reduction: Include data reduction flags (--limit,
    --filter, --format) on all command executions.

Quick Reference / Cheat Sheet

TaskCommand Template
Discover Schemagcloud <GROUP> <RESOURCE> list --limit=1 --format=json
Filtered Listgcloud <GROUP> <RESOURCE> list --filter="status:RUNNING"
Specific Columnsgcloud <GROUP> <RESOURCE> list --format="json(name, id)"
Learn Filtersgcloud topic filters
Learn Formatsgcloud topic formats
Learn Projectionsgcloud topic projections
Asynchronous Opgcloud <COMMAND> --async
Check Operationgcloud <GROUP> operations describe <OPERATION_ID>
Common commandsgcloud cheat-sheet
List Regions (GCE)gcloud compute regions list --project=<PROJECT_ID>
List Zones (GCE)gcloud compute zones list --project=<PROJECT_ID>
List Locationsgcloud <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 gcloud CLI, REST
    API, and MCP requests.

This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Reviews (0)

Browse all →
gke-manifest-generationGenerates and updates secure, production-ready Kubernetes YAML manifests optimized for GKE Autopilot and GKE Standard clusters. Use when creating or modifying GKE deployment manifests, configuring container security contexts, setting CPU/memory resource limits, defining readiness/liveness/startup probes, mounting secrets and volumes, configuring GKE Gateway API routes, targeting Spot VMs, or deploying AI model inference workloads (vLLM, TGI, Gemma). Don't use for live cluster operations, pod troubleshooting (use gke-workload-troubleshooting), or cluster infrastructure provisioning (use gke-cluster-creation).2 installsgoogle-analytics-admin-api-basicsManages Google Analytics account and property settings, enables the Analytics Admin API via the Cloud CLI, lists accounts and properties, and manages data streams, custom dimensions, conversion events, and integrations. Use when you need to programmatically configure Google Analytics accounts, provision properties, manage data retention, configure Measurement Protocol secrets, or manage Firebase and Google Ads links.1 installsgoogle-cloud-waf-cost-optimizationEvaluates Google Cloud workloads for cost efficiency and FinOps alignment using the Google Cloud Well-Architected Framework Cost Optimization pillar. Use when the user asks to analyze Google Cloud spend, reduce cloud bills, rightsize resources (for example, Compute, GKE, Storage, Databases), evaluate discount options (for example, CUDs, SUDs, Spot VMs), or eliminate idle capacity. Do not use for standalone product pricing lookups or non-cost architecture design.1 installsassured-workloads-basicsProvisions, inspects, updates, and deletes Google Cloud Assured Workloads V1 compliant folders, CMEK settings, Sovereign Controls by Partners, and service usage restrictions. Use when creating, listing, describing, updating, or deleting an Assured Workloads workload for any compliance regime or data boundary (FedRAMP, DoD IL2/IL4/IL5, ITAR, CJIS, Healthcare, Sovereign Controls by Partners, or Regional Data Boundaries). Don't use for brownfield assessments or custom frameworks (use assuredworkloads-environment-assessor or assuredworkloads-frameworks-*), or non-compliant folders.1 installsgoogle-cloud-solution-rag-enterprise-search-gke-sqldbDiscovers requirements, and generates architectural, design, and deployment guidance for a retrieval-augmented generation (RAG)-capable enterprise search system in Google Cloud. Use when users need a vector-enabled SQL database as the store and index for the embedding vectors, an open model and open-source inferencing framework, and Kubernetes containers to host all the application components. DON'T use this skill for fully-managed RAG, or SaaS search services, or when a non-SQL vector database is required.1 installsfirebase-basicsProvides foundational Firebase CLI setup, CLI installation, version checks (`firebase-tools@latest --version`), CLI login (including --no-localhost), project creation, project selection (`firebase use`), and app config file downloads (`google-services.json`, `GoogleService-Info.plist`). Use ONLY for CLI login, project creation/switching, or downloading app config files. Don't use for Firebase Hosting deploy, Firestore, Auth, App Hosting, Data Connect, Crashlytics, or Remote Config.1 installs

More from Google Cloud Skills

View source →
google-ads-api-mcp-setupGuides developers through downloading, configuring, and installing the official open-source Google Ads MCP Server. Use this skill when a user wants to connect their AI assistant (such as Gemini, Claude Code, or Cursor) to their Google Ads account to query campaigns or retrieve reporting metrics using natural language.4 installsspanner-basicsAssists in provisioning instances and databases, designing performant schemas, and querying data in Cloud Spanner on Google Cloud. Use when designing primary keys, writing SQL queries or client library code, or diagnosing performance issues.4 installsgke-workload-securityAudits, configures, and hardens workload-level security controls for Google Kubernetes Engine (GKE) applications and namespaces. Covers running security audits (`audit_cluster.sh`), enforcing Network Policies (default-deny and Dataplane V2 logging), isolating high-risk pods inside GKE Sandbox (`gVisor`), enforcing Pod Security Standards (`restricted` labeling) and pod securityContext, and mounting Secret Manager secrets via CSI (`SecretProviderClass`). Use when auditing workload security posture, isolating namespaces, applying pod security standards, or configuring network policies and secret volume mounts. Don't use for Workload Identity (use gke-workload-identity), cluster-wide control plane security, RBAC hardening, Binary Authorization, Shielded Nodes, or enabling platform-level GKE add-ons (use gke-platform-security instead).3 installsgke-upgradesPlans, executes, and validates Google Kubernetes Engine (GKE) cluster upgrades and maintenance operations for both Standard and Autopilot clusters. Produces upgrade plans, pre/post-upgrade checklists, maintenance runbooks with gcloud commands, release channel strategy, and troubleshooting guides. Handles node pool upgrade strategies (surge, blue-green), version compatibility, PDB management, and workload-specific concerns (stateful, GPU, operators). Use this skill whenever the user mentions GKE upgrades, Kubernetes version bumps, node pool maintenance, GKE patching, cluster version management, release channel selection, maintenance windows, surge upgrades, stuck upgrades, or any GKE lifecycle management task — even casual mentions like "we need to upgrade our clusters" or "plan our next GKE maintenance" or "our upgrade is stuck." Don't use for GKE cluster creation, application onboarding, general networking/routing setup, or security policy configurations (use gke-basics or relevant GK2 installsgoogle-cloud-recipe-networking-observabilityInvestigates Google Cloud networking issues by analyzing logs, metrics, and diagnostics. Use when investigating VPC Flow Logs, NAT, firewall, or threat logs, querying latency and throughput metrics, or running Connectivity Tests for path diagnostics.2 installsmigrate-to-rustClones, analyzes, plans, and migrates legacy codebases (C++, Fortran, Java, Python, C, Shell) from a GitHub URL or local directory to a modern, high-performance, deterministic, 100% Safe Rust architecture, tracking live telemetry across every task bucket, test failure/fix cycle, and Profile-Guided Optimization (PGO) stage, and producing a first-person AI storytelling report and interactive HTML infographic. Use when migrating a GitHub repository or local codebase to Rust, porting legacy C++, Fortran, Python, or Java workloads to memory-safe Rust, designing Struct-of-Arrays (SoA) or SIMD Rust architectures, or optimizing Rust ports with LLVM PGO. Don't use for unrelated non-Rust refactoring or single-line syntax questions.2 installs

More Build skills

Browse category →
senior-frontendBuild and review React, Next.js, TypeScript or Tailwind frontends: components, scaffolding, performance and bundle size. Use whenever the user wants a new component or app, a page feels slow, the bundle is too big, or asks for a frontend code review.653 installsui-design-systemUse when building a design system: tokens, component docs, responsive scales or developer handoff. Generates tokens with design_token_generator.py.553 installsfrontend-designGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.365 installssenior-backendBuild and fix backend services: REST or GraphQL APIs, auth, microservices, PostgreSQL queries, migrations and load tests. Use whenever the user's API is slow or broken, needs login or auth added, a schema change, or a new endpoint or service scaffolded.266 installsself-improving-agentCurate what the agent has learned into durable project knowledge. Reviews Claude Code auto-memory (MEMORY.md and its topic files) for learnings worth keeping, promotes proven ones into CLAUDE.md or .claude/rules/, records a correction as a lesson that persists across sessions, prunes stale or duplicate entries, and turns a recurring fix into a reusable skill. Use whenever the user asks what you have learned or saved about the project, which memories should become permanent rules, to remember a lesson or stop repeating a mistake, or to clean up, audit or check memory health.185 installsusing-superpowersUse when starting any conversation - establishes how to find and use skills, requiring skill invocation before ANY response including clarifying questions149 installs

Frequently asked questions about gcloud

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. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.

How do I install the gcloud skill?

Run `npx @skills-hub-ai/cli install google-cloud-skills-gcloud` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/google-cloud-skills-gcloud/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.

Which AI tools does gcloud work with?

gcloud runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.

Is the gcloud skill free?

Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.

How do I use gcloud after installing it?

In Claude Code, type `/google-cloud-skills-gcloud` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.

Can I share the gcloud skill with my team?

Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.