gcloud
Interacts with Google Cloud services using the gcloud CLI safely and efficiently. Covers command validation, data reduction, safety guardrails with a denylist, and workflows for discovery and investigation. You MUST read this skill before invoking any gcloud command. Use when managing cloud resources, querying configurations, or troubleshooting issues via gcloud. Don't use when writing or debugging Google Cloud client library code or raw REST/gRPC API interactions.
Security Assessment
About gcloud
Guidelines and guardrails for AI agents interacting with Google Cloud through the gcloud CLI safely and efficiently. The skill is meant to be read before invoking any gcloud command and applies when managing cloud resources, querying configurations, or troubleshooting via gcloud; it is explicitly not for writing or debugging Google Cloud client-library code or raw REST or gRPC interactions. Its central concern is avoiding hallucinated commands, flags, flag values, and positional-argument syntax while preventing destructive actions and minimizing context-window usage.
It opens with installation pointers and several authorization flows, including interactive and headless user login with the no-browser flag, Application Default Credentials, service-account key files, and service-account impersonation, framed around separation of privilege and least privilege. The core principles require explicit, non-transitive command validation by running gcloud help for the exact leaf command before execution. To reduce data, it recommends projection with format json selecting only needed fields, a limit flag, server-side filtering using colon pattern matching without quoting the right side, and schema discovery by listing a single item first. Execution constraints insist on a single command at a time with no chaining, no shell operators such as substitution, pipes, or redirection, and enforced non-interactive mode via the quiet flag.
Project and location scoping is treated as critical: always pass an explicit project flag rather than relying on active defaults, always supply explicit location flags like region, zone, or location to avoid interactive prompts, and run discovery commands such as regions list, zones list, or a service locations list when the location is unknown. A safety section stresses that destructive actions like delete, update, and remove must be explicitly authorized by the user and never run autonomously outside a pre-approved workflow, and it begins a denylist of prohibited operations such as IAM policy, role, or binding modifications that require human-in-the-loop authorization.
FAQ
When should I read this skill?
It must be read before invoking any gcloud command, and it applies to managing resources, querying configurations, or troubleshooting via the gcloud CLI.
How am I supposed to confirm a command's exact syntax?
Run gcloud help for the exact leaf command you intend to run and verify the flags, flag values, and positional syntax, since validation is not transitive from parent groups.
Can I use pipes or command chaining with gcloud here?
No. The skill requires executing a single command at a time with no chaining, and forbids command substitution, pipes, and redirection; non-interactive mode is enforced with the quiet flag.
How do I keep gcloud output from filling the context window?
Use projection with format json to select only needed fields, cap results with a limit flag, narrow server-side with a filter, and discover a resource's schema by listing a single item first.
Are destructive commands allowed without asking the user?
No. Delete, update, and remove actions must be explicitly authorized by the user, and operations like any IAM policy, role, or binding modification are on a denylist requiring human-in-the-loop authorization.
Install gcloud
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
google/skills