distributions/codex/skills/gcp-resource-optimizer/SKILL.md
Optimize Google Cloud Platform resource allocation and manage cloud credits efficiently. Use when planning GCP deployments, analyzing cloud spend, maximizing value from expiring credits, right-sizing instances, or designing cost-effective architectures. Triggers on GCP cost optimization, credit management, resource allocation planning, or cloud budget concerns.
npx skillsauth add organvm-iv-taxis/a-i--skills gcp-resource-optimizerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Maximize value from GCP resources and credits through strategic allocation.
When managing expiring credits:
gcloud billing accounts describe ACCOUNT_IDLasting value (prioritize):
Ephemeral (use strategically):
Right-sizing instances:
# Check recommendations
gcloud recommender recommendations list \
--project=PROJECT_ID \
--location=ZONE \
--recommender=google.compute.instance.MachineTypeRecommender
Cost-effective machine types: | Need | Recommended | Why | |------|-------------|-----| | General workload | e2-medium | Best price/performance | | Memory-intensive | n2-highmem | Better RAM ratio | | CPU burst | e2-micro/small | Burstable, cheap | | ML training | n1 + GPU | Required for accelerators | | Spot-tolerant | Spot VMs | 60-91% discount |
Preemptible/Spot VMs:
Optimizing Cloud Run:
# Minimize cold starts and costs
spec:
template:
spec:
containerConcurrency: 80 # Maximize requests per instance
timeoutSeconds: 300
metadata:
annotations:
autoscaling.knative.dev/minScale: '0' # Scale to zero
autoscaling.knative.dev/maxScale: '10' # Cap costs
run.googleapis.com/cpu-throttling: 'true' # CPU only when processing
Storage class optimization: | Class | Use Case | Cost/GB/mo | |-------|----------|------------| | Standard | Frequent access | ~$0.020 | | Nearline | Monthly access | ~$0.010 | | Coldline | Quarterly access | ~$0.004 | | Archive | Yearly access | ~$0.0012 |
Lifecycle rules:
{
"lifecycle": {
"rule": [
{
"action": {"type": "SetStorageClass", "storageClass": "NEARLINE"},
"condition": {"age": 30}
},
{
"action": {"type": "SetStorageClass", "storageClass": "COLDLINE"},
"condition": {"age": 90}
},
{
"action": {"type": "Delete"},
"condition": {"age": 365}
}
]
}
}
Cost control:
-- Set maximum bytes billed
#standardSQL
-- @maximumBytesBilled 10000000000
SELECT * FROM dataset.table
Partitioning for cost reduction:
CREATE TABLE dataset.table
PARTITION BY DATE(timestamp_column)
CLUSTER BY user_id
AS SELECT * FROM source_table
Set up budget alerts:
gcloud billing budgets create \
--billing-account=BILLING_ACCOUNT_ID \
--display-name="Monthly Budget" \
--budget-amount=100USD \
--threshold-rule=percent=50 \
--threshold-rule=percent=90 \
--threshold-rule=percent=100
# Unused disks
gcloud compute disks list --filter="NOT users:*"
# Unused IPs
gcloud compute addresses list --filter="status=RESERVED"
# Idle VMs (by CPU)
gcloud monitoring time-series list \
--filter='metric.type="compute.googleapis.com/instance/cpu/utilization"' \
--interval="start=2024-01-01T00:00:00Z"
#!/bin/bash
# cleanup_unused.sh - Review before running!
# List (don't delete) unused resources
echo "=== Unused Disks ==="
gcloud compute disks list --filter="NOT users:*" --format="table(name,zone,sizeGb)"
echo "=== Reserved IPs ==="
gcloud compute addresses list --filter="status=RESERVED" --format="table(name,region,address)"
echo "=== Snapshots older than 30 days ==="
gcloud compute snapshots list --filter="creationTimestamp<$(date -d '30 days ago' -Iseconds)" --format="table(name,diskSizeGb,creationTimestamp)"
Request → Cloud Run → Firestore → Done
(scales to zero) (pay per op)
vs.
Request → GKE → Cloud SQL → Done
(always running) (always running)
Pub/Sub → Cloud Functions → BigQuery (batch load)
(cheaper than streaming)
Dev environment:
Prod environment:
# Enable billing export to BigQuery
gcloud beta billing accounts describe ACCOUNT_ID
# Query costs
#standardSQL
SELECT
service.description,
SUM(cost) as total_cost
FROM `project.dataset.gcp_billing_export_v1_*`
WHERE _PARTITIONTIME >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 30 DAY)
GROUP BY 1
ORDER BY 2 DESC
references/pricing-cheatsheet.md - Quick pricing referencereferences/cost-queries.md - BigQuery cost analysis queriesdevelopment
Dry-run audit + targeted cleanup for shell command history. Currently wraps atuin (stats today, prune, dedup with dated preview artifacts); extensible to zsh/bash/mcfly backends. Always previews before applying — apply commands are echoed for the human to run, never auto-executed. Triggers on "/shell-history-hygiene", "audit atuin", "audit shell history", "clean shell history", "atuin prune", "atuin dedup", "shell history hygiene", "history cleanup". Replaces ad-hoc one-liners (e.g. `... | tee cmd > file.txt` which wrote two files, swallowed dedup output, and left a junk `cmd` file).
tools
Guided Cowork setup — install role-matched plugins, connect your tools, try a skill.
development
Manage AI agent session lifecycles with structured phases (FRAME, SHAPE, BUILD, PROVE), context preservation across sessions, handoff protocols, and session metadata tracking. Triggers on session management, agent lifecycle, or multi-session workflow requests.
tools
Parse a session transcript into a structured Session Governance Index — an annotated bibliography of every file modified and commit made, internal-energy accounting (tool uses, estimated tokens), shipped-vs-tasked atom tally, and classification of missing items as Gaps or Vacuums. Triggers on "visibility-schema-substrate-sweep", "session cascade audit", "session governance audit", or any request to summarize what a session actually produced versus what it was asked to produce.