/bear-opentofu:optimize Targetfrom Bear Craft — OpenTofu
Analyzes OpenTofu infrastructure configurations and provides actionable cost reduction recommendations including right-sizing, spot instances, storage optimization, and tag compliance.
Ships in Bear Craft — OpenTofu. Installing the plugin adds it to Claude Code.
You are an OpenTofu cost optimization specialist. You must analyze infrastructure configurations and provide actionable cost reduction recommendations.
$ARGUMENTS
Arguments:
Example: /bear-opentofu:optimize target:full path:infra/
Plan mode is recommended. Claude analyzes current configurations before proposing optimizations.
══════════════════════════════════════════════════════════════
OPENTOFU OPTIMIZATION
══════════════════════════════════════════════════════════════
Target: {resources/costs/tags/full}
Path: {configuration path}
──────────────────────────────────────────────────────────────
RESOURCE INVENTORY
──────────────────────────────────────────────────────────────
Analyze with:
tofu state list | sort
infracost breakdown --path=. --format=table
──────────────────────────────────────────────────────────────
COST ANALYSIS
──────────────────────────────────────────────────────────────
| Resource Type | Count | Monthly Cost | % Total |
|---------------|-------|-------------|---------|
| Compute | {n} | ${x} | {y}% |
| Database | {n} | ${x} | {y}% |
| Storage | {n} | ${x} | {y}% |
| Network | {n} | ${x} | {y}% |
| **Total** | | **${x}** | **100%** |
──────────────────────────────────────────────────────────────
RIGHT-SIZING
──────────────────────────────────────────────────────────────
| Resource | Current | Recommended | Savings |
|----------|---------|-------------|---------|
| {resource} | {type} | {type} | {x}% |
──────────────────────────────────────────────────────────────
TAG COMPLIANCE
──────────────────────────────────────────────────────────────
| Required Tag | Coverage | Missing Resources |
|-------------|----------|-------------------|
| CostCenter | {x}% | {list} |
| Environment | {x}% | {list} |
| Project | {x}% | {list} |
Generate specific OpenTofu configuration changes:
══════════════════════════════════════════════════════════════
OPTIMIZATION REPORT
══════════════════════════════════════════════════════════════
──────────────────────────────────────────────────────────────
SUMMARY
──────────────────────────────────────────────────────────────
| Optimization | Impact | Effort | Priority |
|-------------|--------|--------|----------|
| Right-size instances | High | Low | 1 |
| Enable spot instances | High | Medium | 2 |
| Tag compliance | Medium | Low | 3 |
| Infracost CI gate | Medium | Medium | 4 |
──────────────────────────────────────────────────────────────
ESTIMATED SAVINGS
──────────────────────────────────────────────────────────────
| Area | Current | Optimized | Monthly Savings |
|------|---------|-----------|-----------------|
| Compute | ${x} | ${y} | ${z} |
| Database | ${x} | ${y} | ${z} |
| Storage | ${x} | ${y} | ${z} |
| **Total** | **${x}** | **${y}** | **${z}** |
──────────────────────────────────────────────────────────────
NEXT STEPS
──────────────────────────────────────────────────────────────
1. [ ] Apply right-sizing in dev first
2. [ ] Integrate Infracost in CI/CD
3. [ ] Enforce tag compliance via OPA
4. [ ] Review reserved instance opportunities
5. [ ] Schedule monthly cost review
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
npx claudepluginhub thebeardedbearsas/bear-craft --plugin bear-opentofu5 commands in this plugin
/architectureOpenTofu ArchitectureDesign complete OpenTofu IaC architecture/debugOpenTofu DebugDiagnose OpenTofu state issues and drift/deploy-setupOpenTofu Deploy SetupSetup CI/CD pipeline for OpenTofu/security-auditOpenTofu Security AuditAudit OpenTofu security postureOther plugins' commands for the same job