Analyze costs

From harness/harness-ai · View interactive version

Analyze costs is an AI agent skill from the GitHub repository harness/harness-ai. Analyze cloud costs, find optimization opportunities, and track anomalies using Harness CCM via MCP. Use when user says "cloud costs", "analyze costs", "cost optimization", "reduce spending", "cost report", or asks about cloud bills.

How to use this skill

Skill file

Analyze Costs

Analyze cloud costs and identify savings using Harness Cloud Cost Management (CCM) via MCP.

Instructions

Step 1: Get Cost Overview

Call MCP tool: harness_get
Parameters:
  resource_type: "cost_account_overview"

Returns total spend, provider breakdown, and trend vs previous period.

Step 2: Get Cost Breakdown

Call MCP tool: harness_get
Parameters:
  resource_type: "cost_breakdown"

Multi-dimensional breakdown by service, environment, team, region.

Step 3: Explore Perspectives

Call MCP tool: harness_list
Parameters:
  resource_type: "cost_perspective"

Then get detailed data for a specific perspective:

Call MCP tool: harness_get
Parameters:
  resource_type: "cost_perspective"
  resource_id: "<perspective_id>"

Step 4: Get Cost Trends

Call MCP tool: harness_get
Parameters:
  resource_type: "cost_timeseries"

Step 5: Get Optimization Recommendations

Call MCP tool: harness_list
Parameters:
  resource_type: "cost_recommendation"

For detailed recommendation info:

Call MCP tool: harness_get
Parameters:
  resource_type: "cost_recommendation_detail"
  resource_id: "<recommendation_id>"

Summary statistics:

Call MCP tool: harness_get
Parameters:
  resource_type: "cost_recommendation_stats"

Step 6: Check for Anomalies

Call MCP tool: harness_list
Parameters:
  resource_type: "cost_anomaly"

To dismiss a known anomaly:

Call MCP tool: harness_execute
Parameters:
  resource_type: "cost_anomaly"
  action: "report_feedback"
  resource_id: "<anomaly_id>"
  body: { feedback: "FALSE_ANOMALY" }  # or TRUE_ANOMALY / NOT_RESPONDED

Step 7: Commitment Analysis

Call MCP tool: harness_get
Parameters:
  resource_type: "cost_commitment"

Report Format

## Cloud Cost Analysis

**Period:** Last 30 Days

### Summary
| Provider | Spend | vs Previous |
|----------|-------|-------------|
| AWS      | $X    | +X%         |
| GCP      | $X    | +X%         |
| Azure    | $X    | -X%         |

### Top Recommendations
1. **Rightsize <resource>** - Save $X/month (95% confidence)
2. **Convert to Reserved** - Save $X/month
3. **Delete unused resources** - Save $X/month

### Anomalies
- <date>: <service> spiked $X above expected

### Actions
- [ ] Rightsize instance X
- [ ] Purchase reserved capacity
- [ ] Clean up unused volumes

Cost Resource Types Reference

| Resource Type | Operations | Description |

|--------------|-----------|-------------|

| cost_account_overview | get | Account-level total spend summary |

| cost_summary | get | Perspective-scoped cost summary |

| cost_timeseries | get | Cost trends over time |

| cost_breakdown | get | Multi-dimensional breakdown |

| cost_perspective | list, get | Custom cost views |

| cost_recommendation | list | Optimization suggestions |

| cost_recommendation_detail | get | Detailed recommendation |

| cost_recommendation_stats | get | Summary statistics |

| cost_anomaly | list, get, execute(report_feedback) | Cost spikes |

| cost_anomaly_summary | get | Anomaly aggregate summary |

| cost_category | list, get | Cost allocation |

| cost_commitment | get | Commitment coverage/utilisation/savings |

| cost_filter_value | get | Available filter values |

Examples

Performance Notes

Troubleshooting

No Cost Data

No Recommendations

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.