Skip to content

Improve perf audit skill based on eval findings#3

Open
sethconvex wants to merge 2 commits into
mainfrom
skill-improvements
Open

Improve perf audit skill based on eval findings#3
sethconvex wants to merge 2 commits into
mainfrom
skill-improvements

Conversation

@sethconvex

Copy link
Copy Markdown
Contributor

Summary

  • Add "Don't scan to count" section to function-budget.md with three alternatives (bounded range, maintained counter, aggregate component)
  • Add "Don't store per-user state on shared documents" section to subscription-cost.md (readBy/seenBy anti-pattern)
  • Add convex-perf-lint.mjs linter for schema/subscription anti-patterns that @convex-dev/eslint-plugin doesn't cover
  • Update SKILL.md workflow to run linter as first diagnostic step

What the linter catches

Complements (does not replace) @convex-dev/eslint-plugin:

  • readBy/seenBy/likedBy arrays on shared documents
  • Date.now() in query handlers
  • Heartbeat/presence fields on user profile tables
  • Redundant prefix indexes
  • collect-then-count patterns
  • ctx.runQuery inside mutations

Why these changes

Both patterns were identified as the most common gaps in agent-generated Convex code across multiple models (Sonnet, Opus, Codex). Agents consistently use .collect().length for counting and put per-user tracking arrays on shared documents.

🤖 Generated with Claude Code

sethconvex and others added 2 commits March 19, 2026 14:01
Two additions to address gaps identified by evals:

1. function-budget.md: Add "Don't scan to count" section with three
   alternatives (bounded range, maintained counter, aggregate component).
   Models consistently use .collect().length for counting instead of
   maintained counters -- this addresses that gap.

2. subscription-cost.md: Add "Don't store per-user state on shared
   documents" section explaining why readBy/seenBy arrays on source
   documents cause O(users^2) invalidation. Recommends separate
   tracking tables.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds a linter script that catches schema-level and subscription
anti-patterns that @convex-dev/eslint-plugin doesn't cover:
- readBy/seenBy arrays on shared documents
- Date.now() in query handlers
- heartbeat/presence fields on user profile tables
- redundant prefix indexes
- collect-then-count patterns
- ctx.runQuery inside mutations

Skill now instructs the agent to run the linter as the first diagnostic
step, and re-run after fixes to verify. Complements (does not replace)
the existing @convex-dev/eslint-plugin.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant