Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 08:19:03 +08:00
commit 86b29444ff
12 changed files with 455 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
---
name: optimizing-cloud-costs
description: |
This skill enables Claude to analyze and optimize cloud costs. It identifies areas for potential savings, generates cost reports, and suggests configuration changes to reduce expenses. Use this skill when the user asks to "optimize cloud costs", "reduce cloud spending", "generate a cost report", or similar requests related to cloud resource expenses. It is especially useful when the user provides details about their cloud environment (e.g., AWS, Azure, GCP). The skill leverages best practices for cost optimization and provides production-ready configurations.
allowed-tools: Read, Write, Edit, Grep, Glob, Bash
version: 1.0.0
---
## Overview
This skill empowers Claude to be a FinOps expert, helping users identify and implement strategies to minimize their cloud expenditures. By analyzing current resource utilization and suggesting optimized configurations, it ensures efficient cloud spending.
## How It Works
1. **Analyzing Cost Data**: Claude analyzes the user's request to identify the scope and cloud provider (if specified).
2. **Generating Optimization Recommendations**: Claude formulates specific recommendations to reduce costs, such as rightsizing instances, identifying unused resources, or leveraging reserved instances.
3. **Creating Cost Report**: Claude generates a detailed cost report summarizing current spending and potential savings.
## When to Use This Skill
This skill activates when you need to:
- Reduce your AWS, Azure, or GCP cloud spending.
- Generate a report detailing current cloud costs.
- Identify underutilized or unused cloud resources.
## Examples
### Example 1: Reducing AWS EC2 Costs
User request: "Optimize my AWS EC2 costs. I'm running several t3.medium instances."
The skill will:
1. Analyze the usage patterns of the t3.medium instances.
2. Suggest rightsizing to t3.small or using reserved instances if utilization is consistently high.
3. Generate a cost report showing potential savings from the recommended changes.
### Example 2: Identifying Idle Azure Resources
User request: "Generate a report of idle resources in my Azure subscription."
The skill will:
1. Identify any virtual machines, storage accounts, or other resources that have been idle for a specified period.
2. Recommend terminating or deallocating the idle resources.
3. Provide a cost report detailing the savings achieved by removing the idle resources.
## Best Practices
- **Resource Utilization**: Regularly review resource utilization metrics to identify opportunities for rightsizing.
- **Reserved Instances**: Leverage reserved instances or committed use discounts for consistently used resources.
- **Cost Monitoring**: Implement continuous cost monitoring and alerting to track spending trends and identify anomalies.
## Integration
This skill can be used in conjunction with other DevOps plugins to automate the implementation of cost optimization recommendations. For example, it can integrate with infrastructure-as-code tools to automatically resize instances or terminate unused resources.

View File

@@ -0,0 +1,8 @@
# Assets
Bundled resources for cloud-cost-optimizer skill
- [ ] cost_report_template.csv: A CSV template for generating cost reports.
- [ ] cost_report_template.pdf: A PDF template for generating cost reports.
- [ ] optimization_recommendation_template.json: A JSON template for optimization recommendations.
- [ ] example_cost_report.csv: An example cost report for demonstration purposes.

View File

@@ -0,0 +1,23 @@
# Cloud Cost Report Template
# This CSV file provides a template for generating cost reports.
# Each row represents a cost item.
#
# Columns:
# - Date: The date of the cost (YYYY-MM-DD).
# - Account: The account or project associated with the cost.
# - Service: The cloud service used (e.g., EC2, S3, RDS).
# - Region: The AWS region (e.g., us-east-1, eu-west-1). Use 'Global' if applicable.
# - Item: A descriptive name for the cost item.
# - Cost: The cost in USD.
# - Unit: The unit of measurement for the item (e.g., hours, GB, requests). Leave blank if not applicable.
# - Quantity: The quantity consumed. Leave blank if not applicable.
# - Notes: Any additional notes or descriptions.
#
# Example usage:
# 2023-10-26,ProjectA,EC2,us-east-1,Instance m5.large,1.20,hours,10,Compute costs for web server
# 2023-10-26,ProjectB,S3,us-west-2,Storage,0.50,GB,100,Storage costs for backups
# 2023-10-26,ProjectA,RDS,us-east-1,Database instance,2.50,hours,5,Database costs
# 2023-10-26,ProjectC,Lambda,Global,Function invocations,0.10,requests,10000,Lambda function costs
Date,Account,Service,Region,Item,Cost,Unit,Quantity,Notes
#YYYY-MM-DD,AccountName,ServiceName,RegionName,ItemDescription,CostInUSD,UnitOfMeasure,QuantityConsumed,AdditionalNotes
1 # Cloud Cost Report Template
2 # This CSV file provides a template for generating cost reports.
3 # Each row represents a cost item.
4 #
5 # Columns:
6 # - Date: The date of the cost (YYYY-MM-DD).
7 # - Account: The account or project associated with the cost.
8 # - Service: The cloud service used (e.g., EC2, S3, RDS).
9 # - Region: The AWS region (e.g., us-east-1, eu-west-1). Use 'Global' if applicable.
10 # - Item: A descriptive name for the cost item.
11 # - Cost: The cost in USD.
12 # - Unit: The unit of measurement for the item (e.g., hours, GB, requests). Leave blank if not applicable.
13 # - Quantity: The quantity consumed. Leave blank if not applicable.
14 # - Notes: Any additional notes or descriptions.
15 #
16 # Example usage:
17 # 2023-10-26,ProjectA,EC2,us-east-1,Instance m5.large,1.20,hours,10,Compute costs for web server
18 # 2023-10-26,ProjectB,S3,us-west-2,Storage,0.50,GB,100,Storage costs for backups
19 # 2023-10-26,ProjectA,RDS,us-east-1,Database instance,2.50,hours,5,Database costs
20 # 2023-10-26,ProjectC,Lambda,Global,Function invocations,0.10,requests,10000,Lambda function costs
21 Date,Account,Service,Region,Item,Cost,Unit,Quantity,Notes
22 #YYYY-MM-DD,AccountName,ServiceName,RegionName,ItemDescription,CostInUSD,UnitOfMeasure,QuantityConsumed,AdditionalNotes

View File

@@ -0,0 +1,145 @@
%PDF-1.7
%âãÏÓ
1 0 obj
<< /Type /Catalog
/Pages 2 0 R
>>
endobj
2 0 obj
<< /Type /Pages
/Kids [ 3 0 R ]
/Count 1
>>
endobj
3 0 obj
<< /Type /Page
/Parent 2 0 R
/MediaBox [0 0 612 792]
/Contents 4 0 R
/Resources << /ProcSet [/PDF /Text]
/Font << /F1 5 0 R >>
>>
>>
endobj
4 0 obj
<< /Length 673 >>
stream
BT
/F1 24 Tf % Set font and size
72 720 Td % Set starting position
(Cloud Cost Optimization Report) Tj
ET
BT
/F1 12 Tf % Smaller font for details
72 680 Td
(Report Date: [REPORT_DATE]) Tj
ET
BT
72 660 Td
(Generated by: Cloud Cost Optimizer Plugin) Tj
ET
BT
72 620 Td
(Summary:) Tj
ET
BT
72 600 Td
(Total Estimated Savings: [TOTAL_ESTIMATED_SAVINGS]) Tj
ET
BT
72 580 Td
(Number of Recommendations: [NUMBER_OF_RECOMMENDATIONS]) Tj
ET
BT
72 540 Td
(Detailed Recommendations:) Tj
ET
BT
/F1 10 Tf % Even smaller for the table
72 520 Td
(Resource ID | Recommendation | Estimated Savings | Priority) Tj
ET
BT
72 500 Td
(----------------------------------------------------------------------------------) Tj
ET
BT
72 480 Td
([RESOURCE_ID_1] | [RECOMMENDATION_1] | [ESTIMATED_SAVINGS_1] | [PRIORITY_1]) Tj
ET
BT
72 460 Td
([RESOURCE_ID_2] | [RECOMMENDATION_2] | [ESTIMATED_SAVINGS_2] | [PRIORITY_2]) Tj
ET
BT
72 440 Td
([RESOURCE_ID_3] | [RECOMMENDATION_3] | [ESTIMATED_SAVINGS_3] | [PRIORITY_3]) Tj
ET
BT
72 400 Td
(Disclaimer: These are estimates and actual savings may vary.) Tj
ET
BT
72 380 Td
(For further details, please consult the plugin documentation.) Tj
ET
BT
72 340 Td
(End of Report) Tj
ET
endstream
endobj
5 0 obj
<< /Type /Font
/Subtype /Type1
/Name /F1
/BaseFont /Helvetica
/Encoding /MacRomanEncoding
>>
endobj
6 0 obj
<< /Producer (PDFSharp 1.50.5147 (www.pdfsharp.com))
/CreationDate (D:20241027120000) % Replace with actual date
>>
endobj
xref
0 7
0000000000 65535 f
0000000009 00000 n
0000000058 00000 n
0000000110 00000 n
0000000283 00000 n
0000000965 00000 n
0000001046 00000 n
trailer
<< /Size 7
/Root 1 0 R
/Info 6 0 R
>>
startxref
1142
%%EOF

View File

@@ -0,0 +1,23 @@
# Example Cost Report - Cloud Cost Optimizer Plugin
# This file demonstrates the format of cost reports generated by the plugin.
# Replace the placeholders with actual data from your cloud provider.
# Fields: Date, Account ID, Resource ID, Resource Type, Region, Service, Cost, Currency, Usage Unit, Usage Amount
Date,Account ID,Resource ID,Resource Type,Region,Service,Cost,Currency,Usage Unit,Usage Amount
2024-01-01,123456789012,i-0abcdef1234567890,EC2 Instance,us-east-1,Compute,10.50,USD,Instance Hour,168
2024-01-01,123456789012,arn:aws:s3:::my-bucket,S3 Bucket,us-east-1,Storage,2.75,USD,GB-Month,100
2024-01-02,123456789012,i-0abcdef1234567890,EC2 Instance,us-east-1,Compute,10.50,USD,Instance Hour,168
2024-01-02,123456789012,arn:aws:s3:::my-bucket,S3 Bucket,us-east-1,Storage,2.75,USD,GB-Month,100
2024-01-03,123456789012,i-0abcdef1234567890,EC2 Instance,us-east-1,Compute,10.50,USD,Instance Hour,168
2024-01-03,123456789012,arn:aws:s3:::my-bucket,S3 Bucket,us-east-1,Storage,2.75,USD,GB-Month,100
2024-01-04,123456789012,i-0abcdef1234567890,EC2 Instance,us-east-1,Compute,10.50,USD,Instance Hour,168
2024-01-04,123456789012,arn:aws:s3:::my-bucket,S3 Bucket,us-east-1,Storage,2.75,USD,GB-Month,100
2024-01-05,123456789012,i-0abcdef1234567890,EC2 Instance,us-east-1,Compute,10.50,USD,Instance Hour,168
2024-01-05,123456789012,arn:aws:s3:::my-bucket,S3 Bucket,us-east-1,Storage,2.75,USD,GB-Month,100
2024-01-06,123456789012,i-0abcdef1234567890,EC2 Instance,us-east-1,Compute,10.50,USD,Instance Hour,168
2024-01-06,123456789012,arn:aws:s3:::my-bucket,S3 Bucket,us-east-1,Storage,2.75,USD,GB-Month,100
2024-01-07,123456789012,i-0abcdef1234567890,EC2 Instance,us-east-1,Compute,10.50,USD,Instance Hour,168
2024-01-07,123456789012,arn:aws:s3:::my-bucket,S3 Bucket,us-east-1,Storage,2.75,USD,GB-Month,100
# Add more rows as needed. Make sure the data types match the column headers.
# Consider adding columns for tags or other relevant metadata.
1 # Example Cost Report - Cloud Cost Optimizer Plugin
2 # This file demonstrates the format of cost reports generated by the plugin.
3 # Replace the placeholders with actual data from your cloud provider.
4 # Fields: Date, Account ID, Resource ID, Resource Type, Region, Service, Cost, Currency, Usage Unit, Usage Amount
5 Date,Account ID,Resource ID,Resource Type,Region,Service,Cost,Currency,Usage Unit,Usage Amount
6 2024-01-01,123456789012,i-0abcdef1234567890,EC2 Instance,us-east-1,Compute,10.50,USD,Instance Hour,168
7 2024-01-01,123456789012,arn:aws:s3:::my-bucket,S3 Bucket,us-east-1,Storage,2.75,USD,GB-Month,100
8 2024-01-02,123456789012,i-0abcdef1234567890,EC2 Instance,us-east-1,Compute,10.50,USD,Instance Hour,168
9 2024-01-02,123456789012,arn:aws:s3:::my-bucket,S3 Bucket,us-east-1,Storage,2.75,USD,GB-Month,100
10 2024-01-03,123456789012,i-0abcdef1234567890,EC2 Instance,us-east-1,Compute,10.50,USD,Instance Hour,168
11 2024-01-03,123456789012,arn:aws:s3:::my-bucket,S3 Bucket,us-east-1,Storage,2.75,USD,GB-Month,100
12 2024-01-04,123456789012,i-0abcdef1234567890,EC2 Instance,us-east-1,Compute,10.50,USD,Instance Hour,168
13 2024-01-04,123456789012,arn:aws:s3:::my-bucket,S3 Bucket,us-east-1,Storage,2.75,USD,GB-Month,100
14 2024-01-05,123456789012,i-0abcdef1234567890,EC2 Instance,us-east-1,Compute,10.50,USD,Instance Hour,168
15 2024-01-05,123456789012,arn:aws:s3:::my-bucket,S3 Bucket,us-east-1,Storage,2.75,USD,GB-Month,100
16 2024-01-06,123456789012,i-0abcdef1234567890,EC2 Instance,us-east-1,Compute,10.50,USD,Instance Hour,168
17 2024-01-06,123456789012,arn:aws:s3:::my-bucket,S3 Bucket,us-east-1,Storage,2.75,USD,GB-Month,100
18 2024-01-07,123456789012,i-0abcdef1234567890,EC2 Instance,us-east-1,Compute,10.50,USD,Instance Hour,168
19 2024-01-07,123456789012,arn:aws:s3:::my-bucket,S3 Bucket,us-east-1,Storage,2.75,USD,GB-Month,100
20 # Add more rows as needed. Make sure the data types match the column headers.
21 # Consider adding columns for tags or other relevant metadata.

View File

@@ -0,0 +1,66 @@
{
"_comment": "Template for a cloud cost optimization recommendation",
"recommendationId": "OPT-AWS-EC2-001",
"resourceId": "i-0abcdef1234567890",
"resourceType": "EC2 Instance",
"region": "us-east-1",
"accountId": "123456789012",
"description": "This EC2 instance is underutilized and can be resized to a smaller instance type.",
"currentConfiguration": {
"instanceType": "m5.large",
"cpuUtilization": "10%",
"memoryUtilization": "5%",
"networkUtilization": "2%"
},
"recommendedAction": "Resize instance to t3.medium",
"estimatedSavings": {
"monthlyCost": 25.00,
"currency": "USD",
"_comment": "Estimated monthly savings in USD"
},
"reasoning": "Based on historical CPU and memory utilization, the instance is consistently underutilized. Resizing to a t3.medium instance will provide sufficient resources while reducing costs.",
"riskAssessment": {
"impact": "Low",
"likelihood": "High",
"mitigation": "Monitor the instance after resizing to ensure performance is not negatively impacted. Consider setting up CloudWatch alarms to track CPU and memory utilization.",
"_comment": "Assessment of risks associated with the recommendation"
},
"implementationSteps": [
"1. Stop the EC2 instance.",
"2. Change the instance type to t3.medium in the AWS console or using the AWS CLI.",
"3. Start the EC2 instance.",
"4. Monitor performance for 24-48 hours to ensure stability."
],
"status": "Open",
"createdTimestamp": "2024-01-01T00:00:00Z",
"lastUpdatedTimestamp": "2024-01-01T00:00:00Z",
"tags": [
"cost",
"optimization",
"ec2",
"aws"
],
"additionalInformation": {
"links": [
{
"title": "AWS EC2 Instance Types",
"url": "https://aws.amazon.com/ec2/instance-types/"
},
{
"title": "AWS CloudWatch",
"url": "https://aws.amazon.com/cloudwatch/"
}
],
"_comment": "Links to relevant documentation or resources"
},
"affectedServices": [
"EC2"
],
"confidenceLevel": "High",
"costImpactDetails": {
"currentMonthlyCost": 50.00,
"recommendedMonthlyCost": 25.00,
"costDifference": -25.00,
"currency": "USD"
}
}

View File

@@ -0,0 +1,8 @@
# References
Bundled resources for cloud-cost-optimizer skill
- [ ] aws_cost_optimization_best_practices.md: A detailed guide on AWS cost optimization best practices.
- [ ] azure_cost_management_documentation.md: Official Azure Cost Management documentation.
- [ ] gcp_cost_optimization_guide.md: A comprehensive guide on GCP cost optimization strategies.
- [ ] cloud_resource_definitions.md: Definitions of common cloud resources and their associated costs.

View File

@@ -0,0 +1,8 @@
# Scripts
Bundled resources for cloud-cost-optimizer skill
- [ ] generate_cost_report.py: Generates a detailed cost report in various formats (CSV, PDF, etc.) based on cloud provider APIs.
- [ ] recommend_optimization.py: Analyzes cloud resource utilization and suggests specific configuration changes to reduce costs.
- [ ] apply_optimization.py: Applies the recommended optimization changes to the cloud environment (with user confirmation).
- [ ] validate_cost_savings.py: Validates the cost savings achieved after applying the optimization changes.