install
source · Clone the upstream repo
git clone https://github.com/ComeOnOliver/skillshub
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ComeOnOliver/skillshub "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/TerminalSkills/skills/convex" ~/.claude/skills/comeonoliver-skillshub-convex && rm -rf "$T"
manifest:
skills/TerminalSkills/skills/convex/SKILL.mdsource content
Convex
Overview
Convex is a reactive backend platform where database queries, mutations, and actions are defined in TypeScript and data automatically syncs to connected clients in real-time. It eliminates WebSocket code, polling, and cache invalidation, providing ACID transactions and optimistic updates out of the box.
Instructions
- When defining schemas, use
withdefineSchema()
and typed validators (defineTable()
,v.string()
,v.number()
), and define indexes for all filtered and sorted queries.v.id("tableName") - When writing functions, use queries for reads (automatically reactive), mutations for writes (transactional, triggers reactive updates), and actions for external API calls (non-transactional).
- When building React UIs, use
for reactive data subscriptions that auto-update,useQuery()
for writes with optimistic updates, anduseMutation()
for infinite scroll.usePaginatedQuery() - When handling authentication, use
for built-in auth or integrate Clerk/Auth0, and validate user identity at the start of every mutation withconvex-auth
.ctx.auth.getUserIdentity() - When processing background work, use
for delayed execution and cron jobs for recurring tasks instead of making mutations slow.ctx.scheduler.runAfter() - When storing files, use
for upload andctx.storage.store()
for serving URLs without S3 or CDN configuration.ctx.storage.getUrl() - When implementing search, use full-text search indexes with
or vector search withsearchIndex()
for AI/RAG applications, with metadata filtering.vectorIndex()
Examples
Example 1: Build a real-time chat application
User request: "Create a real-time chat app with Convex and React"
Actions:
- Define
table with schema, author reference, and timestamp indexmessages - Create a query function that returns messages sorted by timestamp
- Create a mutation for sending messages with auth validation
- Use
in React to subscribe to messages with automatic real-time updatesuseQuery()
Output: A chat application where messages appear instantly for all connected users without WebSocket code.
Example 2: Add full-text and vector search
User request: "Implement search across articles with both keyword and semantic search"
Actions:
- Define search index on article body field with
searchIndex() - Define vector index on embedding field with
vectorIndex() - Create query functions for text search and vector similarity search
- Combine metadata filtering with search for scoped results
Output: A dual search system supporting both keyword matching and semantic similarity queries.
Guidelines
- Use schema validation in production:
catches type errors at deploy time, not runtime.defineSchema() - Define indexes for all filtered/sorted queries to ensure efficient data access.
- Use queries for reads, mutations for writes, actions for external APIs; never mix concerns.
- Keep mutations small and fast since they hold a database lock; move heavy processing to actions.
- Use
for background work instead of making mutations slow.ctx.scheduler.runAfter() - Validate user identity at the start of every mutation to prevent unauthorized writes.
- Use optimistic updates for interactive UIs; the client sees the change instantly while the server confirms.