mcpField
C
cost-check

cost-check

github.com/rshadeCloud & DevOps386 installsUpdated 2w ago
Repository

About cost-check

cost-check is a skill for detecting IaC projects, running a compatible cost tool, and producing a threshold-based cost report. It is intended for infrastructure project reviews and writes results to COST_CHECK.md.

Key features

  1. 01IaC stack and cost-tool detection
  2. 02Threshold-based resource and total flags
  3. 03Comparison with a prior report
  4. 04Terminal summary and COST_CHECK.md report

Use cases

  1. 01Reviewing projected costs for an IaC project
  2. 02Finding resources above configured cost limits
  3. 03Comparing current costs with a previous check

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/rshade/agent-skills --skill cost-check

After installing, type/cost-checkin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
default-thresholds.md
report-template.md
tool-matrix.md
tool-parsers.md

Details

From the project README

Cost Check

Detect the IaC stack in the current directory, run a compatible cost tool, and produce a cost report with flagged items.

Core principle: Orchestrate real cost tools — do not parse IaC files directly or estimate prices manually.

Step 1: Detect IaC stack

Scan the current directory for IaC project files:

ls Pulumi.yaml 2>/dev/null && echo "pulumi: detected"
ls *.tf 2>/dev/null && echo "terraform: detected"

If no IaC files are found, stop and report: "No IaC project detected in this directory."

For the full detection table, see references/tool-matrix.md.

Step 2: Detect cost tool

For each detected IaC stack, check if a compatible cost tool is installed:

command -v finfocus 2>/dev/null && echo "finfocus: available"
command -v infracost 2>/dev/null && echo "infracost: available"

If no compatible tool is found for a detected stack, soft-fail: report which IaC stack was detected and recommend the appropriate tool. Do not prescribe install commands — link to the tool's own documentation. See references/tool-matrix.md for recommendations.

If the only available tool is incompatible with the detected stack (e.g., infracost found but project is Pulumi), treat the same as no tool found.

Step 3: Load thresholds

Check for .cost-check.yml in the project root. If present, read threshold overrides. If absent, use defaults from references/default-thresholds.md:

  • resource: $100/mo (flag individual resources above)
  • increase: $50/mo (flag cost increases above)
  • increase_pct: 20% (flag cost increase percentage above)
  • total: $1000/mo (flag total cost above)

Step 4: Read baseline

If a previous COST_CHECK.md exists in the project root, read the total monthly cost from it. This serves as the baseline for delta comparison. If no previous report exists, skip delta flagging.

Step 5: Run cost tool

Run the compatible cost tool for each detected IaC stack. See references/tool-parsers.md for per-tool invocation and parsing instructions.

Capture the full output. Extract into the normalized structure:

  • Total projected monthly cost
  • Per-stack/workspace breakdown
  • Per-resource-type grouping within each stack
  • Individual resource costs

Step 6: Flag items

Apply thresholds to the normalized cost data:

  1. Expensive resources — flag any resource with monthly cost above the resource threshold
  2. Cost increase — if a baseline exists, flag if the total cost increase exceeds the increase threshold OR the increase percentage exceeds the increase_pct threshold
  3. Total cost — flag if total projected cost across all stacks exceeds the total threshold

Step 7: Terminal summary

Print the results immediately:

  • IaC stack and cost tool used
  • Per-stack total with resource type breakdown
  • Flagged items with threshold that triggered the flag
  • Delta from baseline (if baseline exists)
  • Total across all stacks

Step 8: Generate COST_CHECK.md

Write the report to the project root using the template in references/report-template.md. Include all sections: summary, stack breakdown, flagged items, thresholds used, and tool info.

Run markdownlint on the generated file.

Step 9: Present results

Show the user:

  1. Total projected cost across all stacks
  2. Number of flagged items by category
  3. Top flagged items with costs
  4. Delta from previous check (if baseline existed)
  5. Ask if they want to adjust thresholds or investigate specific items

Comments

Markdown supported