Command Palette

Search for a command to run...

Назад к скиллам
скилл № 22777

iac-generation

Ensures cost optimization and FinOps/tagging policy compliance for infrastructure as code. BLOCKING REQUIREMENT - Invoke this skill BEFORE generating any IaC…

БесплатноБез исполняемых скриптов
infracostот infracost★ 15 звёзд на GitHub

Установить iac-generation в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Infracost IaC Generation Assistance

Assists when creating or modifying infrastructure as code (IaC) to ensure best practices are followed and costs are optimized from the start. Uses Infracost to analyze code as it's being written, providing real-time feedback on cost implications and optimization recommendations.

The output includes actionable insights: more cost-effective resource types, savings opportunities, FinOps policy violations flagged before deploy, and guidance on the user's organization's guidelines (tagging policies, required resource configurations) so problems are caught early rather than during code review.

Directly supported IaC types: Terraform, CloudFormation, Terragrunt. CDK is not yet directly supported.

Other IaC languages are also indirectly supported if you convert the resource definitions to Terraform (written to a temporary directory) and then scan that directory.

Invoking capabilities

This skill uses Infracost capabilities (list policies / guardrails / budgets, price, scan, and the inspect drill-ins). Each 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.

Before generating IaC, 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. On an authentication error, have the user run infracost auth login in a separate terminal, 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.

Capabilities you'll use

Five capabilities matter for this workflow:

  1. list policies — all FinOps + tagging policies for the user's organization, so we can write compliant code from the start.
  2. list guardrails — cost guardrails (spending thresholds) configured for the repository, so we can keep the generated infrastructure within budget.
  3. list budgets — tag-scoped budgets for the organization, so we can see which tag groups are already near or over their actual cloud spend limits.
  4. price — price a small, standalone piece of Terraform without committing it to the repo. Use for fast feedback while iterating on individual resources.
  5. scan — analyze an IaC directory and return costs, diagnostics, and policy violations. Use once you have a complete set of files.

Workflow

When writing or modifying IaC, follow this order:

1. Establish org context

Before generating any code, use the three "what's the org configured?" capabilities so the generated infrastructure is compliant by construction:

  • list policies — FinOps and tagging policies. For tagging policies with requirements, note any mandatory tags and the allowed_values lists. If a tagging policy allows a list of acceptable values (or no specific value) and you're not sure which to pick, ask the user. E.g., if a policy requires cost_center ∈ {engineering, marketing}, ask which one to apply.
  • list guardrails for the repo path — note the thresholds (total_threshold / increase_threshold / increase_percent_threshold) and the actions (pr_comment / block_pr). A block_pr action means the threshold is a hard constraint — the generated infrastructure must stay under it. Soft constraints (alert / PR comment only) become warnings to surface.
  • list budgets — every tag-scoped budget. If the resources you're about to create would match an existing budget's tag scope (env=production, team=frontend, etc.), note where that budget currently sits versus its amount. Budgets reflect actual org-wide cloud billing, not the preview — treat them as context for the user, not a hard constraint on the code.

Narrow the policies call when you know the provider (e.g. providers = aws) to skip downloading provider plugins for clouds you're not touching.

2. Iterate quickly with price

While drafting resources, use the price capability with a small Terraform snippet to get a cost on what you've written so far. This is faster than writing the whole file and scanning — useful for choosing between two configurations:

provider "aws" { region = "us-east-1" }

resource "aws_instance" "web" {
  instance_type = "m5.xlarge"
  root_block_device {
    volume_size = 100
    volume_type = "gp3"
  }
}

The result includes per-resource cost component

Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл iac-generation?

Ensures 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.

Как установить скилл iac-generation?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл iac-generation запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить iac-generation с