Agent Skill · Infracost

infracost-price-lookup

Look up cloud resource pricing by generating sample Terraform and running Infracost against it. 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.

Provider: Infracost Path in repo: plugins/infracost/skills/price-lookup/SKILL.md

Skill body

Price Lookup

Look up cloud resource pricing without needing existing infrastructure code. Supports any resource type that Terraform and Infracost support across AWS, GCP, and Azure.

Setup

Important: Verify the Infracost CLI is installed and the user is authenticated before running any price lookups.

  1. Check the CLI is on the path:

    infracost --version
    

    If this fails, inform the user that they need to install the Infracost CLI by following the instructions at https://www.infracost.io/docs/features/get_started/.

  2. Check the user is logged in:

    infracost auth whoami
    

    If this reports that the user is not authenticated, ask them to run infracost auth login in a separate terminal window and let you know once it completes. Do not attempt to run the login command yourself — it is interactive.

Workflow

1. Run Infracost

Pipe the Terraform configuration directly into infracost price. This command reads Terraform from stdin, analyzes it, and prints a human-readable cost summary to stdout, followed by suggested inspect commands for drilling deeper. Temporary files are created and cleaned up automatically.

Pass the global --json flag if you need the raw JSON output instead — for example, when piping into another tool. The same --json flag also switches log output to JSON and works on scan and inspect.

infracost price << 'EOF'
provider "aws" {
  region = "us-east-1"
}

resource "aws_instance" "example" {
  ami           = "ami-0c55b159cbfafe1f0"
  instance_type = "m5.xlarge"

  root_block_device {
    volume_size = 100
    volume_type = "gp3"
  }
}
EOF

Rules for writing the Terraform:

Currency: If the user requests pricing in a non-USD currency, set the INFRACOST_CLI_CURRENCY environment variable when running the command. For example:

INFRACOST_CLI_CURRENCY=EUR infracost price << 'EOF'
...
EOF

Use standard ISO 4217 currency codes (e.g., EUR, GBP, JPY, CAD, AUD). If the user doesn’t specify a currency, default to USD.

2. Inspect the results

price already prints a summary, but you can drill in further with inspect. Results are cached, so you don’t need to redirect output or pass --file.

# Summary overview (same shape as the default price output)
infracost inspect --summary

# Detailed cost breakdown, hiding free resources
infracost inspect --costs-only

# Top expensive resources
infracost inspect --top 5

# Every resource sorted by cost (no row limit)
infracost inspect --group-by resource

Presenting Results

Present pricing in a clear, structured way:

Example presentation

AWS RDS MySQL — db.r5.xlarge, 100GB gp3 Region: us-east-1

Component Monthly Cost
Instance (on-demand) $365.00
Storage (100GB gp3) $11.50
Total $376.50

Usage-based costs (estimated):

  • I/O requests: ~$X/mo based on typical usage

Savings opportunity: Consider Graviton (db.r6g.xlarge) for ~20% savings (~$73/mo).

Important Guidelines

Skill frontmatter

allowed-tools: Bash(infracost*)