agentleFS
camilooscargbaptistacamilooscargbaptista/cto-toolkit/cost-optimization/SKILL.md

cost-optimization

Skill9 starsChanged 8 months agoMITView on GitHub

**Cloud Cost Optimization & FinOps**: Helps analyze and reduce cloud infrastructure costs, optimize resource usage, implement FinOps practices, and find savings opportunities. Use whenever the user mentions 'cloud costs', 'AWS bill', 'cost optimization', 'FinOps', 'right-sizing', 'reserved instances', 'savings plans', 'cost allocation', 'budget', 'overspending', 'cloud waste', 'cost per request', 'unit economics', asks 'why is my AWS/GCP/Azure bill so high', or wants to reduce infrastructure spending without sacrificing performance.

24 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use incident-response, git-workflow and 2 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • AnthropicSkill

    incident-response

    Run an incident response workflow — triage, communicate, and write postmortem. Trigger with "we have an incident", "production is down", an alert that needs severity assessment, a status update mid-incident, or when writing a blameless postmortem after resolution.

    Also in 3 projects that use this

  • Microsoft AzureSkill

    git-workflow

    Squad branching model: dev-first workflow with insiders preview channel

    Also in 5 projects that use this

  • kongyo2Skill

    prompt-engineering

    Comprehensive prompt engineering framework for designing, optimizing, and iterating LLM prompts. This skill should be used when users request prompt creation, optimization, or improvement for any LLM task, or when users need help translating vague requirements into effective prompts through collaborative dialogue and iterative refinement.

    Also in 3 projects that use this

  • MicrosoftSkill

    api-design

    Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

11 rules. 0 are common, 11 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 20 edited versions we read keep these.

  • 11

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When analyzing cloud costs, gather:

    line 31
  2. Distinctive:

    Every resource should have at minimum:

    line 42
  3. Distinctive:

    Use smaller instance types for non-prod

    line 78
  4. Distinctive:

    Consider spot instances for dev workloads

    line 79
  5. Distinctive:

    Delete old log data or move to cold storage

    line 86
  6. Distinctive:

    If avg utilization <40%, downsize one tier

    line 92
  7. Distinctive:

    If avg utilization <20%, downsize two tiers or consider serverless

    line 93
  8. Distinctive:

    Use AWS Compute Optimizer or similar tools for recommendations

    line 94
  9. Distinctive:

    Consider Aurora Serverless v2 for variable workloads

    line 98
  10. Distinctive:

    Read replicas: do you actually need them, or is caching sufficient?

    line 99
  11. Distinctive:

    Consider read replicas vs caching — often caching is cheaper and faster

    line 137

“Common” is measured: kept by at least 6 in 10 of the 20 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Cloud Cost Optimization & FinOps

You are a FinOps practitioner helping engineering teams understand, optimize, and govern cloud spending. The goal is not to minimize cost at all costs — it's to maximize value per dollar spent.

The FinOps Framework

FinOps operates in three phases:

Inform → Understand where money goes Optimize → Take action to reduce waste Operate → Continuous governance and culture

Phase 1: Inform — Cost Visibility

Cost Analysis Checklist

When analyzing cloud costs, gather:

  1. Total monthly spend and trend (last 3-6 months)
  2. Top 10 cost drivers by service (EC2, RDS, Lambda, S3, etc.)
  3. Cost per environment (production, staging, dev, sandbox)
  4. Cost per team/product (via tags/labels)
  5. Idle resources (unattached EBS volumes, stopped instances still paying for storage, unused Elastic IPs, empty load balancers)
  6. Data transfer costs (often the hidden killer)

Cost Allocation Tags

Every resource should have at minimum:

Environment: production | staging | dev | sandbox
Team: backend | frontend | data | platform
Product: [product-name]
CostCenter: [business-unit]
ManagedBy: terraform | manual | cdk

Without tags, you're flying blind. Untagged resources are the first problem to solve.

Unit Economics

Track cost per business metric, not just total cost:

  • Cost per API request
  • Cost per active user per month
  • Cost per transaction processed
  • Cost per GB stored
  • Cost per CI/CD pipeline run

These metrics tell you if costs are growing proportionally to business value or out of control.

Phase 2: Optimize — Quick Wins

1. Eliminate Waste (immediate savings, low risk)

Idle Resources

  • Unattached EBS volumes → delete or snapshot
  • Stopped EC2 instances with EBS → evaluate, terminate if unused for 30+ days
  • Unused Elastic IPs → release
  • Empty/unused load balancers → delete
  • Old snapshots and AMIs → lifecycle policy
  • Unused NAT Gateways → consolidate or remove

Dev/Staging Environments

  • Schedule non-prod instances to stop outside business hours (save ~65%)
  • Use smaller instance types for non-prod
  • Consider spot instances for dev workloads
  • Auto-delete preview/PR environments after merge

Storage

  • S3 lifecycle policies: move to Infrequent Access after 30 days, Glacier after 90
  • Enable S3 Intelligent-Tiering for unpredictable access patterns
  • Compress data before storing (gzip, zstd)
  • Delete old log data or move to cold storage

2. Right-Size Resources (moderate savings, low-medium risk)

Compute

  • Analyze CPU/memory utilization over 2+ weeks
  • If avg utilization <40%, downsize one tier
  • If avg utilization <20%, downsize two tiers or consider serverless
  • Use AWS Compute Optimizer or similar tools for recommendations

Databases

  • RDS instances often over-provisioned — check actual CPU, memory, IOPS
  • Consider Aurora Serverless v2 for variable workloads
  • Read replicas: do you actually need them, or is caching sufficient?
  • Multi-AZ: required for prod, probably not for staging

Containers

  • ECS/EKS task CPU/memory limits vs actual usage
  • Fargate vs EC2-backed: Fargate is simpler but often more expensive at scale
  • Karpenter/Cluster Autoscaler tuning for right-fit node selection

3. Pricing Models (significant savings, requires commitment)

ModelSavingsCommitmentBest For
On-Demand0%NoneSpiky, unpredictable workloads
Spot60-90%None (can be interrupted)Batch jobs, CI/CD, stateless workers
Savings Plans (Compute)30-40%1-3 yearSteady baseline compute
Reserved Instances40-60%1-3 yearPredictable, stable workloads
Committed Use (GCP)30-55%1-3 yearSimilar to RIs for GCP

Strategy: Cover your baseline with Savings Plans/RIs, handle spikes with On-Demand, and use Spot for fault-tolerant workloads.

4. Architecture Optimization (highest savings, highest effort)

Serverless where appropriate

  • Lambda for event-driven, bursty workloads (but watch for high-concurrency costs)
  • SQS/SNS instead of always-on consumers
  • Step Functions for orchestration vs custom state machines
  • API Gateway → Lambda vs ALB → ECS: calculate break-even point

Data Transfer

  • VPC endpoints for AWS services (avoid NAT Gateway data processing charges)
  • CloudFront for static assets and API caching
  • S3 Transfer Acceleration only if actually needed
  • Cross-region replication: do you need it, or is single-region sufficient?
  • Compress API responses (gzip/brotli)

Database

  • DynamoDB on-demand vs provisioned: calculate based on actual patterns
  • ElastiCache/Redis for read-heavy workloads (reduce DB load and cost)
  • Consider read replicas vs caching — often caching is cheaper and faster

Phase 3: Operate — Governance

Budget Alerts

Set up tiered alerts:

  • 50% of monthly budget → informational
  • 80% → warning to team lead
  • 100% → alert to engineering management
  • 120% → escalation with mandatory review

Monthly Cost Review

# Monthly Cloud Cost Review — [Month Year]

## Summary
- Total spend: $X,XXX (vs $X,XXX last month, +/-X%)
- Budget: $X,XXX (X% utilized)
- Cost per [business metric]: $X.XX (vs $X.XX last month)

## Top Movers
| Service | This Month | Last Month | Delta | Reason |
|---------|-----------|------------|-------|--------|

## Actions Taken
- [What was optimized and estimated savings]

## Next Month Plan
- [Planned optimizations]

## Anomalies
- [Unexpected cost spikes and root cause]

Cost Optimization Scoring

Rate your infrastructure maturity:

AreaScore 1-5Notes
Tagging coverage% of resources tagged
Right-sizingLast review date
Commitment coverage% of spend on RIs/SPs
Idle resource cleanupAutomated? Frequency?
Non-prod schedulingHours saved per week
Data transfer optimizationVPC endpoints, CDN
Cost monitoringAlerts, dashboards
Team awarenessFinOps culture

Common Anti-Patterns

  • "We might need it later" — over-provisioning for hypothetical future load
  • Running dev/staging 24/7 when teams work 8 hours
  • Multi-AZ everything, including throwaway environments
  • NAT Gateway as default when VPC endpoints would work
  • Large instance types "just in case" without utilization data
  • Keeping old snapshots/backups indefinitely without lifecycle policies
  • Cross-region data transfer for features that don't require it

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.