Prompt file imported from rhixecompany/sandbox (
.github/prompts/finance/az-cost-optimize/az-cost-optimize.prompt.md). Copyright stays with the author.
Table of Contents
Goal
Analyze Azure IaC and live resources, identify savings opportunities, and create prioritized GitHub issues for each optimization recommendation.
Context
Phases
Table of Contents
Analyze Azure resources used in the app (IaC files and/or resources in a target rg) and improve costs - creating GitHub issues for identified optimizations.
Azure Cost OptimizeThis 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.
Prerequisites
- Azure MCP server configured and authenticated
- GitHub MCP server configured and authenticated
- Target GitHub repository identified
- Azure resources deployed (IaC files optional but helpful)
- Prefer Azure MCP tools (
azmcp-*) over direct Azure CLI when available
Workflow Steps
Step 1: Get Azure Best Practices
Action: Retrieve cost optimization best practices before analysis Tools:
š° Cost Optimization: [Brief Title]
Monthly Savings: $X | Risk Level: [Low/Medium/High] | **Implementation E [Clear explanation of the optimization and why it's needed] Full content:
š Executive Summary
- Resources Analyzed: X- Optimization Opportunities: Y- Total Monthly Savings Potential: $X- High Priority Items: N
šļø Current Architecture Overview
graph TB subgraph "Resource Group: [name]" [Generated architecture diagram showing current resources and costs] end``````
š Implementation Tracking
š High Priority (Implement First)
- # [issue-number]: [Title] - $X/month savings - [ ] # [issue-number]: [Title] - $X/month savings
ā” Medium Priority
- # [issue-number]: [Title] - $X/month savings - [ ] # [issue-number]: [Title] - $X/month savings
š Low Priority (Nice to Have)
- # [issue-number]: [Title] - $X/month savings
š Progress Tracking
- Completed: 0 of Y optimizations - Savings Realized: $0 of $X/month - Implementation Status: Not Started
šÆ Success Criteria
- All high-priority optimizations implemented - [ ]
80% of estimated savings realized - [ ] No performance degradation observed - [ ] Cost monitoring dashboard updated
š Notes
- Review and update this EPIC as issues are completed - Monitor actual vs. estimated savings - Consider scheduling regular cost optimization reviews `````
Error Handling
- Cost Validation: If savings estimates lack supporting evidence or seem inconsistent with Azure pricing, re-verify configurations and pricing sources before proceeding
- Azure Authentication Failure: Provide manual Azure CLI setup steps
- No Resources Found: Create informational issue about Azure resource deployment
- GitHub Creation Failure: Output formatted recommendations to console
- Insufficient Usage Data: Note limitations and provide configuration-based recommendations only
Success Criteria
- ā All cost estimates verified against actual resource configurations and Azure pricing- ā Individual issues created for each optimization (trackable and assignable)- ā EPIC issue provides comprehensive coordination and tracking- ā All recommendations include specific, executable Azure CLI commands- ā Priority scoring enables ROI-focused implementation- ā Architecture diagram accurately represents current state- ā User confirmation prevents unwanted issue creation
Template References
Detailed templates in templates/:- cost_optimization_brief_title.md- workflow_steps.md
Personas
See templates/personas.md for shared persona templates.
| Persona | When to Use |
|---|---|
| Developer | Implementation, debugging, refactoring |
| Reviewer | Code review, quality assurance |
| User | General purpose, operations |
Personality
See templates/personality.md for shared personality guidelines.
- Tone: Direct, practical, actionable
- Style: Structured with clear steps and verification
- Avoid: Ambiguity, assumptions, scope creep
- Encourage: Evidence-based decisions, minimal changes
Use when implementing, modifying, or debugging code. Read the codebase first, understand patterns, then apply changes with tests.
Rules
See core rules: templates/rules-core.md
Domain Rules
- Read existing code before writing new code.
- Match project conventions and style.
- Add tests for new functionality.
Standing Rules
- Map before touch ā Understand before making changes.
- Smallest safe change ā Minimal change that achieves the goal.
- Verify before claim ā Test before reporting complete.
- Report blockers ā State when something fails.
Phase 1: Intake
- Read the request and identify scope.
- Locate relevant files, diffs, references.
Phase 2: Execute
- Perform work with smallest safe change set.
- Keep steps explicit and reproducible.
Phase 3: Verify
- Check result against goal, rules, inputs.
- Confirm output is usable and complete.
Phase 4: Hand Off
- Return final artifact or findings .
- Stop once the requested result is delivered.
Best Practices
See templates/best-practices.md for cross-cutting best practices.
- DRY ā Reference shared templates instead of duplicating content.
- Structured output ā Use clear sections with consistent heading levels.
- Verification gates ā Always verify before claiming completion.
- Minimal changes ā Fix root cause, not symptoms.
Verification Checklist
| # | Gate | Criterion |
|---|---|---|
| 1 | Scope | Change matches the original request |
| 2 | Quality | Meets project standards |
| 3 | Tests | Tests pass (if applicable) |
| 4 | Regression | No unintended side effects |
| 5 | Docs | Changes documented if needed |
Dependencies
See templates/deps-core.md for shared dependency patterns.
Subgoals
- Prepare ā Understand requirements and prerequisites.
- Execute ā Follow structured workflow with incremental progress.
- Verify ā Confirm output meets requirements and standards.
- Document ā Record results, decisions, and lessons learned.
Skills Required
See templates/skills-table-core.md for shared skills table.
| Skill | Purpose |
|---|---|
using-superpowers |
Foundational skill workflow |
systematic-debugging |
Root cause analysis and fix |
git-patch-management |
Patch creation and management |
executing-plans |
Execute plans step by step |
verification-before-completion |
Validate before claiming done |
MCP Servers & Tools
The following MCP servers and tools are available for this task. Use them in preference to native equivalents per MCP-first tooling policy.
| ast-grep | AST-based code search and replace |
| filesystem | File read/write operations |
| sequential-thinking | Structured reasoning for complex problems |
| fetch | Web page content extraction |
| playwright | Browser automation for interactive pages |
| github | GitHub API operations |
Tasks
- Understand requirements and scope
- Plan approach and identify resources
- Execute work incrementally
- Verify against acceptance criteria
- Document results and decisions
Hooks
Shared workspace hooks run around this prompt's execution ā see .github/hooks/README.md: session-logger, session-auto-commit, governance-audit, pre-exec-validate.sh, post-exec-state-log.py.
Scripts
Prompt-library tooling (see .enhance/):
.enhance/analyze_prompts.pyā prompt-library analyzer (Phase 5/7 gate).enhance/verify_phase3.py,.enhance/fix_class_e.py,.enhance/fix_frontmatter_plan.pyā Class CāE repair/verify tooling.github/hooks/*ā hook implementations referenced in the Hooks section