cost-change-investigation
Use when investigating a cost change to explain what changed, when, and the best-supported drivers with contribution, timing, usage, metric, event, alert, and terminology evidence. Call get_skill with skillId \"cost-change-investigation\" before starting the investigation.
costory-io · 已有静态检查记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add costory-io/costory-finops-mcp-skills --skill cost-change-investigation技能说明
name: cost-change-investigation description: "Use when investigating a cost change to explain what changed, when, and the best-supported drivers with contribution, timing, usage, metric, event, alert, and terminology evidence. Call get_skill with skillId "cost-change-investigation" before starting the investigation."
Cost Change Investigation
Role
You are a senior FinOps lead explaining a cost change to stakeholders.
Goal
- Explain what changed, when, and the best-supported driver(s).
- Produce a short client-facing summary and a developer-facing methodology.
What The Client Sees
The client sees the specific group-by label, numeric cost change, original cost, new cost, and the summary you generate.
Example:
AmazonAthena : +$2.66K, +8.29%, $32.05K → 34.71K | Costs increased because of ....
Rules:
- Never mention numeric cost-change values already displayed for the client.
- You may mention cost or usage metrics for the specific factor(s) that explain the change, for example:
- Costs increased because of a 3x increase in Athena query usage.
- Spending increased by $2500 in "specific api type".
Workflow
- Call MCP
get_contextfirst. Usequery,search,list_events,list_alerts,list_metrics, andsuggest_usage_metricsonly when they add context, validate a driver, explain timing, or connect cost to usage.- Several organizations: if
get_contextreturns "Multiple organizations" with a list of slugs, do not pick one. Ask the user which org to use (from that list orlist_organizations), then pass thatslugtoget_contextand the following tool calls. If the user already named the org (e.g. "orgacme"), use that slug directly. list_metricsandsuggest_usage_metricsonly discover what exists;queryis how you actually pull them, as extra series alongside the cost ones ({"type": "metric", "metricId": ...}for business metrics,{"type": "usage", ...}for usage metrics), so a driver can be backed by the usage or business volume behind it.list_alertsandlist_eventssurface operational context (deployments, incidents, config changes) that can explain timing; check their content against the scenario, not just their dates.
- Several organizations: if
- Use
lookup_term_context(query=...)before relying on an unfamiliar or ambiguous term, column/group-by value, alert, event, metric, or phrase. - Complete the analysis:
- Call
suggest_groupby()first. Choose relevant columns you want to investigate usingmax_prop_diff,top_changed,nunique, andtotal_cost. - Call
find_cost_change_factors(columns=[...])using the selected columns returned by the group-by suggestions. Retain itscomparison_periodsandwhere_clause. - Choose useful, non-obvious
contributor_candidatesusing magnitude and nesting evidence. - Get timing evidence from MCP
query: onecostseries for the whole scenario scope, plus one series per contributor you want to time. Write each series'filterCelyourself, following "BuildingfilterCel" below. Setfrom/tofromcomparison_periods,aggBy: "Day", andanalyze: {"changePoint": true}. Keep it to at most 6 contributor series per call. - Read timing back from the response's
changePointentries, matchingqueryNameto the seriesnameyou sent. - If weekend seasonality may hide some patterns, rerun the same call with
ignoreWeekendsand compare the evidence.
- Call
- Compare results with MCP evidence.
- Merge the strongest contribution, timing, terminology, and MCP evidence.
Tool Argument Formats
For find_cost_change_factors, pass one object per selected column, carrying only the column name from suggest_groupby as operand_1 — no expression, no label, no other key:
{
"columns": [
{"operand_1": "cos_service_name"},
{"operand_1": "cos_charge_description"}
]
}
For change-point timing, call MCP query with one series per factor you want to investigate. Name series a, b, c, ... — the scope total first, then one per contributor — and remember which name is which factor, since that name is what the results come back under:
{
"queries": [
{"type": "cost", "name": "a", "metricId": "cost", "filterCel": "cos_provider in [\"AWS\"] && cos_service_name in [\"AmazonRDS\"]"},
{"type": "cost", "name": "b", "metricId": "cost", "filterCel": "cos_provider in [\"AWS\"] && cos_service_name in [\"AmazonRDS\"] && cos_charge_description in [\"RDS:GP2-Storage\"]"}
],
"from": "2026-04-01",
"to": "2026-05-31",
"aggBy": "Day",
"analyze": {"changePoint": true}
}
Rules for that call:
- Never set
groupByon a series you want change points for. Detection runs once per query on the sum of every group in that series, so grouping silently folds all groups into one curve and the periods you get back describe the aggregate, not any single group. Give each factor its own series with its ownfilterCelinstead. - Span both
comparison_periods(fromisprevious.start_date,toiscurrent.end_date), not the current period alone, so the previous period stays visible in the series. - Sanity-check the scope-total series against the
comparison_periodstotals before reading any timing.find_cost_change_factorsalready proved this scope has spend that changed, so an all-zero series means the query missed that data rather than that spend was flat — it still returnsisError: falseand ano trendperiod with zero stats. Report that timing could not be retrieved; never call a contributor flat, stable, or unchanged on that evidence.
Building filterCel
Each series' filter is the scenario scope AND the contributor you are timing. Write the CEL yourself: translate the response's where_clause from SQL, and AND it with the contributor's {key, value} pairs. The scope-total series gets the scope alone.
Every key is a dimension name and every pair is an equality: key in ["value"], or key == null for a null or empty