Guide · Agent skill
How to use the GKE Cost Optimization agent skill
Updated · written with AI from the project's own documentation and checked against our catalogue data
The gke-cost-optimization skill is a packaged set of instructions that teaches an AI agent a structured playbook for reducing Google Kubernetes Engine (GKE) spending. It is aimed at platform and DevOps engineers who run GKE clusters, and at teams that share clusters between tenants. After reading this guide you will know how to install the skill, ask for cost work in plain language, and what the agent will and will not do with your cluster.
Quick start
- 1Download the skill ZIP. Download the gke-cost-optimization ZIP from this page.
- 2Install it. Unzip into ~/.claude/skills/ for personal use or into a project's .claude/skills/ folder, or upload the ZIP under Settings → Capabilities → Skills in the Claude apps.
- 3Check prerequisites. Confirm gcloud and kubectl work and that you have credentials for your GKE cluster. Install Vertical Pod Autoscaler if you want rightsizing recommendations.
- 4Ask for a specific outcome. Name the cluster, namespace or workload and the goal, such as rightsizing or setting a quota.
- 5Deploy VPA in recommendation mode. Apply the recommendation-mode VPA and wait at least 24 hours before reading results.
- 6Review before applying. Check the proposed P95-based changes, and confirm Spot VM candidates have at least two replicas and can tolerate preemption.
What is an agent skill and what does this one do?
An agent skill is a folder with a SKILL.md file that gives an AI agent specialised instructions for one task. When the skill is installed and your request matches its description, the agent reads those instructions and follows them.
Once installed, this skill lets the agent set resource quotas for shared clusters, recommend shrinking over-sized CPU and memory requests using Vertical Pod Autoscaler (VPA) recommendations, route fault-tolerant workloads to cheaper Spot VMs with clear preemption warnings, and advise on machine types and committed use discounts (CUDs). It also points to other skills for cost analysis (gke-cost-analysis) and compute class configuration (gke-compute-classes).
- Resource quotas for namespaces in multi-tenant clusters
- Rightsizing CPU and memory requests from VPA recommendations
- Spot VM selection for batch, dev and interruption-tolerant workloads
- Machine family guidance and commitment sizing
How do you install the skill?
You can install the skill in one of two ways. Download the ZIP from this page and unzip it into your personal skills folder, ~/.claude/skills/, or into a project's .claude/skills/ folder if you want it available only for that project.
If you use the Claude apps instead, open Settings, go to Capabilities, then Skills, and upload the ZIP there.
- Personal install: unzip into ~/.claude/skills/
- Project install: unzip into the project's .claude/skills/ folder
- Claude apps: Settings → Capabilities → Skills, then upload the ZIP
What do you need before you start?
The skill runs cluster commands through your own tools, so you need the gcloud CLI and kubectl installed and authenticated, plus a GKE cluster you have access credentials for. For rightsizing recommendations, Vertical Pod Autoscaler must be installed in the cluster. BigQuery and the bq CLI are needed only if you use the referenced gke-cost-analysis skill for billing breakdowns.
- gcloud CLI and kubectl
- A GKE cluster with access credentials
- Vertical Pod Autoscaler installed in the cluster (for rightsizing)
- BigQuery and bq CLI only for billing breakdowns via gke-cost-analysis
How do you trigger the skill with natural requests?
You do not need special syntax. Describe the outcome you want in ordinary words that match the skill's scope: optimizing GKE costs, rightsizing CPU or memory requests, setting namespace quotas, or choosing Spot VMs or machine types. The skill's description says it should not be used for general compute class provisioning or GPU selection, so ask for those through the gke-compute-classes skill instead.
Good requests name the cluster or workload and the goal. The agent will then follow the playbook, which starts with checking cost allocation and utilisation before recommending changes.
- "Review my GKE cluster prod-east for over-sized CPU requests in the payments namespace."
- "Set a resource quota for the team-a namespace on our shared cluster."
- "Can my nightly batch job in staging run on Spot VMs?"
- "How much should we commit to CUDs for our steady-state GKE baseline?"
What does a rightsizing run look like?
For rightsizing, the skill deploys a VPA in recommendation mode, which suggests values without evicting pods, and then waits at least 24 hours for data before reading the recommendation. The skill's rules compare requests with observed P95 usage: a CPU request above 5x P95 is reduced to P95 × 1.2 with high savings, and a memory request above 3x P95 is handled the same way. Pods with no resource requests get requests added so the scheduler can pack them.
Use the template below as a starting point. Replace the placeholder with your deployment name.
- Reduce CPU requests above 5x P95 to P95 × 1.2 (high savings)
- Reduce memory requests above 3x P95 to P95 × 1.2 (high savings)
- Reduce CPU requests above 2x P95 to P95 × 1.2 (medium savings)
- Add requests where none are set
kubectl apply -f assets/vpa-recommendation-mode.yaml
kubectl get vpa {deployment_name}-vpa -o jsonpath='{.status.recommendation}'When are Spot VMs safe, and how do you use them?
Spot VMs can cost 60-90% less but can be preempted at any time with a 30-second notice. The skill treats them as suitable only for fault-tolerant work: batch and data processing, dev and test environments, stateless web or API services with at least two replicas and PodDisruptionBudgets, and jobs with checkpointing. It marks stateful databases and single-replica critical services as unsuitable.
For GKE Autopilot workloads, the skill targets Spot capacity with a nodeSelector. For a Spot-first ComputeClass with On-Demand fallback, it hands off to the gke-compute-classes skill.
- Suitable: batch, dev/test, stateless replicas of 2 or more, checkpointed jobs
- Not suitable: stateful databases, single-replica critical services
nodeSelector:
cloud.google.com/gke-spot: "true"How should you size committed use discounts?
Committed use discounts suit steady-state workloads with predictable baseline usage. The skill describes resource-based CUDs (committed to a machine family and region) and flexible, spend-based CUDs, which are more portable but give smaller discounts. Discount figures in the skill are approximate and vary by machine family, so check current pricing before buying.
The main rule is to size the commitment to the floor of your actual usage over a representative period. A commitment bills for the full term whether or not you use it. Cover baseline with CUDs, variable load with autoscaling, and interruptible work with Spot VMs, and state that split explicitly.
- Baseline (always running): resource-based CUDs
- Variable or bursty: autoscaling on on-demand capacity
- Interruption-tolerant: Spot VMs, which need no commitment
What are the safety and network notes?
The skill does not run scripts, but it does use the network, because it calls Google Cloud through your gcloud and kubectl tools. Attribution rules require the agent to read the attribution file before any gcloud, REST or MCP command. For terminal commands it sets the CLOUDSDK_METRICS_REQUEST_ATTRIBUTION environment variable inline on each command and does not use gcloud config set, so the tag does not persist.
Commands that change a cluster, such as resizing a node pool to zero, should be reviewed before you let the agent run them. The skill notes that idle dev clusters can be scaled to zero with gcloud container clusters resize, or deleted and recreated through IaC.
- Uses network through gcloud and kubectl
- Does not run bundled scripts
- Review any resize or delete command before running it
gcloud container clusters resize {cluster_name} --node-pool {pool_name} --num-nodes 0What people use it for
- Finding over-sized CPU and memory requests in a shared production namespace using VPA recommendations
- Setting namespace resource quotas so one team cannot consume a multi-tenant cluster
- Moving a nightly batch job or dev environment to Spot VMs with a clear preemption plan
- Sizing a 1-year or 3-year commitment against the steady-state baseline of a cluster
- Scaling an idle dev cluster's node pool to zero to stop node costs while it is unused
Frequently asked questions
Is the GKE Cost Optimization agent skill free?
The skill is published under the Apache-2.0 licence in the google/skills repository. Google Cloud usage that the commands create is billed to your account as normal.
What do I need installed to use the gke-cost-optimization skill?
You need the gcloud CLI and kubectl, access credentials for a GKE cluster, and Vertical Pod Autoscaler in the cluster for rightsizing. BigQuery and the bq CLI are needed only for billing breakdowns through the gke-cost-analysis skill.
Where do I put the skill so Claude can use it?
Unzip it into ~/.claude/skills/ for personal use or into a project's .claude/skills/ folder. In the Claude apps, you can upload the ZIP under Settings → Capabilities → Skills.
Are Spot VMs safe for GKE workloads?
Spot VMs can be preempted at any time with a 30-second notice, so they suit only fault-tolerant work. The skill recommends them for batch, dev and stateless services with at least two replicas, and advises against stateful databases and single-replica critical services.
Does this skill work for non-GKE clusters?
No. The guidance is specific to Google Kubernetes Engine and Google Cloud commitments, so it does not cover general cloud cost questions on other platforms.
How does this compare to other cost tools?
This skill is a playbook for an agent covering quotas, rightsizing, Spot VMs, machine types and CUDs. It defers billing analysis to gke-cost-analysis and compute class setup to gke-compute-classes, so you use them together rather than replacing one with another.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Choose this skill if you run GKE clusters, especially shared multi-tenant ones, and want an agent to follow a consistent process for quotas, rightsizing and Spot VM decisions. Pick something else if your workloads are non-GKE, or if you need a purchase decision on commitments made without checking current pricing, since the skill itself warns that commitments bill for the full term.
Download the skill