agentleFS
jonathan-vellajonathan-vella/apex/.github/skills/apex-azure-cost-optimization/SKILL.md

apex-azure-cost-optimization

Skill216 starsChanged 2 months agoMITView on GitHub

**ANALYSIS SKILL** — Query, forecast and optimize Azure costs via cost + utilization analysis. WHEN: "optimize Azure costs", "find cost savings", "what did we spend", "cost forecast", "rightsize VMs", "find orphaned resources", "optimize Redis costs". DO NOT USE FOR: deploying (apex-azure-deploy), general diagnostics (apex-azure-diagnostics), security issues (apex-azure-compliance).

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when the user asks to:

    line 34
  2. Very specific:

    Validate prerequisites: before starting (Azure CLI authenticated, costmanagement + resource-graph extensions, azqr installed, Cost …

    line 48

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Azure Cost Optimization Skill

Analyze Azure subscriptions to identify cost savings through orphaned resource cleanup, rightsizing, and optimization recommendations based on actual usage data.

Routing

User intentWorkflow
Understand current or historical costCost query (query_costs)
Reduce costs or find wasteInstructions below
Project future costCost forecast (forecast_costs)

Scope Reference (Shared Across All Workflows)

  • Subscription: /subscriptions/<id>
  • Resource group: /subscriptions/<id>/resourceGroups/<name>
  • Management group: /providers/Microsoft.Management/managementGroups/<id>
  • Billing account: /providers/Microsoft.Billing/billingAccounts/<id>

When to Use This Skill

Use this skill when the user asks to:

  • Optimize Azure costs or reduce spending
  • Analyze Azure subscription for cost savings
  • Generate cost optimization report
  • Find orphaned or unused resources
  • Rightsize Azure VMs, containers, or services
  • Identify where they're overspending in Azure
  • Optimize Redis costs specifically - See Azure Redis Cost Optimization for Redis-specific analysis
  • Review storage tiers and lifecycle - See Azure Storage Cost Review

Rules

  • Read-only analysis first — never delete or modify resources during the assessment phase; remediation is a separate user-approved step
  • Validate prerequisites before starting (Azure CLI authenticated, costmanagement + resource-graph extensions, azqr installed, Cost Management Reader + Monitoring Reader + Reader roles)
  • Use real data — recommendations must be grounded in actual cost queries and utilization metrics, not assumptions
  • ARM MCP first — use API fallbacks only when an operation is unavailable, never to bypass invalid input, denied access, throttling or empty data (tool and safety guidance)
  • Cite sources — every savings estimate must reference the underlying cost query or pricing API result (audit trail in agent-output/{project}/cost-query-result<timestamp>.json)
  • Classify safely — mark recommendations as Safe / Review / Risky; never auto-apply destructive operations
  • Show the total bill — present savings next to the scope's total actual cost for the same period, so each saving reads against the whole bill
  • Redis-specific scope — when the user asks about Redis only, follow Azure Redis Cost Optimization instead of the general subscription workflow
  • Save artifacts to agent-output/{project}/costoptimizereport<timestamp>.md and the audit trail JSON; without a project, ask for its name before writing
  • Out of scope: deploying resources (use apex-azure-deploy), security issues (use apex-azure-compliance), general diagnostics (use apex-azure-diagnostics)

Instructions

High-level step list (full procedure in references/workflow-steps.md):

#StepReference
0Validate prerequisites (Azure CLI, costmanagement + resource-graph extensions, azqr, RBAC)workflow-steps.md
1Load Azure cost-optimization best practices via mcp_azure-mcp_get_azure_bestpracticesworkflow-steps.md
1.5(Conditional) Redis-specific analysis branchazure-redis.md
1.6(Redis branch) Choose analysis scope (subscription / prefix / tenant-wide)azure-redis.md
2Run Azure Quick Review (extension_azqr) for orphaned-resource discoveryazure-quick-review.md
3Discover resources cross-subscription via Azure Resource Graphazure-resource-graph.md
4–9Cost queries, pricing validation, metrics, report, audit trail, cleanupdetailed-workflow-steps.md

Branching rule: use Redis-only analysis only for an explicitly Redis-only request. Mixed-service or subscription-wide requests retain the general workflow and add Redis analysis for those resources. An ambiguous Redis mention never narrows scope; clarify intent while preserving all requested services.

Output

The skill generates:

  1. Cost Optimization Report (agent-output/{project}/costoptimizereport<timestamp>.md)
    • Executive summary with total costs and top drivers
    • Detailed cost breakdown with Azure Portal links
    • Prioritized recommendations with actual data and estimated savings
    • Implementation commands with safety warnings
  2. Cost Query Results (agent-output/{project}/cost-query-result<timestamp>.json)
    • Audit trail of all cost queries and responses
    • Validation evidence for recommendations

Important Notes

📋 Reference: Read references/best-practices-notes.md for data classification labels, best practices, common pitfalls, and safety requirements.

SDK Quick References

  • Redis Management: .NET

Reference Index

Load these on demand — do NOT read all at once:

ReferenceWhen to Load
../apex-entra-app-registration/references/auth-best-practices.mdAuth Best Practices
references/azure-quick-review.mdAzure Quick Review
references/azure-redis.mdAzure Redis
references/azure-resource-graph.mdAzure Resource Graph
references/workflow-steps.mdSteps 0–3: prerequisites, best practices, azqr, resource discovery
references/detailed-workflow-steps.mdSteps 4-9: cost queries, pricing, metrics, report, audit, cleanup
references/best-practices-notes.mdData classification, best practices, pitfalls, safety
references/cost-query/workflow.mdCost breakdowns, trends and totals; query_costs limits and errors
references/cost-forecast/workflow.mdForecasts; forecast_costs period and row limits
references/tools-and-safety.mdARM MCP fallback APIs, evidence labels and approval rules
references/azure-storage-tiers.mdStorage access tiers, lifecycle tiering and review signals

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.