From infracost
Install or update the Infracost CLI. Use this skill when the user asks to install, update, or upgrade Infracost, or when the CLI is missing from the system.
npx claudepluginhub infracost/agent-skills --plugin infracostThis skill is limited to using the following tools:
Download and install the latest Infracost CLI binary from GitHub releases (`infracost/cli`).
Validates IaC using Terraform, CloudFormation, Pulumi, CDK: runs validation, security policy checks, Infracost cost estimation, and drift detection. Activates on terraform plan or infrastructure review.
Audits cloud infrastructure costs from IaC like Terraform/Pulumi and configs, runs Infracost/AWS Cost Explorer/GCP Billing scanners, produces prioritized optimization plan with changes and savings estimates.
Generates, debugs, and manages Terraform infrastructure code for AWS (6.0), AzureRM (4.x), and GCP providers. Handles version upgrades (1.10+), security scanning, Stacks, and policy-as-code.
Share bugs, ideas, or general feedback.
Download and install the latest Infracost CLI binary from GitHub releases (infracost/cli).
The binary is called infracost-preview.
If infracost-preview is already on the PATH, check the installed version:
infracost-preview --version
If the command is not found, proceed to step 2.
Query the latest release tag from infracost/cli. Important: The repository also contains plugin releases tagged like infracost-parser-plugin/v0.1.0 or infracost-provider-plugin-aws/v0.1.0 — these must be ignored. Only consider releases with tags matching v* (a plain version tag).
Using gh (preferred):
gh release list --repo infracost/cli --limit 20 --json tagName --jq '[.[] | select(.tagName | test("^v[0-9]"))][0].tagName'
Fallback using curl:
curl -sL \
https://api.github.com/repos/infracost/cli/releases?per_page=20 \
| grep '"tag_name"' | sed 's/.*"tag_name": *"//;s/".*//' | grep '^v[0-9]' | head -1
The tag format is v2.0.0. Derive the version number by stripping the v prefix (e.g., 2.0.0).
If infracost-preview is already installed and the installed version matches the latest version, inform the user that it is already up to date and stop.
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
case "$ARCH" in
x86_64) ARCH="amd64" ;;
aarch64|arm64) ARCH="arm64" ;;
esac
On Windows (where uname may not be available or returns MINGW/MSYS/CYGWIN), set OS=windows. You can also detect Windows via the OS environment variable ($env:OS -eq "Windows_NT" in PowerShell).
Construct the asset filename:
infracost-preview_${VERSION}_${OS}_${ARCH}.tar.gzinfracost-preview_${VERSION}_windows_${ARCH}.zipFor example: infracost-preview_2.0.0_darwin_arm64.tar.gz or infracost-preview_2.0.0_windows_amd64.zip
Download the release asset to a temporary directory (/tmp on Linux/macOS, $TEMP on Windows).
Determine the asset name using the filename constructed in step 4 (.tar.gz for Linux/macOS, .zip for Windows).
Using gh (preferred):
gh release download "$TAG" \
--repo infracost/cli \
--pattern "$ASSET_NAME" \
--dir /tmp
Fallback using curl:
curl -sL \
"https://github.com/infracost/cli/releases/download/${TAG}/${ASSET_NAME}" \
-o "/tmp/${ASSET_NAME}"
tar -xzf "/tmp/${ASSET_NAME}" -C /tmp
chmod +x /tmp/infracost-preview
mv /tmp/infracost-preview /usr/local/bin/infracost-preview
If mv fails with a permission error, retry with sudo:
sudo mv /tmp/infracost-preview /usr/local/bin/infracost-preview
Expand-Archive -Path "$env:TEMP\$ASSET_NAME" -DestinationPath "$env:TEMP\infracost-preview" -Force
Move-Item -Path "$env:TEMP\infracost-preview\infracost-preview.exe" -Destination "$env:LOCALAPPDATA\Microsoft\WindowsApps\infracost-preview.exe" -Force
If WindowsApps is not on the PATH, move the binary to another directory that is on the PATH, or add the chosen directory to the PATH.
Remove the downloaded archive:
rm -f "/tmp/${ASSET_NAME}"
Confirm the installation succeeded:
infracost-preview --version
The output should match the version that was just installed.
/usr/local/bin: Retry the mv with sudo. If that also fails, inform the user they need to grant write access or run with elevated privileges.linux, darwin, or windows, or the architecture is unsupported, inform the user and point them to the releases page at https://github.com/infracost/cli/releases.