gcp-resource-optimizer

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.

Best use case

gcp-resource-optimizer is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

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.

Teams using gcp-resource-optimizer should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/gcp-resource-optimizer/SKILL.md --create-dirs "https://raw.githubusercontent.com/organvm-iv-taxis/a-i--skills/main/distributions/claude/skills/gcp-resource-optimizer/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/gcp-resource-optimizer/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How gcp-resource-optimizer Compares

Feature / Agentgcp-resource-optimizerStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

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.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# GCP Resource Optimizer

Maximize value from GCP resources and credits through strategic allocation.

## Credit Burn Strategy

### Credit Expiration Planning

When managing expiring credits:

1. **Audit current usage**: `gcloud billing accounts describe ACCOUNT_ID`
2. **Calculate burn rate**: Total credits ÷ Days remaining = Required daily spend
3. **Identify high-value uses**: What creates lasting value vs. ephemeral compute?

### High-Value Credit Uses

**Lasting value (prioritize):**
- Training ML models (artifacts persist)
- Building container images
- Generating datasets
- Running batch processing on accumulated work

**Ephemeral (use strategically):**
- Compute instances (gone when shut down)
- Development environments
- Testing infrastructure

## Cost Optimization Patterns

### Compute Engine

**Right-sizing instances:**
```bash
# 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:**
- 60-91% cheaper than standard
- Can be terminated with 30s notice
- Good for: batch jobs, fault-tolerant workloads, development
- Bad for: production, stateful services

### Cloud Run

**Optimizing Cloud Run:**
```yaml
# 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
```

### Cloud Storage

**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:**
```json
{
  "lifecycle": {
    "rule": [
      {
        "action": {"type": "SetStorageClass", "storageClass": "NEARLINE"},
        "condition": {"age": 30}
      },
      {
        "action": {"type": "SetStorageClass", "storageClass": "COLDLINE"},
        "condition": {"age": 90}
      },
      {
        "action": {"type": "Delete"},
        "condition": {"age": 365}
      }
    ]
  }
}
```

### BigQuery

**Cost control:**
```sql
-- Set maximum bytes billed
#standardSQL
-- @maximumBytesBilled 10000000000
SELECT * FROM dataset.table
```

**Partitioning for cost reduction:**
```sql
CREATE TABLE dataset.table
PARTITION BY DATE(timestamp_column)
CLUSTER BY user_id
AS SELECT * FROM source_table
```

## Budget Alerts

**Set up budget alerts:**
```bash
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
```

## Resource Cleanup

### Find Unused Resources

```bash
# 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"
```

### Cleanup Script

```bash
#!/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)"
```

## Architecture Patterns for Cost

### Serverless-First
```
Request → Cloud Run → Firestore → Done
         (scales to zero)  (pay per op)

vs.

Request → GKE → Cloud SQL → Done
         (always running)  (always running)
```

### Batch Processing
```
Pub/Sub → Cloud Functions → BigQuery (batch load)
                           (cheaper than streaming)
```

### Development vs Production

**Dev environment:**
- Spot/preemptible VMs
- Smaller machine types
- Scale-to-zero services
- Shared resources

**Prod environment:**
- Committed use discounts (1-3 year)
- Right-sized dedicated instances
- Redundancy only where needed

## Monitoring Setup

```bash
# 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

- `references/pricing-cheatsheet.md` - Quick pricing reference
- `references/cost-queries.md` - BigQuery cost analysis queries

Related Skills

sql-query-optimizer

5
from organvm-iv-taxis/a-i--skills

Analyzes complex SQL queries to improve performance, suggesting indexing strategies, schema refactoring, and query rewrites.

taxonomy-modeling-design

5
from organvm-iv-taxis/a-i--skills

Phase 2 of the pentaphase structural-overhaul protocol. Classifies entities, standardizes attributes, establishes relationships, and designs the access framework. Use when the user invokes phase 2 of an overhaul, asks to "design the taxonomy" or "model the structure", or has completed a landscape audit and is ready to redesign. Consumes phase-1-landscape-report.md; produces phase-2-taxonomy-model.md.

systemic-ingestion-normalization

5
from organvm-iv-taxis/a-i--skills

Phase 4 of the pentaphase structural-overhaul protocol. Purges redundancies, enriches and aligns legacy entities to the new schema, executes phased ingestion into the new environment, and audits integrity. Use when the user invokes phase 4 of an overhaul, asks to "migrate the data" or "ingest into the new system", or has a configured environment ready to accept legacy entities. Consumes phase-3-environment-spec.md; produces phase-4-ingestion-report.md.

system-environment-configuration

5
from organvm-iv-taxis/a-i--skills

Phase 3 of the pentaphase structural-overhaul protocol. Translates the taxonomy model into objective technical criteria, evaluates candidate mechanisms or frameworks, instantiates the chosen architecture, and programs validation rules. Use when the user invokes phase 3 of an overhaul, asks to "select a system" or "configure the environment", or has a taxonomy model and is ready to choose technology. Consumes phase-2-taxonomy-model.md; produces phase-3-environment-spec.md.

pentaphase-orchestrator

5
from organvm-iv-taxis/a-i--skills

Threads the full five-phase structural-overhaul protocol — landscape discovery, taxonomy design, environment configuration, systemic ingestion, governance evolution — for any substrate the user names. Use when the user requests a structural overhaul, system redesign, or end-to-end restructuring of a documentation system, asset registry, code monorepo, knowledge base, or operational workflow; or when they explicitly invoke the pentaphase methodology. Coordinates handoffs between phase-skills and seats validation gates between phases.

landscape-discovery-audit

5
from organvm-iv-taxis/a-i--skills

Phase 1 of the pentaphase structural-overhaul protocol. Inventories assets, maps current flow, identifies friction, and defines value metrics for any substrate. Use when the user invokes phase 1 of an overhaul, requests a baseline audit, asks to "discover the landscape" of a system, or wants to understand current state before redesigning. Produces phase-1-landscape-report.md.

governance-evolution-protocol

5
from organvm-iv-taxis/a-i--skills

Phase 5 of the pentaphase structural-overhaul protocol. Codifies operational protocols, onboards the ecosystem of participants, programs behavior monitoring, and establishes an iteration cadence so the substrate evolves rather than calcifies. Use when the user invokes phase 5 of an overhaul, asks to "establish governance" or "lock in the protocols", or has completed ingestion and is ready to declare the substrate operational. Consumes phase-4-ingestion-report.md; produces phase-5-governance-charter.md, which closes the protocol.

dimension-surfacing

5
from organvm-iv-taxis/a-i--skills

Surfaces the parallel domain dimensions implicit in a dense or minimal prompt. Use when a user prompt is small on the surface but plainly implies multiple independent domains needing different expertise; when explicitly invoked by the coliseum-orchestrator skill as Phase 1; or when the user asks "what dimensions does this prompt encode" or "what axes does this break into." Produces a named dimension set where each dimension is independently executable and not a paraphrase of another.

coliseum-dispatch

5
from organvm-iv-taxis/a-i--skills

Dispatches a composed set of assignment envelopes to domain-expert subagents in parallel, in a single message with multiple Agent tool calls. Enforces the no-pingpong gate via the pingpong-detector agent before any dispatch fires. Use when invoked by the coliseum-orchestrator as Phase 3; when envelopes are already composed and the next step is parallel execution; or when the user asks to "fan out" or "dispatch in parallel." Produces a dispatch log capturing what was sent, when, and where returns land.

assignment-composition

5
from organvm-iv-taxis/a-i--skills

Wraps each surfaced dimension as a self-contained 9-section autonomous-work-assignment envelope — scope, context, success criteria, allowed tools, return format, handoff — all the recipient subagent needs to execute without coming back. Use when invoked by coliseum-orchestrator as Phase 2; when dimensions are named and the next step is to make each independently dispatchable; or when the user asks "compose this as an assignment." The no-pingpong gate validates each envelope before dispatch.

workspace-autopsy-governance

5
from organvm-iv-taxis/a-i--skills

Conducts a full automated autopsy of the current workspace directory to map files, identifies structural issues, proposes a restructuring plan (the signal), and establishes unified governance using templates. Use this skill when a user asks to map, restructure, reorganize, or apply new governance to an existing messy repository.

workshop-presentation-design

5
from organvm-iv-taxis/a-i--skills

Design engaging workshops, conference talks, and educational presentations. Covers learning objectives, activity design, slide craft, and facilitation techniques. Triggers on workshop design, presentation prep, talk structure, or training session requests.