/infracost:infracost-scanfrom infracost
Estimates cloud costs from Terraform, CloudFormation, and Terragrunt projects using Infracost. Identifies savings opportunities and FinOps policy violations.
Ships in infracost. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Analyze infrastructure as code (IaC) projects to estimate cloud costs, identify savings opportunities, and flag FinOps policy violations.
Supported IaC types: Terraform, CloudFormation, Terragrunt. CDK is not yet directly supported.
This skill is written in terms of capabilities (e.g. "scan a path", "get the summary", "drill
into a failing policy"). Each capability has two bindings — a typed MCP tool call and an
infracost … CLI command — listed in BINDINGS.md.
Rule: if the Infracost MCP server is available, use its tools; otherwise run the equivalent CLI command from BINDINGS.md. The Claude Code plugin starts the MCP server automatically, so on Claude Code/Cursor you use the tools. On agents that run shell commands (GitLab Duo, Gemini CLI) you use the CLI binding. Either way, the workflow below is identical.
Before any analysis, satisfy the three preflight capabilities (see BINDINGS.md): the CLI is
present, the user is authenticated, and an organization is selected. With MCP these are resolved on
the first tool call (failures come back as readable errors, not a dropped connection); with the CLI,
check them inline. Never run infracost auth login — it is interactive.
Use the scan capability with the absolute path to the IaC directory.
It returns a currency field and a summary block — the same headline numbers the CLI's "Scan
Summary" box prints to a human: project count, resource counts (total / costed / free), monthly
cost, per-policy and per-domain failing counts, diagnostic counts, and a per-project breakdown.
A scan does not return per-resource detail. That's intentional — drill in via the inspect capabilities when you need it (see step 3).
The scan result is cached under the scanned path. Subsequent inspect operations read the most recent scan by default; target a specific previously-scanned directory by passing its path.
There is no cache until a scan has run, so run scan on the path before any inspect or diff capability — don't call them first and wait for the error.
Optional: a currency (ISO 4217 code — USD, EUR, GBP, …). Defaults to the org-configured currency.
The summary block answers most "how many X?" and "what's the total Y?" questions without further calls:
monthly_cost, total_yearly_savings (costs are per month; savings are always per year — quote them as $X/yr)resources, costed_resources, free_resourcesfinops_policies, failing_policies, distinct_failing_finops_resourcestagging_policies, failing_tagging_policies, distinct_failing_tagging_resourcesguardrails, triggered_guardrailsbudgets, over_budgetcritical_diagnostics, warning_diagnosticsproject_details[] — one row per project with name, path, monthly cost, per-policy counts, and a has_errors flagWhen you need more than the headline, reach for one of the inspect capabilities.
The cached scan is read by every inspect capability. Each can target a specific scan by path; omit
it to use the latest. Filter inputs (project, provider, filter, costs_only) compose across
the views.
| Question | Capability | Notable inputs |
|---|---|---|
| Everything that's currently failing (failing policies + triggered guardrails + over-budget items) | everything currently failing | project, provider, filter |
| Top N savings opportunities sorted by yearly_savings | top N savings | n (default 10), filter inputs |
| List resources matching predicates (missing tag, invalid tag, cost band) | list resources by predicate | missing_tag, invalid_tag, min_cost, max_cost, resource, filter inputs |
| Group / aggregate resources by dimension | aggregate resources by dimension | group_by (e.g. type, policy,type, budget), top |
| Per-project diagnostic messages (parse errors, missing vars, …) | per-project diagnostics | project, critical_only |
| Failing-resource detail for one FinOps or tagging policy | policy detail | policy (name or slug), resource (narrows to one address) |
| Per-resource detail for a specific budget — matching resources + savings | budget detail | budget (name or id) |
| Status + monthly cost for one guardrail | guardrail detail | guardrail (name or id) |
Listing resources switches modes on group_by:
group_by): one row per resource matching the predicate filters. Resource-shaped predicates (missing_tag, invalid_tag, min_cost, max_cost) only apply here.group_by set): one row per aggregation key. Valid dimensions: type, provider, project, file, resource, policy, budget, guardrail. top only applies here.Compatibility rules (validated up front):
policy, guardrail, and budget are pairwise mutually exclusive in a single grouping.guardrail and budget can't combine with resource-context dims (type, provider, project, resource, file) — those rows have no resource context.policy can combine with resource-context dims (e.g. group_by=policy,type).Always start with the summary, then offer to drill deeper. The natural progression:
summary and summary.project_details. If failing_policies > 0, list which policies are failing.When presenting results, always offer the user a list of policies or resources they can drill into next:
You have 3 failing FinOps policies. Would you like to drill into one?
- Use GP3 — 2 failing resources
- Use Graviton — 5 failing resources
- Required Tags — 12 failing resources
Important: When the user asks about a specific resource (e.g., "what's wrong with the RDS instance?"), drill down to the resource level with policy detail (policy + resource) and explain what needs to change. Don't just describe the issue — point at the specific attribute and the metadata's file / start_line so the user knows where to look.
When the summary shows triggered guardrails (e.g., triggered_guardrails: 1), drill in:
triggered flag + total_monthly_cost rolled up by the scan.Present triggered guardrails prominently — they may block the PR:
1 guardrail triggered. The total monthly cost of $500 exceeded the "Cost increase > $100" threshold. Would you like to see the detail?
Important context: Budget costs represent actual org-wide cloud spend from cloud billing data — they are NOT computed from the IaC scan and are NOT affected by the changes in the current PR. Budgets are shown because the PR touches resources with matching tags, but the dollar amounts reflect what the org has already spent across all repos and resources with those tags. Do not describe budget costs as "estimated" or imply the PR caused them.
When the summary shows budgets over limit (e.g., over_budget: 1), drill in:
The budget detail view surfaces three things:
Important: The savings shown are estimates from the IaC scan. They may not directly reduce the org-wide budget spend — for example, if the resources are newly created and haven't been deployed yet, or if the savings depend on usage changes. Present savings as "areas to investigate" rather than guaranteed reductions.
Present over-budget items clearly with the dollar amount over:
1 of 3 budgets is relevant to this change (matched by resource tags):
Budget Status Actual Spend Limit Production budget under $500 $1,000 (50% left) Frontend Q2 OVER $400 $300 Backend annual under $200 $5,000 (96% left) Frontend Q2 is $100 over its org-wide budget. Let me drill in for detail…
(drills in with budget detail for "Frontend Q2")
The budget detail shows 3 resources matching
team=frontendtags in this scan. There are also FinOps policy violations on some of these resources (Use GP3: up to $360/yr, Use Graviton: up to $540/yr) — addressing these could help reduce spend over time.Note: Actual spend is based on cloud billing data across the organization. Savings estimates are from the IaC scan and may not directly translate to budget reductions.
When a budget is over, always use budget detail to check for related FinOps violations — they highlight areas where spend on matching resources could potentially be reduced.
Make the output engaging with tables and clear callouts. Tailor depth to complexity — a 3-resource repo gets a concise summary, a 500-resource repo gets a structured breakdown.
To compare cost changes between branches, run two scans against different working trees (use git worktree to create a parallel checkout) and compare the summary blocks each returns. The inspect capabilities can reference each scan separately by path — both stay cached for the lifetime of the session.
# Pseudo-flow:
scan the current branch at /abs/path/to/repo
scan the baseline checkout at /abs/path/to/repo-baseline-worktree
# Compare the two summary.monthly_cost / failing_policies / etc. values.
# Then for each side, optionally get the summary for each path.
Clean up any worktrees you created when you're done.
summary block over recomputing things from summary.project_details[]. The summary already de-dupes failing-resource counts across multiple policies.infracost auth login in a separate terminal (interactive — never run it yourself), then retry. On "no organization selected", the error lists the available org slugs; ask which one to use and have the user run infracost org switch <slug> (add --repo to pin it to this repo), then retry — the running MCP server picks up the selection on its next call. If an operation reports "no scan results available", run scan on that path and retry once; only relay it if the scan itself fails. Relay these actionable errors to the user — don't retry blindly.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub infracost/agent-skills --plugin infracost4 skills in this plugin
/fix-findingsWalk a user through Infracost FinOps findings and apply fixes — either locally in their repo (when the task carries enough context to make a code edit), or by asking Agents to draft and open a PR / ticket on their behalf. Use this skill when the user asks to "fix the findings", "apply the recommendations", "open PRs for the FinOps issues", or otherwise wants to act on Agents' investigation results rather than just look at them./iac-generationEnsures cost optimization and FinOps/tagging policy compliance for infrastructure as code. BLOCKING REQUIREMENT - Invoke this skill BEFORE generating any IaC code, entering plan mode, or asking clarification questions. TRIGGER when: planning or writing code which creates cloud infrastructure resources (regardless of naming a specific tool to do so), imports IaC provider SDKs (pulumi-aws, hashicorp/aws, aws-cdk), or the task involves writing Pulumi, Terraform, CloudFormation, CDK, or Terragrunt. DO NOT TRIGGER when: general programming unrelated to infrastructure provisioning./infracost-price-lookupLook up cloud resource pricing by generating sample Terraform and pricing it with Infracost. Use this skill when the user asks "how much does X cost?" or wants to compare pricing between resource configurations, instance types, regions, or cloud providers. This does not require the user to have any existing infrastructure code.Other plugins' skills for the same job