home / skills / laurigates / claude-plugins / finops-overview

finops-overview skill

/finops-plugin/skills/finops-overview

This skill provides a quick FinOps overview of org billing and repo workflow and cache stats to help you optimize cloud spend.

npx playbooks add skill laurigates/claude-plugins --skill finops-overview

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
3.7 KB
---
model: haiku
description: Quick FinOps summary - org billing and current repo workflow/cache stats
args: "[org]"
allowed-tools: Bash(gh api *), Bash(gh repo *), Bash(gh workflow *), Read, TodoWrite
argument-hint: Optional org name (defaults to current repo's org)
created: 2025-01-30
modified: 2025-01-30
reviewed: 2026-02-08
name: finops-overview
---

# /finops:overview

Display a quick FinOps summary including org-level billing (if admin) and current repository workflow/cache statistics.

## Context

- Current repo: !`gh repo view --json nameWithOwner --jq '.nameWithOwner' 2>/dev/null`
- Repo org/owner: !`gh repo view --json owner --jq '.owner.login' 2>/dev/null`

## Parameters

| Parameter | Description | Default |
|-----------|-------------|---------|
| `org` | GitHub organization name | Current repo's owner |

## Execution

**1. Determine organization:**

If `$1` provided, use it. Otherwise extract from current repo:
```bash
ORG="${1:-$(gh repo view --json owner --jq '.owner.login')}"
```

**2. Org-level billing (may fail if not admin):**

```bash
echo "=== Org Billing: $ORG ==="
gh api /orgs/$ORG/settings/billing/actions \
  --jq '"Minutes: \(.total_minutes_used)/\(.included_minutes) included, \(.total_paid_minutes_used) paid"'
```

**3. Org-level cache usage:**

```bash
echo ""
echo "=== Org Cache Usage ==="
gh api /orgs/$ORG/actions/cache/usage \
  --jq '"\(.total_active_caches_count) caches, \(.total_active_caches_size_in_bytes / 1024 / 1024 | floor)MB total"'
```

**4. Current repo stats (if in a repo):**

```bash
REPO=$(gh repo view --json nameWithOwner --jq '.nameWithOwner')

echo ""
echo "=== Repo: $REPO ==="

# Cache usage
echo "Cache:"
gh api "/repos/$REPO/actions/cache/usage" \
  --jq '"  \(.active_caches_count) caches, \(.active_caches_size_in_bytes / 1024 / 1024 | floor)MB"'

# Recent workflow runs (last 30 days)
echo ""
echo "Workflows (last 30 days):"
gh api "/repos/$REPO/actions/runs?per_page=100" \
  --jq '.workflow_runs | group_by(.name) |
        map({name: .[0].name, runs: length,
             success: ([.[] | select(.conclusion == "success")] | length),
             failure: ([.[] | select(.conclusion == "failure")] | length),
             skipped: ([.[] | select(.conclusion == "skipped")] | length)}) |
        sort_by(-.runs)[] |
        "  \(.name): \(.runs) runs (\(.success) ok, \(.failure) fail, \(.skipped) skip)"'
```

**5. Quick waste indicators:**

```bash
echo ""
echo "=== Waste Indicators ==="

# Count skipped runs
SKIPPED=$(gh api "/repos/$REPO/actions/runs?per_page=100" \
  --jq '[.workflow_runs[] | select(.conclusion == "skipped")] | length')
TOTAL=$(gh api "/repos/$REPO/actions/runs?per_page=100" --jq '.workflow_runs | length')

echo "Skipped runs: $SKIPPED/$TOTAL"

# Check for missing concurrency in workflow files
if [ -d ".github/workflows" ]; then
  MISSING_CONCURRENCY=$(ls .github/workflows/*.yml .github/workflows/*.yaml 2>/dev/null | while read f; do
    grep -L "concurrency:" "$f" 2>/dev/null
  done | wc -l | tr -d ' ')
  echo "Workflows missing concurrency: $MISSING_CONCURRENCY"
fi
```

## Output Format

```
=== Org Billing: orgname ===
Minutes: 1234/2000 included, 0 paid

=== Org Cache Usage ===
45 caches, 2340MB total

=== Repo: orgname/reponame ===
Cache:
  12 caches, 450MB

Workflows (last 30 days):
  CI: 45 runs (40 ok, 3 fail, 2 skip)
  Deploy: 12 runs (12 ok, 0 fail, 0 skip)
  CodeQL: 30 runs (28 ok, 0 fail, 2 skip)

=== Waste Indicators ===
Skipped runs: 4/87
Workflows missing concurrency: 2
```

## Post-actions

Suggest next steps based on findings:
- High skipped runs → `/finops:waste`
- High cache usage → `/finops:caches`
- Want detailed workflow analysis → `/finops:workflows`
- Compare across repos → `/finops:compare`

Overview

This skill provides a quick FinOps summary for a GitHub organization and the current repository. It surfaces org-level billing and cache usage (if you have admin access), plus repository workflow and cache statistics to help spot waste and optimization opportunities. Output is concise and actionable for immediate follow-up.

How this skill works

The script detects the target organization (argument or current repo owner) and queries GitHub Actions APIs to read billing minutes and cache usage. It then inspects the active repo for cache usage, aggregates recent workflow runs (last ~30 days) by workflow name, and computes simple waste indicators like skipped runs and workflows missing concurrency. Results are printed in a compact, human-readable summary to guide next steps.

When to use it

  • Quick health check before cost reviews or sprint planning
  • After noticing rising Actions costs or long CI queues
  • When onboarding or auditing a repository or org for efficiency
  • Before running deeper FinOps analyses or cache cleanup tasks
  • When you need fast indicators to prioritize remediation

Best practices

  • Run from a local clone of the repository so repo-level stats and workflow files are available
  • Use a GitHub CLI authenticated account with org admin for billing/cache visibility
  • Run frequently but pair with detailed scans for root-cause analysis when indicators are high
  • Follow-up high skipped-run counts with workflow logic review and redundant schedule checks
  • Address missing concurrency keys in workflows to reduce redundant parallel runs

Example use cases

  • Org owner runs a quick check to verify Actions minutes used and see whether paid minutes were consumed
  • Repo maintainer inspects workflow run counts and failure rates to prioritize flaky job fixes
  • Platform team identifies high cache usage across an org and schedules a cleanup or retention policy
  • Engineering manager reviews skipped-run ratios before approving changes to CI configuration
  • SRE investigates repositories missing concurrency to reduce parallel job waste

FAQ

What permissions are required to see org billing and cache data?

You need org admin access (or the appropriate billing permissions) for the GitHub API calls that return org-level billing and cache usage; repo-level stats work with normal repo access.

How recent are workflow run statistics?

The summary pulls recent runs (up to per_page=100) which typically covers the last ~30 days depending on activity; use a deeper query for longer windows.