skills/az-cost-optimize/SKILL.md
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.
npx skillsauth add williamlimasilva/.copilot az-cost-optimizeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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:
Resource Discovery:
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 accountsazmcp-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)IaC Detection:
file_search to scan for IaC files: "/*.bicep", "/*.tf", "/main.json", "/template.json"Configuration Analysis:
Action: Gather utilization data AND verify actual resource costs Tools: Azure MCP monitoring tools + Azure CLI Process:
Find Monitoring Sources:
azmcp-monitor-workspace-list --subscription <id> to find Log Analytics workspacesazmcp-monitor-table-list --subscription <id> --workspace <name> --table-type "CustomLog" to discover available dataExecute Usage Queries:
azmcp-monitor-log-query with these predefined queries:
// 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)
Calculate Baseline Metrics:
VALIDATE CURRENT COSTS:
az billing commandsAction: Analyze resources to identify optimization opportunities Tools: Local analysis using collected data Process:
Apply Optimization Patterns based on resource types found:
Compute Optimizations:
Database Optimizations:
Storage Optimizations:
Infrastructure Optimizations:
Calculate Evidence-Based Savings:
Calculate Priority Score for each recommendation:
Priority Score = (Value Score × Monthly Savings) / (Risk Score × Implementation Days)
High Priority: Score > 20
Medium Priority: Score 5-20
Low Priority: Score < 5
Validate Recommendations:
Action: Present summary and get approval before creating GitHub issues Process:
Display Optimization Summary:
🎯 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:
1. [Resource]: [Current SKU] → [Target SKU] = $X/month savings - [Risk Level] | [Implementation Effort]
2. [Resource]: [Current Config] → [Target Config] = $Y/month savings - [Risk Level] | [Implementation Effort]
3. [Resource]: [Current Config] → [Target Config] = $Z/month savings - [Risk Level] | [Implementation Effort]
... 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)
Wait for User Confirmation: Only proceed if user confirms
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:
Create Individual Issues using this template:
Title Format: [COST-OPT] [Resource Type] - [Brief Description] - $X/month savings
Body Template:
## 💰 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
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:
Create EPIC Issue:
Title: [EPIC] Azure Cost Optimization Initiative - $X/month potential savings
Body Template:
# 🎯 Azure Cost Optimization EPIC
**Total Potential Savings**: $X/month | **Implementation Timeline**: X weeks
## 📊 Executive Summary
- **Resources Analyzed**: X
- **Optimization Opportunities**: Y
- **Total Monthly Savings Potential**: $X
- **High Priority Items**: N
## 🏗️ Current Architecture Overview
```mermaid
graph TB
subgraph "Resource Group: [name]"
[Generated architecture diagram showing current resources and costs]
end
development
Build production RAG pipelines and persistent agent memory using Pinecone as the vector database backend. ALWAYS USE THIS SKILL when the user mentions Pinecone, wants to index documents for semantic search, build a retrieval-augmented generation system, store agent memory across sessions, implement hybrid search, or connect an LLM to a searchable knowledge base — even if they don't say "Pinecone" explicitly. Also use when the user asks about vector databases for RAG, namespace isolation for multi-tenant agents, embedding pipelines, or scaling a knowledge base beyond what local storage can handle. DO NOT use for local-only vector stores (Chroma, FAISS, pgvector) or pure keyword search with no semantic component.
development
Perform an AWS Well-Architected Framework review of the current workload IaC and architecture, generating findings and GitHub issues for improvements.
devops
Query AWS resources using natural language. Covers EC2, S3, RDS, Lambda, ECS, EKS, Secrets Manager, IAM, VPC, networking, messaging, and more. Strictly read-only — no writes, deletes, or mutations.
devops
Analyze AWS resource health, diagnose issues from CloudWatch logs and metrics, and create a remediation plan for identified problems.