All skills
simota avatar

/ledger

@e307415
by shingo imotasimota/agent-skills85 stars
15

Optimizing FinOps and cloud cost: IaC-based estimation, right-sizing, RI/SP recommendations, anomaly detection, budget alerts, AI/GPU workload economics. Use to forecast or cut cloud spend.

Use this Skill: https://skilld.dev/gh/simota/agent-skills/ledger

This session only. Nothing lands on disk.

referencecost-governance.md

≈1.4k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Cost Governance

Purpose: Operational design for budget alerts, CI/CD cost gates, tag enforcement, and ongoing cost management. Read when: Building out cost governance mechanisms.


Budget Alert Design

Alert Escalation Matrix

Threshold Alert Type Recipient Action
50% of monthly budget Info Team Slack channel Awareness
75% of monthly budget Warning Team lead + FinOps Review spending
90% of monthly budget Critical Engineering manager Spending freeze review
100% of monthly budget Emergency VP Engineering Mandatory action plan
120% of monthly budget Executive CTO / CFO Incident-level response

Budget Configuration Template

# AWS Budget example
budget:
  name: "team-{team_name}-monthly"
  amount: 10000  # USD
  time_unit: MONTHLY

  notifications:
    - threshold: 50
      type: ACTUAL
      subscribers: ["team-slack-webhook"]
    - threshold: 75
      type: ACTUAL
      subscribers: ["team-lead@example.com"]
    - threshold: 90
      type: ACTUAL
      subscribers: ["eng-manager@example.com"]
    - threshold: 100
      type: FORECASTED
      subscribers: ["finops-team@example.com"]

  cost_filters:
    tags:
      team: ["{team_name}"]

CI/CD Cost Gate Integration

Infracost PR Gate

# .github/workflows/cost-gate.yml
name: Cost Gate
on: [pull_request]

jobs:
  cost-check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: infracost/actions/setup@v3
        with:
          api-key: ${{ secrets.INFRACOST_API_KEY }}

      - name: Generate cost diff
        run: |
          infracost diff \
            --path . \
            --compare-to infracost-base.json \
            --format json \
            --out-file /tmp/infracost.json

      - name: Check threshold
        run: |
          DIFF=$(jq -r '.diffTotalMonthlyCost' /tmp/infracost.json)
          THRESHOLD="${COST_THRESHOLD:-100}"
          if (( $(echo "$DIFF > $THRESHOLD" | bc -l) )); then
            echo "COST_EXCEEDED=true" >> $GITHUB_ENV
          fi

      - name: Comment on PR
        uses: infracost/actions/comment@v3
        with:
          path: /tmp/infracost.json
          behavior: update

Cost Gate Thresholds

Environment Auto-approve Requires Review Blocks Merge
dev < $50/mo increase $50-200/mo > $200/mo
staging < $100/mo increase $100-500/mo > $500/mo
production < $200/mo increase $200-1000/mo > $1000/mo

Tag Enforcement

Required Tags

Tag Key Purpose Example Values Enforcement
team Cost allocation platform, backend, data Mandatory
environment Env separation dev, staging, prod Mandatory
service Service mapping api, web, worker Mandatory
cost-center Finance mapping CC-1234 Mandatory (prod)
owner Accountability alice@example.com Recommended
project Project tracking project-alpha Recommended
managed-by IaC tracking terraform, manual Recommended

Tag Policy Enforcement

# AWS SCP for tag enforcement
resource "aws_organizations_policy" "require_tags" {
  name    = "require-cost-tags"
  type    = "TAG_POLICY"
  content = jsonencode({
    tags = {
      team        = { tag_key = { "@@assign" = "team" }, enforced_for = { "@@assign" = ["ec2:*", "rds:*", "s3:*"] } }
      environment = { tag_key = { "@@assign" = "environment" }, enforced_for = { "@@assign" = ["ec2:*", "rds:*", "s3:*"] } }
      service     = { tag_key = { "@@assign" = "service" }, enforced_for = { "@@assign" = ["ec2:*", "rds:*", "s3:*"] } }
    }
  })
}

Continuous Cost Review Cadence

Cadence Activity Participants Output
Daily Anomaly detection alert review On-call engineer Acknowledge / investigate
Weekly Cost trend review Team leads Action items
Monthly FinOps review Engineering + Finance Optimization report
Quarterly Commitment review FinOps + Finance RI/SP purchase/adjustment
Annual Architecture cost review Tech leads + FinOps Architecture optimization plan

FinOps Maturity Model

Phase Crawl Walk Run
Visibility Basic tagging, monthly reports Per-team showback, automated reports Real-time dashboards, unit economics
Optimization Manual right-sizing, basic RI Automated recommendations, SP coverage ML-driven auto-optimization
Governance Manual budget alerts CI/CD cost gates, tag enforcement Policy-as-code, automated remediation
Culture Centralized FinOps team Embedded FinOps practices Engineering-owned cost optimization

Automated Remediation Patterns

Trigger Automated Action Safety Gate
Dev instance idle > 24h weekday Stop instance Tag auto-stop: true required
Dev environment weekend Stop all non-exempt Tag weekend-exempt: true to skip
Untagged resource > 48h Notify owner, add untagged flag 7-day grace before termination
EBS volume unattached > 7d Snapshot + schedule deletion Notify owner first
Cost spike > 50% daily Alert + auto-investigation No auto-remediation

Source: SKILL.md on GitHub

No alerts13d4 checks · Risk SAFE
  • Gen Agent Trust Hub13d

    The 'ledger' skill is a comprehensive FinOps and cloud cost optimization tool designed to assist with IaC cost estimation, right-sizing, and commitment strategies. A thorough security analysis found no evidence of prompt injection, data exfiltration, obfuscation, or malicious code execution. The external links provided are legitimate technical citations and references for cloud cost data.

  • Socket13d

    No alerts

  • Snyk13d

    Risk: LOW · No issues

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at e307415. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 days ago.

Activeupdated 2 weeks ago

README badge

README badge for simota/agent-skills/ledger