From 86b29444ffc3361b7b56ab67413e1a06d17bb493 Mon Sep 17 00:00:00 2001 From: Zhongwei Li Date: Sun, 30 Nov 2025 08:19:03 +0800 Subject: [PATCH] Initial commit --- .claude-plugin/plugin.json | 15 ++ README.md | 3 + commands/cost-optimize.md | 25 +++ plugin.lock.json | 77 ++++++++++ skills/cloud-cost-optimizer/SKILL.md | 54 +++++++ skills/cloud-cost-optimizer/assets/README.md | 8 + .../assets/cost_report_template.csv | 23 +++ .../assets/cost_report_template.pdf | 145 ++++++++++++++++++ .../assets/example_cost_report.csv | 23 +++ .../optimization_recommendation_template.json | 66 ++++++++ .../cloud-cost-optimizer/references/README.md | 8 + skills/cloud-cost-optimizer/scripts/README.md | 8 + 12 files changed, 455 insertions(+) create mode 100644 .claude-plugin/plugin.json create mode 100644 README.md create mode 100644 commands/cost-optimize.md create mode 100644 plugin.lock.json create mode 100644 skills/cloud-cost-optimizer/SKILL.md create mode 100644 skills/cloud-cost-optimizer/assets/README.md create mode 100644 skills/cloud-cost-optimizer/assets/cost_report_template.csv create mode 100644 skills/cloud-cost-optimizer/assets/cost_report_template.pdf create mode 100644 skills/cloud-cost-optimizer/assets/example_cost_report.csv create mode 100644 skills/cloud-cost-optimizer/assets/optimization_recommendation_template.json create mode 100644 skills/cloud-cost-optimizer/references/README.md create mode 100644 skills/cloud-cost-optimizer/scripts/README.md diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..7921683 --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,15 @@ +{ + "name": "cloud-cost-optimizer", + "description": "Optimize cloud costs and generate cost reports", + "version": "1.0.0", + "author": { + "name": "Claude Code Plugins", + "email": "[email protected]" + }, + "skills": [ + "./skills" + ], + "commands": [ + "./commands" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..1f2eec9 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# cloud-cost-optimizer + +Optimize cloud costs and generate cost reports diff --git a/commands/cost-optimize.md b/commands/cost-optimize.md new file mode 100644 index 0000000..31f5ee9 --- /dev/null +++ b/commands/cost-optimize.md @@ -0,0 +1,25 @@ +--- +description: $(echo "$description" | cut -d' ' -f1-5) +--- + +# $(echo "$name" | sed 's/-/ /g' | sed 's/\b\(.\)/\u\1/g') + +$(echo "$description") + +## Key Features + +- Production-ready configurations +- Best practices implementation +- Security-first approach +- Scalable architecture +- Comprehensive documentation +- Multi-platform support + +## Example Usage + +This plugin generates complete configurations for your DevOps needs. +Specify your requirements and get production-ready code instantly. + +## When Invoked + +Generate configurations and setup code based on your specific requirements and infrastructure needs. diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..8b3b5ef --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,77 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:jeremylongshore/claude-code-plugins-plus:plugins/devops/cloud-cost-optimizer", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "5f44472373761cc0683334d41842f6590bfe3313", + "treeHash": "61c9f5127d899bc7aeb150ca68f2989dfc3d9ff7f91cdf7c7d2c627f20dee27f", + "generatedAt": "2025-11-28T10:18:13.071831Z", + "toolVersion": "publish_plugins.py@0.2.0" + }, + "origin": { + "remote": "git@github.com:zhongweili/42plugin-data.git", + "branch": "master", + "commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390", + "repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data" + }, + "manifest": { + "name": "cloud-cost-optimizer", + "description": "Optimize cloud costs and generate cost reports", + "version": "1.0.0" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "623ec55f12236883ca19815e9d79ef4838373e651346f5a3e785c43471e64c1c" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "54343ef2c2c63efa65794575fb26c853f8dbb317fa277b297c1a1db64649750c" + }, + { + "path": "commands/cost-optimize.md", + "sha256": "353f80054a90cda1e6716da3628115ce829307fbbb83a15b64f1d37c96224a99" + }, + { + "path": "skills/cloud-cost-optimizer/SKILL.md", + "sha256": "4e2429a46fb6b3a70c2f39dde480b696c6f73a09ab23991abca8c88b1f206273" + }, + { + "path": "skills/cloud-cost-optimizer/references/README.md", + "sha256": "74088939988818cda370af6db1dcb96334dcd970f821ed0dc6bf8126b7a2d11c" + }, + { + "path": "skills/cloud-cost-optimizer/scripts/README.md", + "sha256": "c8706e199dba59fbe8d2663545dfcbffeb124d11e6fc4c2a7a1580166557ae16" + }, + { + "path": "skills/cloud-cost-optimizer/assets/optimization_recommendation_template.json", + "sha256": "0bbca1909926fd90e26cdb205685861347fc4c416384b130aa9bcc1f501da911" + }, + { + "path": "skills/cloud-cost-optimizer/assets/cost_report_template.csv", + "sha256": "177df0a9f490be807e97c6a796e2940a702281da056ee8159f479eaa83bbfa32" + }, + { + "path": "skills/cloud-cost-optimizer/assets/README.md", + "sha256": "242f2d43ae6bfb1382cf7828a7bdbd98276b67da34905dbc7fa097e88d4baad2" + }, + { + "path": "skills/cloud-cost-optimizer/assets/example_cost_report.csv", + "sha256": "cbf15046e892e4d4c7c28538098a1edc63df628376beae932ec5050bc3b2f037" + }, + { + "path": "skills/cloud-cost-optimizer/assets/cost_report_template.pdf", + "sha256": "28e09b96ab9452db6e9a34b78783fb9a1c619c7bd4e05cc67f693c476ce0d9c7" + } + ], + "dirSha256": "61c9f5127d899bc7aeb150ca68f2989dfc3d9ff7f91cdf7c7d2c627f20dee27f" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file diff --git a/skills/cloud-cost-optimizer/SKILL.md b/skills/cloud-cost-optimizer/SKILL.md new file mode 100644 index 0000000..9fb02e4 --- /dev/null +++ b/skills/cloud-cost-optimizer/SKILL.md @@ -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. \ No newline at end of file diff --git a/skills/cloud-cost-optimizer/assets/README.md b/skills/cloud-cost-optimizer/assets/README.md new file mode 100644 index 0000000..878d939 --- /dev/null +++ b/skills/cloud-cost-optimizer/assets/README.md @@ -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. diff --git a/skills/cloud-cost-optimizer/assets/cost_report_template.csv b/skills/cloud-cost-optimizer/assets/cost_report_template.csv new file mode 100644 index 0000000..5b190f5 --- /dev/null +++ b/skills/cloud-cost-optimizer/assets/cost_report_template.csv @@ -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 \ No newline at end of file diff --git a/skills/cloud-cost-optimizer/assets/cost_report_template.pdf b/skills/cloud-cost-optimizer/assets/cost_report_template.pdf new file mode 100644 index 0000000..33f6eb1 --- /dev/null +++ b/skills/cloud-cost-optimizer/assets/cost_report_template.pdf @@ -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 \ No newline at end of file diff --git a/skills/cloud-cost-optimizer/assets/example_cost_report.csv b/skills/cloud-cost-optimizer/assets/example_cost_report.csv new file mode 100644 index 0000000..299b608 --- /dev/null +++ b/skills/cloud-cost-optimizer/assets/example_cost_report.csv @@ -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. \ No newline at end of file diff --git a/skills/cloud-cost-optimizer/assets/optimization_recommendation_template.json b/skills/cloud-cost-optimizer/assets/optimization_recommendation_template.json new file mode 100644 index 0000000..1b3e6df --- /dev/null +++ b/skills/cloud-cost-optimizer/assets/optimization_recommendation_template.json @@ -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" + } +} \ No newline at end of file diff --git a/skills/cloud-cost-optimizer/references/README.md b/skills/cloud-cost-optimizer/references/README.md new file mode 100644 index 0000000..eec8ba4 --- /dev/null +++ b/skills/cloud-cost-optimizer/references/README.md @@ -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. diff --git a/skills/cloud-cost-optimizer/scripts/README.md b/skills/cloud-cost-optimizer/scripts/README.md new file mode 100644 index 0000000..1d0fc31 --- /dev/null +++ b/skills/cloud-cost-optimizer/scripts/README.md @@ -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.