# Cost Monitor

> Cloud service cost monitoring expert. Sets up alerts, analyzes trends, and predicts future costs. Trigger when user mentions cost monitoring, usage alerts, or cost forecasting.

- Skill: `huifer/cost-monitor` (Agent Skill, multi-file: 7 files)
- Install (CLI): `npx skillmds@latest add huifer/cost-monitor`
- Raw SKILL.md: https://api.skillmd.com/api/skills/huifer/cost-monitor/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- Author: huifer (https://skillmd.com/u/huifer)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/huifer/cost-monitor

---


# Cloud Cost Monitoring Expert

## Monitoring Components

| Component | Purpose | Frequency |
|-----------|---------|-----------|
| Usage Metrics | Track current usage | Real-time |
| Alerts | Early warning | On threshold |
| Trends | Pattern analysis | Daily/Weekly |
| Forecasting | Cost prediction | Monthly |

## Audit Workflow

### Step 1: Set Up Alerts

Configure threshold-based notifications for each service.
See `cases/alert-setup.md` for implementation.

### Step 2: Collect Historical Data

Store usage metrics over time for analysis.

### Step 3: Analyze Trends

Identify patterns and growth rates.
See `cases/trend-analysis.md` for detailed analysis.

### Step 4: Generate Forecasts

Predict future costs based on historical data.

## Matching Cases

| Task | Case File | Output |
|------|-----------|--------|
| Alert setup | `cases/alert-setup.md` | Notification config |
| Trend analysis | `cases/trend-analysis.md` | Growth patterns |
| Anomaly detection | `cases/trend-analysis.md` | Spike alerts |

## Service-Specific Monitoring

### Supabase

```sql
-- Database size
SELECT pg_database_size(current_database());

-- Active connections
SELECT count(*) FROM pg_stat_activity;

-- Query performance
SELECT query, calls, total_exec_time 
FROM pg_stat_statements 
ORDER BY total_exec_time DESC LIMIT 10;
```

### Cloudflare

```bash
# Workers usage
wrangler analytics

# D1 usage
wrangler d1 info <database>
```

### Redis

```bash
# Memory usage
redis-cli INFO memory

# Key count
redis-cli DBSIZE
```

## Output Format

```
## Cost Monitoring Report

### 1. Current Usage
| Service | Metric | Value | Threshold | Status |
|---------|--------|-------|-----------|--------|
| Supabase | DB Size | X MB | 400 MB | OK |
| Workers | Requests | X K | 80 K | Warning |

### 2. Trend Analysis (30 days)
| Service | Metric | Daily Growth | Projected (30d) |
|---------|--------|--------------|-----------------|
| Supabase | DB Size | X MB/day | X MB |

### 3. Alerts Configured
- [Service] [Metric]: [Threshold] → [Channel]

### 4. Recommendations
1. [Action] → Expected impact
```

