gcloud CLI Skill
Provide accurate, up-to-date guidance for using the gcloud command-line tool to manage Google Cloud Platform resources and services.
General gcloud Patterns
All gcloud commands follow: gcloud [GROUP] [SUBGROUP] [COMMAND] [FLAGS]
Common global flags available on every command:
--project PROJECT_ID — override active project
--account ACCOUNT — override active account
--format FORMAT — output as json, yaml, csv, table, text, value, etc.
--quiet / -q — disable interactive prompts
--impersonate-service-account SA_EMAIL — run as a service account without a key file
--verbosity LEVEL — debug, info, warning, error, critical, none
--configuration CONFIG — use a named configuration
Configurations
Manage multiple project/account/region profiles:
gcloud config configurations create NAME
gcloud config configurations activate NAME
gcloud config set project PROJECT_ID
gcloud config set compute/region REGION
gcloud config set compute/zone ZONE
gcloud config list
Top-Level Command Groups
| Group |
Purpose |
Reference |
auth |
Authentication & credentials |
references/auth.md |
config |
CLI configuration & named configurations |
references/config.md |
projects |
Manage GCP projects |
references/projects.md |
iam |
IAM roles, policies, service accounts |
references/iam.md |
compute |
VMs, disks, networks, firewalls, load balancers |
references/compute.md |
container |
GKE clusters and node pools |
references/container.md |
functions |
Cloud Functions (deploy, call, logs) |
references/functions-and-run.md |
run |
Cloud Run services and jobs |
references/functions-and-run.md |
app |
App Engine applications |
references/app.md |
builds |
Cloud Build triggers and submissions |
references/builds.md |
storage |
Cloud Storage buckets and objects (also gsutil) |
references/storage.md |
firestore |
Firestore databases and indexes |
references/firestore.md |
pubsub |
Pub/Sub topics and subscriptions |
references/pubsub.md |
sql |
Cloud SQL instances |
references/sql.md |
secrets |
Secret Manager |
references/secrets.md |
logging |
Cloud Logging read/write |
references/logging.md |
monitoring |
Cloud Monitoring dashboards and alerts |
references/monitoring.md |
artifacts |
Artifact Registry repos |
references/artifacts.md |
dns |
Cloud DNS zones and records |
references/dns.md |
kms |
Cloud KMS keys |
references/kms.md |
emulators |
Local dev emulators |
references/emulators.md |
services |
Enable/disable APIs (gcloud services enable ...) |
references/services.md |
components |
Manage SDK components (gcloud components install ...) |
references/components.md |
Bundled sub-tools: bq (BigQuery), gsutil (Cloud Storage), kubectl (Kubernetes).
Common Workflows
Deploy a Cloud Function (Gen2)
gcloud functions deploy FUNCTION_NAME \
--gen2 --runtime python312 --trigger-http \
--allow-unauthenticated --region REGION \
--source . --entry-point main
Deploy to Cloud Run
gcloud run deploy SERVICE_NAME \
--image IMAGE_URL --region REGION \
--allow-unauthenticated --set-env-vars KEY=VALUE
Enable an API
gcloud services enable firestore.googleapis.com
gcloud services list --enabled
Create a service account and grant roles
gcloud iam service-accounts create SA_NAME --display-name "Description"
gcloud projects add-iam-policy-binding PROJECT_ID \
--member="serviceAccount:SA_NAME@PROJECT_ID.iam.gserviceaccount.com" \
--role="roles/ROLE"
Troubleshooting
gcloud info — active config, account, project, SDK paths, Python version
gcloud auth list — all credentialed accounts and which is active
gcloud config list — active configuration values
- If ADC issues, check
GOOGLE_APPLICATION_CREDENTIALS env var and run gcloud auth application-default login
--log-http on any command to see raw HTTP requests/responses
--verbosity debug for maximum diagnostic output
1---2name: gcloud-cli3description: Comprehensive reference for the Google Cloud CLI (gcloud). Use this skill whenever working with GCP infrastructure, services, or tooling via the command line. Triggers include: any mention of "gcloud", "Google Cloud", "GCP", Cloud Functions, Cloud Run, Compute Engine, IAM, service accounts, authentication with Google Cloud, ADC (Application Default Credentials), GCP emulators (Firestore, Pub/Sub, Bigtable, Datastore, Spanner), or any task requiring interaction with Google Cloud Platform from a terminal. Also use when deploying to GCP, managing GCP projects/configs, or debugging GCP authentication issues.4---56# gcloud CLI Skill78Provide accurate, up-to-date guidance for using the `gcloud` command-line tool to manage Google Cloud Platform resources and services.910## General gcloud Patterns1112All gcloud commands follow: `gcloud [GROUP] [SUBGROUP] [COMMAND] [FLAGS]`1314Common global flags available on every command:15- `--project PROJECT_ID` — override active project16- `--account ACCOUNT` — override active account17- `--format FORMAT` — output as json, yaml, csv, table, text, value, etc.18- `--quiet` / `-q` — disable interactive prompts19- `--impersonate-service-account SA_EMAIL` — run as a service account without a key file20- `--verbosity LEVEL` — debug, info, warning, error, critical, none21- `--configuration CONFIG` — use a named configuration2223### Configurations2425Manage multiple project/account/region profiles:26```27gcloud config configurations create NAME28gcloud config configurations activate NAME29gcloud config set project PROJECT_ID30gcloud config set compute/region REGION31gcloud config set compute/zone ZONE32gcloud config list33```3435## Top-Level Command Groups3637| Group | Purpose | Reference |38|-------|---------|-----------|39| `auth` | Authentication & credentials | `references/auth.md` |40| `config` | CLI configuration & named configurations | `references/config.md` |41| `projects` | Manage GCP projects | `references/projects.md` |42| `iam` | IAM roles, policies, service accounts | `references/iam.md` |43| `compute` | VMs, disks, networks, firewalls, load balancers | `references/compute.md` |44| `container` | GKE clusters and node pools | `references/container.md` |45| `functions` | Cloud Functions (deploy, call, logs) | `references/functions-and-run.md` |46| `run` | Cloud Run services and jobs | `references/functions-and-run.md` |47| `app` | App Engine applications | `references/app.md` |48| `builds` | Cloud Build triggers and submissions | `references/builds.md` |49| `storage` | Cloud Storage buckets and objects (also `gsutil`) | `references/storage.md` |50| `firestore` | Firestore databases and indexes | `references/firestore.md` |51| `pubsub` | Pub/Sub topics and subscriptions | `references/pubsub.md` |52| `sql` | Cloud SQL instances | `references/sql.md` |53| `secrets` | Secret Manager | `references/secrets.md` |54| `logging` | Cloud Logging read/write | `references/logging.md` |55| `monitoring` | Cloud Monitoring dashboards and alerts | `references/monitoring.md` |56| `artifacts` | Artifact Registry repos | `references/artifacts.md` |57| `dns` | Cloud DNS zones and records | `references/dns.md` |58| `kms` | Cloud KMS keys | `references/kms.md` |59| `emulators` | Local dev emulators | `references/emulators.md` |60| `services` | Enable/disable APIs (`gcloud services enable ...`) | `references/services.md` |61| `components` | Manage SDK components (`gcloud components install ...`) | `references/components.md` |6263Bundled sub-tools: `bq` (BigQuery), `gsutil` (Cloud Storage), `kubectl` (Kubernetes).6465## Common Workflows6667### Deploy a Cloud Function (Gen2)68```bash69gcloud functions deploy FUNCTION_NAME \70 --gen2 --runtime python312 --trigger-http \71 --allow-unauthenticated --region REGION \72 --source . --entry-point main73```7475### Deploy to Cloud Run76```bash77gcloud run deploy SERVICE_NAME \78 --image IMAGE_URL --region REGION \79 --allow-unauthenticated --set-env-vars KEY=VALUE80```8182### Enable an API83```bash84gcloud services enable firestore.googleapis.com85gcloud services list --enabled86```8788### Create a service account and grant roles89```bash90gcloud iam service-accounts create SA_NAME --display-name "Description"91gcloud projects add-iam-policy-binding PROJECT_ID \92 --member="serviceAccount:SA_NAME@PROJECT_ID.iam.gserviceaccount.com" \93 --role="roles/ROLE"94```9596## Troubleshooting9798- `gcloud info` — active config, account, project, SDK paths, Python version99- `gcloud auth list` — all credentialed accounts and which is active100- `gcloud config list` — active configuration values101- If ADC issues, check `GOOGLE_APPLICATION_CREDENTIALS` env var and run `gcloud auth application-default login`102- `--log-http` on any command to see raw HTTP requests/responses103- `--verbosity debug` for maximum diagnostic output