# Convex Cost > Previsualiza el gasto en Convex: clasifica funciones por bytes/documentos leídos × volumen de llamadas, proyecta cada curva de costo y nombra el arreglo más barato; confirm-cost para acciones pagadas. Fuente: https://skillsagentes.com/skills/get-convex/agent-skills/convex-cost Markdown: https://skillsagentes.com/skills/get-convex/agent-skills/convex-cost.md Repositorio: https://github.com/get-convex/agent-skills Autor: get-convex Licencia: Apache-2.0 Actualizado: el mes pasado Coste de contexto: 47 tok instalada, 1k tok al activarse, 1k tok con todos los archivos del bundle Bundle: 1 archivo, 4 KB Permisos que pide: ninguno declarado ## Instalación Un skill son archivos markdown: los mismos archivos valen para cualquier agente y lo único que cambia es el directorio de destino, es decir la bandera `--agent`. Añade `-g` para instalarlo en todos los proyectos de la máquina. ```bash # Claude Code npx -y skills add get-convex/agent-skills --skill convex-cost --agent claude-code # Cursor npx -y skills add get-convex/agent-skills --skill convex-cost --agent cursor # Codex npx -y skills add get-convex/agent-skills --skill convex-cost --agent codex # Gemini CLI npx -y skills add get-convex/agent-skills --skill convex-cost --agent gemini # Windsurf npx -y skills add get-convex/agent-skills --skill convex-cost --agent windsurf # Cline npx -y skills add get-convex/agent-skills --skill convex-cost --agent cline ``` ## Qué hace - Lee bytes/documentos leídos desde insights y los atribuye a las funciones que los generan - Clasifica funciones por lectura-de-datos-por-llamada × volumen de llamadas para identificar los drivers de costo - Proyecta la curva de crecimiento de cada driver (lineal en escaneos vs. plana en accesos indexados) - Nombra el arreglo más barato por driver (índice + .withIndex, .paginate/.take, componente de agregado, caché) - Aplica confirm-cost: exige un sí explícito antes de cualquier acción pagada o medida ## Cuándo usarla - Se quiere prever cuánto costará una app de Convex antes de que llegue la factura - Hay que identificar qué funciones dominan el gasto por lectura de datos - Se planea una acción medida (compra de dominio, aprovisionamiento cloud, cambio de plan) y hace falta confirmación de costo ## Qué la activa - "¿Cuánto me va a costar esta app de Convex a medida que crezca?" - "¿Qué funciones son las que más gastan datos leídos en mi deployment?" - "Antes de activar esto, ¿cuánto cuesta y con qué frecuencia se cobra?" ## Antes de instalar - Requiere acceso al MCP oficial de Convex (insights, tables, functionSpec) y opera solo sobre dev/prod, no previews. ## Archivos - SKILL.md — 4 KB ## SKILL.md Reproducido tal cual desde get-convex/agent-skills bajo Apache-2.0. Esta sección es el documento original y está en inglés. # 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. 6. CONFIRM-COST for paid actions: if the flow includes anything metered (a domain purchase, cloud provisioning, a plan change), STATE the price and recurrence explicitly and get an explicit yes BEFORE proceeding — never let a paid action happen as a side effect (the cost-confirm gate). 7. REPORT: the current cost drivers ranked, each with its evidence + growth shape + fix, and a plain bottom line ('your spend is dominated by messages:list reading the whole table every call; index it and it drops ~100x'). Honest precision: Convex pricing changes and depends on plan — give relative/shape guidance and cite the pricing page for absolute numbers rather than inventing a dollar total. ## Rules - Cost = data-read-per-call × call-volume — always show both factors; a cheap function called constantly can cost more than an expensive rare one. - Read the deployment's own insights/bytes-read evidence for spend; with no traffic yet, price the query SHAPES (a scan on a growing table is a future cost). - Give the growth CURVE, not false-precision dollars: O(table) scans compound as data accumulates; indexed access stays flat. Cite the pricing page for absolute figures. - Every cost driver names its cheapest fix and emits a cost-class finding on the bus pointing at the fixer (convex-expert/advisor). - Confirm-cost for any metered/paid action: state the price + recurrence and get an explicit yes BEFORE it happens — never as a side effect. - Read-only over dev/prod (deploy-guard); insights is cloud+user-auth only. Cost composes convex-advisor's evidence but frames it as money, not latency. ## Dónde encaja - Categoría: [DevOps e infraestructura](https://skillsagentes.com/categorias/devops-infraestructura.md) — Despliegues, contenedores, IaC y flujos de gestión de incidentes. - Creador: [get-convex](https://skillsagentes.com/creators/get-convex.md) — 33 skills en el directorio - [Todas las skills](https://skillsagentes.com/skills.md) - [Ranking de instalaciones](https://skillsagentes.com/ranking.md) ## Otras skills del mismo repositorio - [Convex Authz](https://skillsagentes.com/skills/get-convex/agent-skills/convex-authz.md): Audita y refuerza la autorización de una app Convex: impersonación por identity-from-arg, checks de ownership por documento faltantes, queries públicas que filtran datos por un id del cliente y escrituras en un contenedor ajeno. - [Convex Design](https://skillsagentes.com/skills/get-convex/agent-skills/convex-design.md): Diseña y construye backends reactivos y type-safe de nivel producción en Convex: schema, queries/mutations/actions, índices, auth, storage, scheduling, multiplayer en tiempo real y workflows LLM/agentes. - [Convex Quickstart](https://skillsagentes.com/skills/get-convex/agent-skills/convex-quickstart.md): Levanta un template Next.js + Convex barebones a partir de una idea en una frase. - [Convex Expert](https://skillsagentes.com/skills/get-convex/agent-skills/convex-expert.md): Especialista en el backend de Convex: código dentro de convex/ (funciones, schemas, índices, queries, mutations, actions, endpoints HTTP, cron jobs, storage, auth y componentes). - [Convex Agent](https://skillsagentes.com/skills/get-convex/agent-skills/convex-agent.md): Añade un backend de agente de IA / RAG (@convex-dev/agent) a la app Convex. ## Skills relacionadas - [Wizard](https://skillsagentes.com/skills/mattpocock/skills/wizard.md): Genera un wizard bash interactivo que guía a un humano por los pasos que solo él puede dar. Úsalo para aprovisionar infraestructura, credenciales o secretos de CI, o una migración puntual. - [Deploy Release Test](https://skillsagentes.com/skills/vercel/next.js/deploy-release-test.md): Valida el paquete de preview de Next.js específico de un commit y dispara manualmente toda la suite de tests de despliegue vía el workflow test_e2e_deploy_release.yml de GitHub Actions. - [Canary](https://skillsagentes.com/skills/garrytan/gstack/canary.md): Monitoreo canary post-deploy: vigila la app en producción tras el despliegue. (gstack) - [Gstack Upgrade](https://skillsagentes.com/skills/garrytan/gstack/gstack-upgrade.md): Actualiza gstack a la última versión. - [Land And Deploy](https://skillsagentes.com/skills/garrytan/gstack/land-and-deploy.md): Fusiona el PR, espera CI y el despliegue, y verifica la salud de producción con checks canary. Continúa el trabajo que /ship dejó iniciado. (gstack) --- Skills Agentes · [Índice de páginas en markdown](https://skillsagentes.com/sitemap.md) · [Inicio](https://skillsagentes.com/index.md)