/infracost:fix-findingsfrom infracost
Walks users through Infracost FinOps findings and applies fixes locally or via PRs/tickets using MCP tools. Use when acting on cost recommendations.
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.
Findings are org-scoped FinOps investigation results produced by Infracost's
Agents service. Each finding groups one or more tasks — the units of fix
work. A task carries an action_description, often a code snippet, and a
suggested_action of open_pr, create_ticket, or manual.
This skill drives the user through the findings list, lets them pick what to work on, and then helps them apply each fix — either by editing files in their local repository or by asking Agents to draft and open a PR / ticket via the mutation tools.
This plugin ships an MCP server (infracost mcp) that's started automatically
when the plugin loads. Every Infracost operation in this skill is an MCP tool
call.
Infracost Agents (the service that produces findings) is in early access
and enabled per-organization. The findings tools — findings_list,
findings_get, preview_fix, create_fix, update_task_status,
update_finding_status, and retry_action — are always present in the MCP
server, but they only return data for organizations that have Agents switched
on.
You don't need to pre-check anything. If the active org isn't enabled, the first findings tool you call returns an early-access error instead of data — something like:
this organization doesn't have Infracost Agents enabled yet — it's currently in early access. Join the waitlist at
https://dashboard.infracost.io/org/<org>/agents, or contact the Infracost team to get set up.
When you get that error, stop and relay it to the user verbatim (including the waitlist link). Don't retry the call or try to work around it — the organization simply needs to be switched on. Otherwise, continue with the workflow below.
| Tool | Side effect | Purpose |
|---|---|---|
findings_list | none | Page through findings for the active org |
findings_get | none | Full finding + nested tasks, actions, events |
preview_fix | none | Ask Agents to draft a PR or ticket for a task |
create_fix | destructive | Submit a drafted PR/ticket action |
update_task_status | destructive | Report what you did to a task. confirm = you did Agents' suggested change; correct = you did something different (requires reason); dismiss = you decided not to do the task (reason recommended). The three verbs feed different learning signals — pick by user intent, not for convenience |
update_finding_status | destructive | Set a whole finding's status: open / resolved / dismissed. A dismissal with a reason emits an AgentLearning so the finding isn't re-raised |
retry_action | destructive | Re-queue a Agents action whose worker landed in failed state |
Auth and the active organization are resolved lazily on the first tool call — not at startup — so failures come back as readable tool errors rather than a dropped MCP connection. On an authentication error, have the user run 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. Relay these actionable messages to the user — don't retry blindly.
Dismissing an individual action (i.e. killing a draft PR before the worker runs) only lives in the Agents portal at https://dashboard.infracost.io/org/<org>/agents. This is intentional: closing a real PR or archiving a real ticket should happen with the user looking at the upstream artifact. If the user wants to dismiss an action (not a task), point them to the dashboard.
The flow is always: list → pick → drill in → check who already owns the task → choose how to fix → apply → report back to Agents. Don't skip steps; the user needs to see what's available and consent to each action. The final "report back" step tells Agents what you did so its observation cascade can verify and close the task asynchronously. You're not verifying the change yourself — don't re-scan to second-guess Agents — you're just signalling what action was taken so Agents knows to look.
findings_list()
Useful inputs:
status — open (default; matches both open and in_progress) is the right choice when the user wants to act on outstanding work. resolved / dismissed / duplicate are for history.effort — trivial / small / medium / large to narrow by how much work is involved.limit — caps page size (server defaults to 50, max 200). cursor pages.The output carries findings[], total_yearly_savings (page total — not org total), next_cursor, and has_next_page. Each finding row has id, title, summary, effort, status, estimatedYearlySavings, and taskTotal. All savings figures are per year — quote them as $X/yr, matching the Infracost dashboard.
Don't dump raw JSON. Present a numbered list, sorted by estimatedYearlySavings desc, and offer to drill in:
You have 6 open findings worth ~$14,880/yr in potential savings:
- Idle EBS volumes — $5,040/yr, 3 tasks, small effort (
f-abc)- Oversized RDS instances — $3,720/yr, 2 tasks, medium effort (
f-def)- Untagged production resources — $3,120/yr, 12 tasks, trivial effort (
f-ghi)- …
Which one would you like to start with?
If has_next_page is true, mention it and offer to page (findings_list(cursor="...")) — don't auto-fetch.
findings_get(id="f-abc")
This returns the finding header plus every nested task with full action_description, code, suggested_action, effort, yearlySavings, plus any existing actions and timeline events. Read this carefully — the task body tells you whether each task is locally fixable.
Present the tasks under the finding, again numbered, with savings and a one-line summary. If a task has a clear code snippet that looks like a diff or a drop-in replacement, mention that — it's the signal for Path A below.
Before doing any work on a task, look at the data in the findings_get response to confirm it isn't already in flight:
task.status — anything other than open means somebody (or something) has already started. The common non-open values are in_progress (Agents worker is opening a PR / creating a ticket), awaiting_resolution (someone marked it done and the next scan will verify it), resolved, and dismissed.finding.actions[] — find any action whose task_ids includes the current task and whose action_status is not in the terminal set (done / merged / deployed / verified / failed / cancelled / dismissed). A draft or open action linked to the task means it's claimed.If the task is claimed:
Tell the user, surface the existing
action_id+type+action_status, and direct them to the Agents portal athttps://dashboard.infracost.io/org/<org>/agentsto dismiss or close the existing action before working on the task themselves. Do not try to dismiss the action via MCP — that capability lives in the portal on purpose.
If the task is open and has no non-terminal linked action, you can move on to step 5.
There are three paths. Pick one — don't run more than one for the same task.
Choose this when all of the following hold:
action_description and/or code describe a concrete code change.If the user makes the change themselves outside this repo (cloud console, CLI, another repo), skip to step 4 once they say it's done.
How to do it:
Locate the target file(s). The task's action_description usually names them; if not, grep the user's repo for the resource address or distinctive attribute the snippet touches.
Show the user the proposed edit before you make it — quote the relevant lines and explain the change. This is the point at which the user can redirect: maybe Agents' suggestion isn't the right call and they want to make a different change instead. If that conversation happens, follow what the user decides — your job is to report what was done, not to defend Agents' original suggestion.
Apply the edit with the standard file-editing tools.
Report what you did to Agents. You're signalling what action was taken, not judging whether it worked — Agents' observation cascade verifies and resolves the task asynchronously. Don't re-scan locally to second-guess the cascade.
The verb depends on the user's intent. If the user redirected you mid-edit (e.g. "actually, let's do X instead"), follow the conversation: ask what they want to do, then pick the verb that matches.
action_description / code snippet) → update_task_status(task_id="t-1", status="confirm"). Marks the task done, the same as Mark as done in the Agents portal, and the next scan verifies it. No reason needed, and no create_fix call is needed first.update_task_status(task_id="t-1", status="correct", reason="<what you did instead>"). Agents records the reason as the task's dismissed_reason, dismisses any draft/open action linked to it, and emits an AgentLearning(source=correction) so the agent learns the user's preferred approach. Reason is required — the learning is useless without it.update_task_status. The task stays open.update_task_status(task_id="t-1", status="dismiss", reason="<why>").The verb difference matters: correct and dismiss both end the task as dismissed, but they emit different learning signals (correction vs task_dismissed). Don't use correct for a no-op decline — that mis-trains the agent into thinking the user took an alternative action.
Report back: what file(s) changed, the before/after diff for the lines you touched, and which update_task_status verb (if any) you sent. Don't claim Agents verified the fix — the cascade hasn't run yet at the moment you're reporting; the user will see that resolution land asynchronously.
Choose this when any of the following hold:
code is empty or too abstract to drop in directly.suggested_action is create_ticket — Agents knows the right ticketing integration to use.How to do it:
Draft the action without creating it:
preview_fix(finding_id="f-abc", task_id="t-1", type="open_pr")
Use type="create_ticket" for ticket-shaped tasks. Neither preview_fix nor create_fix accepts type="manual" — a manual fix has no action to draft or create. For those, switch to Path A, which ends with update_task_status(status="confirm").
Show the user the draft. The tool returns {type, config}. Surface the relevant fields — for an open_pr config that's typically the PR title, target branch, body summary, and files touched; for a create_ticket config it's the ticket title, team, description. Do not submit anything yet.
Ask whether they want to edit anything. Common edits: PR title, target branch, ticket assignee. If they want changes, hold the config value and update the relevant fields before passing it to create_fix.
Only on explicit confirmation, submit:
create_fix(
finding_id="f-abc",
task_id="t-1",
type="<the type from preview_fix>",
config=<the (possibly-edited) config from preview_fix>,
)
This is destructive — it creates a real PR or ticket against the connected integration. The MCP host should prompt for confirmation (the tool is marked destructiveHint), but that's a backstop, not a substitute for showing the diff yourself.
Agents handles the post-action transitions automatically. create_fix moves the task to in_progress; when the PR merges (or the ticket closes), Agents' webhooks advance the action and the observation cascade resolves the task. You don't need to call update_task_status after a successful Path B.
The exception is recovery: if the action ends up in failed state (the worker errored opening the PR / creating the ticket), see Recovering from a failed action.
Report the new action_id and, if Agents surfaced one, the PR URL.
Choose this when the user reads the task or finding and decides not to do it: a false positive, a business decision to keep the current config, scope drift, etc. Always ask for a reason — Agents turns the reason into an AgentLearning so the same suggestion doesn't come back on the next scan.
Two scopes:
Per-task — update_task_status(task_id="t-1", status="dismiss", reason="<why>"). Dismisses just this task and cascade-dismisses any draft/open actions linked to it. Emits a learning with source task_dismissed. Use when only one task on the finding is off-base but the others are still worth doing.
Important: do not use status=correct for this case. correct is for "the user did something different"; dismiss is for "the user declined". They feed different learning signals.
Per-finding — update_finding_status(id="f-abc", status="dismissed", reason="<why>"). Dismisses the whole finding and cascades dismissal to every task and linked action under it. Emits a learning with source finding_dismissed. Use when the entire investigation is off-base.
If the user can't articulate a reason, push back ("would it help to leave it open and revisit later?") rather than dismissing blindly — a dismissal without a reason still flips the status, but the agent learns nothing and may re-raise an equivalent finding on the next scan.
After each task, ask whether they want to do another from the same finding, jump to a different finding, or stop. Don't auto-advance — making cost changes is high-stakes and pace matters.
If every task under a finding has been resolved or dismissed, Agents' status-derivation rolls the finding's own status up automatically — you usually don't need to call update_finding_status for the resolved case. The explicit call is for dismissals, reopens, or when the user wants to force the state ahead of the cascade.
If a Agents action lands in action_status: failed — typically a Path B PR worker that hit a 500 trying to push the branch or open the PR — re-fetch the finding to confirm the failure and surface what Agents captured:
findings_get(id="f-abc")
Look at the action's result blob for the error message Agents recorded. If it's transient (rate limit, network blip), offer the retry:
retry_action(action_id="a-1")
This re-publishes the same action config to the worker queue with no edits. Don't auto-retry on first failure — tell the user what failed and only retry on their confirmation. If the failure is structural (bad config, missing integration permission), retrying won't help: surface the message and ask the user how they want to proceed (edit the integration, dismiss the action via the portal, switch to Path A, etc.).
Use the table below as a starting heuristic — but always read the task and ask the user what they want.
| Signal | Path A (local) | Path B (PR/ticket) | Path C (decline) |
|---|---|---|---|
code is a clear diff or replacement snippet | ✅ | also OK | |
action_description names a file path you can find | ✅ | also OK | |
| Resource address resolves to a file in the user's working dir | ✅ | also OK | |
suggested_action is create_ticket | ❌ | ✅ (ticket) | |
| Change is cross-repo or requires cloud console action | ✅ (user does it, then confirm) | ✅ (ticket) | |
Task code is empty or vague | ❌ | ✅ | |
| User explicitly wants a PR to review and merge | ❌ | ✅ (open_pr) | |
| User wants a quick experimental change to validate locally first | ✅ | ❌ | |
| User reads the task and says "we don't want to do this" | ✅ (per-task) | ||
| User reads the finding and says "this whole investigation is off" | ✅ (per-finding) |
When you're not sure between A and B, default to Path B. A Agents-drafted PR is lower-risk than silently editing their files because it leaves a reviewable artifact and a Agents action you can later inspect.
Path C should never be the default — confirm with the user that they're sure they want to decline, and capture a reason for the AgentLearning.
$X/yr everywhere, matching the dashboard.main.tf".estimatedYearlySavings is an estimate; for local fixes, a follow-up scan + inspect_policy_detail is what confirms the change actually moved the needle.create_fix without explicit user confirmation on the specific draft you're about to submit.create_fix calls in a single confirmation — each PR / ticket is a separate decision.findings_list shows nothing matching, say so — never make up an id to keep the conversation moving.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub infracost/agent-skills --plugin infracost4 skills in this plugin
/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./infracost-scanAnalyze infrastructure as code (IaC) projects to estimate cloud costs, identify savings opportunities, and flag FinOps policy violations. This skill should be used when asking about the cost of a cloud project, how to optimize costs, or when there are specific questions about FinOps policies or tagging compliance in an IaC codebase. The skill uses Infracost (via its MCP server when available, otherwise the Infracost CLI) to perform the analysis. The output is a detailed cost report that highlights key insights and recommendations for cost optimization.Other plugins' skills for the same job