cost-optimization
Install this skill
npx skills add wshobson/agentsWorks across Claude Code, Cursor, Codex, Copilot & Antigravity
The cost-optimization skill provides a structured framework for managing cloud infrastructure expenses across AWS, Azure, and GCP. It focuses on systematic methods to audit resource utilization and align deployment strategies with actual workload requirements. By shifting from default on-demand provisioning to optimized pricing models—such as reserved instances, committed use discounts, and spot instances—the skill helps stabilize cloud expenditures. It covers lifecycle management for storage buckets, implementing automated scaling policies, and establishing granular cost allocation tagging. These processes ensure that environments remain performant while eliminating waste from idle services. Instead of manual monitoring, this skill integrates budget alerting and anomaly detection to maintain fiscal guardrails, ensuring cloud operations are both operationally efficient and budget-conscious without requiring constant human oversight.
When to Use This Skill
- •Refining production environments to ensure instance sizes match CPU and memory consumption
- •Reducing expenses for transient CI/CD workloads by switching from on-demand to spot instances
- •Archiving legacy data into low-cost cold storage classes to decrease long-term S3 or Blob costs
- •Auditing large-scale multi-cloud deployments to identify and decommission forgotten resources
How to Invoke This Skill
Example prompts that trigger this skill in Claude Code, Cursor, or Antigravity:
- “How can I lower my monthly cloud infrastructure bill?
- “Show me how to implement S3 lifecycle policies for cost savings
- “Help me optimize my AWS EC2 and RDS spending
- “How do I set up automated budget alerts for my cloud project?
- “Recommend a strategy to right-size my over-provisioned infrastructure
Pro Tips
- 💡Integrate cost optimization checks into your CI/CD pipeline to identify and prevent costly deployments proactively.
- 💡Regularly review and adjust resource allocations using data from your cloud provider's cost management tools to catch over-provisioning.
- 💡Leverage cloud-native budgeting and alert features to monitor spending against thresholds and prevent unexpected cost spikes.
What this skill does
- •Mapping resources to specific cost allocation tags for granular billing transparency
- •Transitioning storage objects to lower-cost tiers via automated lifecycle configurations
- •Configuring elastic auto-scaling policies to match fluctuating demand in real-time
- •Executing reserved capacity and savings plans across multi-cloud providers
- •Setting up threshold-based budget notifications to prevent unexpected overages
When not to use it
- ✕Handling complex compliance or data sovereignty requirements that mandate specific instance types
- ✕Managing highly unpredictable, latency-sensitive applications that cannot tolerate spot instance interruptions
Example workflow
- Enable cost allocation tagging across all environment resources
- Analyze historical utilization metrics to identify idle or over-provisioned instances
- Apply appropriate reserved instance or savings plans for predictable steady-state workloads
- Define lifecycle policies to transition aging data to infrequent or archive tiers
- Deploy budget monitoring alerts to catch cost spikes before they exceed monthly limits
Prerequisites
- –Administrator-level access to cloud provider consoles
- –A baseline understanding of current resource usage metrics
- –Terraform or IaC experience for automated implementations
Pitfalls & limitations
- !Over-aggressive downsizing can lead to performance degradation during traffic spikes
- !Spot instance usage without proper failover mechanisms risks service downtime
- !Tagging policies fail if not strictly enforced by IAM or CI/CD pipelines
FAQ
How it compares
Unlike generic prompts that offer broad advice, this skill provides actionable Infrastructure-as-Code patterns and specific provider-level configuration steps for immediate execution.
📄 Full skill instructions — original source: wshobson/agents
Strategies and patterns for optimizing cloud costs across AWS, Azure, and GCP.
## Purpose
Implement systematic cost optimization strategies to reduce cloud spending while maintaining performance and reliability.
## When to Use
- Reduce cloud spending
- Right-size resources
- Implement cost governance
- Optimize multi-cloud costs
- Meet budget constraints
## Cost Optimization Framework
### 1. Visibility
- Implement cost allocation tags
- Use cloud cost management tools
- Set up budget alerts
- Create cost dashboards
### 2. Right-Sizing
- Analyze resource utilization
- Downsize over-provisioned resources
- Use auto-scaling
- Remove idle resources
### 3. Pricing Models
- Use reserved capacity
- Leverage spot/preemptible instances
- Implement savings plans
- Use committed use discounts
### 4. Architecture Optimization
- Use managed services
- Implement caching
- Optimize data transfer
- Use lifecycle policies
## AWS Cost Optimization
### Reserved Instances
Savings: 30-72% vs On-Demand
Term: 1 or 3 years
Payment: All/Partial/No upfront
Flexibility: Standard or Convertible### Savings Plans
Compute Savings Plans: 66% savings
EC2 Instance Savings Plans: 72% savings
Applies to: EC2, Fargate, Lambda
Flexible across: Instance families, regions, OS### Spot Instances
Savings: Up to 90% vs On-Demand
Best for: Batch jobs, CI/CD, stateless workloads
Risk: 2-minute interruption notice
Strategy: Mix with On-Demand for resilience### S3 Cost Optimization
resource "aws_s3_bucket_lifecycle_configuration" "example" {
bucket = aws_s3_bucket.example.id
rule {
id = "transition-to-ia"
status = "Enabled"
transition {
days = 30
storage_class = "STANDARD_IA"
}
transition {
days = 90
storage_class = "GLACIER"
}
expiration {
days = 365
}
}
}## Azure Cost Optimization
### Reserved VM Instances
- 1 or 3 year terms
- Up to 72% savings
- Flexible sizing
- Exchangeable
### Azure Hybrid Benefit
- Use existing Windows Server licenses
- Up to 80% savings with RI
- Available for Windows and SQL Server
### Azure Advisor Recommendations
- Right-size VMs
- Delete unused resources
- Use reserved capacity
- Optimize storage
## GCP Cost Optimization
### Committed Use Discounts
- 1 or 3 year commitment
- Up to 57% savings
- Applies to vCPUs and memory
- Resource-based or spend-based
### Sustained Use Discounts
- Automatic discounts
- Up to 30% for running instances
- No commitment required
- Applies to Compute Engine, GKE
### Preemptible VMs
- Up to 80% savings
- 24-hour maximum runtime
- Best for batch workloads
## Tagging Strategy
### AWS Tagging
locals {
common_tags = {
Environment = "production"
Project = "my-project"
CostCenter = "engineering"
Owner = "[email protected]"
ManagedBy = "terraform"
}
}
resource "aws_instance" "example" {
ami = "ami-12345678"
instance_type = "t3.medium"
tags = merge(
local.common_tags,
{
Name = "web-server"
}
)
}**Reference:** See
references/tagging-standards.md## Cost Monitoring
### Budget Alerts
# AWS Budget
resource "aws_budgets_budget" "monthly" {
name = "monthly-budget"
budget_type = "COST"
limit_amount = "1000"
limit_unit = "USD"
time_period_start = "2024-01-01_00:00"
time_unit = "MONTHLY"
notification {
comparison_operator = "GREATER_THAN"
threshold = 80
threshold_type = "PERCENTAGE"
notification_type = "ACTUAL"
subscriber_email_addresses = ["[email protected]"]
}
}### Cost Anomaly Detection
- AWS Cost Anomaly Detection
- Azure Cost Management alerts
- GCP Budget alerts
## Architecture Patterns
### Pattern 1: Serverless First
- Use Lambda/Functions for event-driven
- Pay only for execution time
- Auto-scaling included
- No idle costs
### Pattern 2: Right-Sized Databases
Development: t3.small RDS
Staging: t3.large RDS
Production: r6g.2xlarge RDS with read replicas### Pattern 3: Multi-Tier Storage
Hot data: S3 Standard
Warm data: S3 Standard-IA (30 days)
Cold data: S3 Glacier (90 days)
Archive: S3 Deep Archive (365 days)### Pattern 4: Auto-Scaling
resource "aws_autoscaling_policy" "scale_up" {
name = "scale-up"
scaling_adjustment = 2
adjustment_type = "ChangeInCapacity"
cooldown = 300
autoscaling_group_name = aws_autoscaling_group.main.name
}
resource "aws_cloudwatch_metric_alarm" "cpu_high" {
alarm_name = "cpu-high"
comparison_operator = "GreaterThanThreshold"
evaluation_periods = "2"
metric_name = "CPUUtilization"
namespace = "AWS/EC2"
period = "60"
statistic = "Average"
threshold = "80"
alarm_actions = [aws_autoscaling_policy.scale_up.arn]
}## Cost Optimization Checklist
- [ ] Implement cost allocation tags
- [ ] Delete unused resources (EBS, EIPs, snapshots)
- [ ] Right-size instances based on utilization
- [ ] Use reserved capacity for steady workloads
- [ ] Implement auto-scaling
- [ ] Optimize storage classes
- [ ] Use lifecycle policies
- [ ] Enable cost anomaly detection
- [ ] Set budget alerts
- [ ] Review costs weekly
- [ ] Use spot/preemptible instances
- [ ] Optimize data transfer costs
- [ ] Implement caching layers
- [ ] Use managed services
- [ ] Monitor and optimize continuously
## Tools
- **AWS:** Cost Explorer, Cost Anomaly Detection, Compute Optimizer
- **Azure:** Cost Management, Advisor
- **GCP:** Cost Management, Recommender
- **Multi-cloud:** CloudHealth, Cloudability, Kubecost
## Reference Files
-
references/tagging-standards.md - Tagging conventions-
assets/cost-analysis-template.xlsx - Cost analysis spreadsheet## Related Skills
-
terraform-module-library - For resource provisioning-
multi-cloud-architecture - For cloud selectionHow to Use This Skill Unit
Option A: Project-Specific (Recommended)
- Click "Download" above
- In your project, create the directory:
.agent/skills/cost-optimization/ - Save the file as
SKILL.md - The agent will automatically discover the skill based on its description.
Option B: Global Installation (All Agents)
Save the file to these locations to make it available across all projects:
- Claude Code:
~/.claude/skills/wshobson/agents/cost-optimization/SKILL.md - Cursor:
~/.cursor/skills/wshobson/agents/cost-optimization/SKILL.md - Antigravity:
~/.gemini/antigravity/skills/wshobson/agents/cost-optimization/SKILL.md
🚀 Install with CLI:npx skills add wshobson/agents