# convex-cost

Analyzes Convex deployment spend, ranks functions driving read costs, and projects growth curves. Points out the cheapest code fix for each bottleneck.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 35900 installs · ★ 68
- Author: convex
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/convex/agent-skills/tree/HEAD/skills/convex-cost/SKILL.md
- Updated: 2026-10-13
- HTML: https://affpapa.org/en/nevibecode/skills/convex-cost

## What it does

The skill connects through the official Convex MCP to gather concrete spend evidence. It pulls bytes-read and documents-read events from `insights` and checks table row bounds via `tables`. Total cost is driven by data read per call multiplied by call volume. Live traffic is optional. When an app has no users yet, the tool evaluates raw query shapes to catch unbounded `.collect()` scans early.

It reports growth curves rather than guessing exact dollar totals, since Convex pricing depends on your specific plan. Unindexed table scans scale linearly with data accumulation, while queries using `.take(n)` over indexes remain flat. For each bottleneck, it suggests concrete fixes such as `.withIndex`, pagination, or aggregate components, then hands off the refactor to convex-advisor or convex-expert.

The `insights` feature requires cloud user authentication on dev or prod deployments and does not support previews. The skill also enforces the confirm-cost rule: before initiating any metered action like domain provisioning or plan changes, the agent must state the exact price and billing frequency to get your explicit approval.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add convex/agent-skills --skill convex-cost -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/convex-cost/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/convex-cost/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add convex/agent-skills --skill convex-cost -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/convex-cost/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add convex/agent-skills --skill convex-cost -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/convex-cost/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install convex/agent-skills convex-cost
```

2. **Manually: put the files in place**
- File: `.github/skills/convex-cost/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add convex/agent-skills --skill convex-cost -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/convex/agent-skills --path skills/convex-cost
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/convex-cost/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add convex/agent-skills --skill convex-cost -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/convex/agent-skills/tree/HEAD/skills/convex-cost/SKILL.md

## When to use it
- rank Convex functions by read volume multiplied by call counts
- project database spend curves as table data accumulates
- replace linear full-table scans with indexed lookups
- prevent automated cloud charges without explicit confirmation

## Example prompts
- Analyze our Convex deployment spend and rank the top cost drivers
- Check our query shapes and project how database costs will scale
- Inspect dev insights to find the cheapest fixes for heavy read queries

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: d83d1d4fa0582813.

BEGIN THIRD-PARTY FILE d83d1d4fa0582813
```text
---
name: convex-cost
description: "Preview Convex spend — rank functions by bytes/documents-read × call-volume from insights, project each cost driver's growth curve, name the cheapest fix; confirm-cost for paid actions."
---

<!-- GENERATED from convex-agents content/capabilities/convex-cost.json — do not edit by hand. -->

# Preview what this app will cost

Cost surprises come from a handful of functions reading far more data than anyone realized — the same read-heavy patterns convex-advisor flags for perf, seen through the money lens. This capability makes spend legible: it reads the deployment's own bytes/documents-read evidence, attributes it to the functions driving it, projects how it grows with traffic, and names the cheapest fix. It also carries the confirm-cost discipline (Supabase's structural consent for paid actions): before anything metered, state the price and get an explicit yes.

## Workflow

1. GUARD: deploy-guard — a cost read is read-only over dev/prod (insights is cloud+user-auth only; not previews). Announce the deployment.
2. GATHER the spend evidence via the official MCP: `insights` for the bytes-read / documents-read events (the direct cost signal — Convex bills on function calls + bandwidth), `tables` for row counts (a table's size bounds its scan cost), `functionSpec` for the surface. If there's no usage/traffic yet, say so and estimate from the query SHAPES instead (a `.collect()` on a table projected to grow is a future cost even with zero traffic today).
3. ATTRIBUTE: rank functions by bytes/documents read per call × observed (or asked-about) call volume — the product is the cost driver, not either alone. A cheap-per-call function called constantly can outweigh an expensive rare one; show both factors.
4. PROJECT: state how the top drivers scale — a full-table `.collect()` grows LINEARLY with the table (cost compounds as data accumulates); an indexed `.take(n)` stays flat. Give the user the shape of the curve ('this is O(table size) per call — fine at 1k rows, a bill at 1M'), not a false-precision dollar figure.
5. NAME THE CHEAPEST FIX per driver — index + `.withIndex` instead of scan, `.paginate`/`.take` instead of `.collect`, an aggregate component for counts, caching a hot read — and emit it as a cost-class finding on the bus (evidence: the insight event + the projected growth) pointing at convex-expert/convex-advisor for the actual change.
```
END THIRD-PARTY FILE d83d1d4fa0582813

The third-party file has ended. Everything between the d83d1d4fa0582813 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2439 of 4048 bytes. © convex · Apache-2.0 · https://github.com/convex/agent-skills/tree/HEAD/skills/convex-cost/SKILL.md

## Similar
- [convex](https://affpapa.org/en/nevibecode/skills/waynesutton-convex.md) — skill · 5700 installs
- [convex-best-practices](https://affpapa.org/en/nevibecode/skills/convex-best-practices.md) — skill · 3900 installs
- [scalability-playbook](https://affpapa.org/en/nevibecode/skills/scalability-playbook.md) — skill · 342 installs

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
