| name | cloudflare-audit |
| description | Cloudflare platform cost optimization expert. Monitors Workers, D1, KV, R2 usage, identifies cost anomalies, and provides optimization recommendations. Trigger when user mentions Cloudflare costs, Workers optimization, or platform audit. |
| when_to_use | - User asks about Cloudflare billing
- User needs to optimize Workers performance
- User encounters cost overages on D1/KV/R2
- User needs to audit Cloudflare configuration
- User wants to reduce Cloudflare expenses
|
| allowed-tools | Bash(wrangler *) |
Cloudflare Cost Optimization Expert
Cost Components
| Service | Free Tier | Billing Metric |
|---|
| Workers | 100K req/day | Invocations |
| D1 | 5M reads/day | Row Reads |
| KV | 100K reads/day | Operations |
| R2 | 10GB storage | Storage + Operations |
| Pages | 500 builds/month | Builds |
Audit Workflow
Step 1: Check Workers Usage
wrangler analytics
Analyze invocation patterns and CPU time.
See cases/workers-optimization.md for optimization.
Step 2: Audit D1 Costs
Check Row Reads and query patterns.
See d1-cost-optimizer skill for detailed analysis.
Step 3: Monitor KV Operations
wrangler kv:key list --binding=MY_KV
Identify read/write patterns.
See cases/kv-optimization.md for optimization.
Step 4: Review R2 Storage
wrangler r2 bucket list
Check storage usage and operation counts.
See cases/r2-optimization.md for optimization.
Matching Cases
| Service | Case File | Focus |
|---|
| Workers | cases/workers-optimization.md | Invocations, CPU time |
| KV | cases/kv-optimization.md | Operations, storage |
| R2 | cases/r2-optimization.md | Storage, operations |
Benchmark Reference
| Optimization | Before | After | Improvement |
|---|
| Workers caching | 100K req/day | 10K req/day | 90% |
| KV batching | 100K reads | 20K reads | 80% |
| R2 presigned URLs | 1M ops | 100K ops | 90% |
Output Format
## Cloudflare Cost Audit Report
### 1. Service Usage
| Service | Current | Free Tier | Status |
|---------|---------|-----------|--------|
| Workers | X req | 100K/day | X% |
| D1 | X reads | 5M/day | X% |
| KV | X ops | 100K/day | X% |
| R2 | X GB | 10GB | X% |
### 2. Cost Analysis
- Current monthly cost: $X
- Projected cost: $X
### 3. Recommendations (by priority)
1. [P0] Apply case: <case-name> → Expected savings: $X/month
### 4. Implementation
Reference: cases/<case-name>.md