Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Analyze Azure resources used in the app (IaC files and/or resources in a target rg) and optimize costs - creating GitHub issues for identified optimizations.
.claude/skills/az-cost-optimize/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-11 | ✗→✓ | ▲ Improved | — | — |
| case-07 | ✗→✓ | ▲ Improved | — | — |
| case-21 | ✗→✓ | ▲ Improved | — | — |
| case-09 | ✗→✓ | ▲ Improved | — | — |
| case-17 | ✗→✓ | ▲ Improved | — | — |
This workflow analyzes Infrastructure-as-Code (IaC) files and Azure resources to generate cost optimization recommendations. It creates individual GitHub issues for each optimization opportunity plus one EPIC issue to coordinate implementation, enabling efficient tracking and execution of cost savings initiatives.
azmcp-*) over direct Azure CLI when availableAction: Retrieve cost optimization best practices before analysis Tools: Azure MCP best practices tool Process:
azmcp-bestpractices-get to get some of the latest Azure optimization guidelines. This may not cover all scenarios but provides a foundation.Action: Dynamically discover and analyze Azure resources and configurations Tools: Azure MCP tools + Azure CLI fallback + Local file system access Process:
azmcp-subscription-list to find available subscriptionsazmcp-group-list --subscription <subscription-id> to find resource groupsaz resource list --subscription <id> --resource-group <name>azmcp-cosmos-account-list --subscription <id> - Cosmos DB accountsazmcp-storage-account-list --subscription <id> - Storage accounts azmcp-monitor-workspace-list --subscription <id> - Log Analytics workspacesazmcp-keyvault-key-list - Key Vaultsaz webapp list - Web Apps (fallback - no MCP tool available)az appservice plan list - App Service Plans (fallback)az functionapp list - Function Apps (fallback)az sql server list - SQL Servers (fallback)az redis list - Redis Cache (fallback)file_search to scan for IaC files: "/.bicep", "/.tf", "/main.json", "/template.json"Action: Gather utilization data AND verify actual resource costs Tools: Azure MCP monitoring tools + Azure CLI Process:
azmcp-monitor-workspace-list --subscription <id> to find Log Analytics workspacesazmcp-monitor-table-list --subscription <id> --workspace <name> --table-type "CustomLog" to discover available dataazmcp-monitor-log-query with these predefined queries:kql // CPU utilization for App Services AppServiceAppLogs | where TimeGenerated > ago(7d) | summarize avg(CpuTime) by Resource, bin(TimeGenerated, 1h)
// Cosmos DB RU consumption AzureDiagnostics | where ResourceProvider == "MICROSOFT.DOCUMENTDB" | where TimeGenerated > ago(7d) | summarize avg(RequestCharge) by Resource
// Storage account access patterns StorageBlobLogs | where TimeGenerated > ago(7d) | summarize RequestCount=count() by AccountName, bin(TimeGenerated, 1d)
az billing commandsAction: Analyze resources to identify optimization opportunities Tools: Local analysis using collected data Process:
Compute Optimizations:
Database Optimizations:
Storage Optimizations:
Infrastructure Optimizations:
Priority Score = (Value Score × Monthly Savings) / (Risk Score × Implementation Days)
High Priority: Score > 20 Medium Priority: Score 5-20 Low Priority: Score < 5
Action: Present summary and get approval before creating GitHub issues Process:
🎯 Azure Cost Optimization Summary
📊 Analysis Results: • Total Resources Analyzed: X • Current Monthly Cost: $X • Potential Monthly Savings: $Y • Optimization Opportunities: Z • High Priority Items: N
🏆 Recommendations:
... and so on
💡 This will create: • Y individual GitHub issues (one per optimization) • 1 EPIC issue to coordinate implementation
❓ Proceed with creating GitHub issues? (y/n)
Action: Create separate GitHub issues for each optimization opportunity. Label them with "cost-optimization" (green color), "azure" (blue color). MCP Tools Required: create_issue for each recommendation Process:
Title Format: [COST-OPT] [Resource Type] - [Brief Description] - $X/month savings
Body Template: markdown ## 💰 Cost Optimization: Brief Title]
Monthly Savings: $X | Risk Level: Low/Medium/High] | Implementation Effort: X days
### 📋 Description Clear explanation of the optimization and why it's needed]
### 🔧 Implementation
IaC Files Detected: Yes/No - based on file_search results]
bash # If IaC files found: Show IaC modifications + deployment # File: infrastructure/bicep/modules/app-service.bicep # Change: sku.name: 'S3' → 'B2' az deployment group create --resource-group rg] --template-file infrastructure/bicep/main.bicep
# If no IaC files: Direct Azure CLI commands + warning # ⚠️ No IaC files found. If they exist elsewhere, modify those instead. az appservice plan update --name plan] --sku B2
### 📊 Evidence
### ✅ Validation Steps
### ⚠️ Risks & Considerations
Priority Score: X | Value: X/10 | Risk: X/10
Action: Create master issue to track all optimization work. Label it with "cost-optimization" (green color), "azure" (blue color), and "epic" (purple color). MCP Tools Required: create_issue for EPIC Note about mermaid diagrams: Ensure you verify mermaid syntax is correct and create the diagrams taking accessibility guidelines into account (styling, colors, etc.). Process:
Title: [EPIC] Azure Cost Optimization Initiative - $X/month potential savings
Body Template: markdown # 🎯 Azure Cost Optimization EPIC
Total Potential Savings: $X/month | Implementation Timeline: X weeks
## 📊 Executive Summary
## 🏗️ Current Architecture Overview
mermaid graph TB subgraph "Resource Group: [name]" [Generated architecture diagram showing current resources and costs] end
## 📋 Implementation Tracking
### 🚀 High Priority (Implement First)
### ⚡ Medium Priority
### 🔄 Low Priority (Nice to Have)
## 📈 Progress Tracking
## 🎯 Success Criteria
## 📝 Notes
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-03 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 16 counted toward the lift figure. The other 6 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +59 percentage points is the difference between those two pass rates over the 16 comparable cases. 4 cases got worse with the skill loaded, and they are included in that figure.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.