convex-queries

Document Convex query function patterns with validators, indexing, and pagination.

25|4|Updated Oct 18, 2025
One-click install
npx skills add https://github.com/Sstobo/convex-skills --skill convex-queries
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: convex-queries
Source: https://github.com/Sstobo/convex-skills/tree/main/convex-queries
Command: npx skills add https://github.com/Sstobo/convex-skills --skill convex-queries

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Convex queries are essential for retrieving data in Convex apps, but without structured patterns and conventions it’s easy to write inconsistent, hard-to-maintain code. This skill provides clear guidance for defining, registering, calling, and optimizing queries, including pagination, indexing, and full-text search.

Core Features & Use Cases

  • Guidance on function definition, argument validators, and return value patterns for both public queries and internal queries.
  • Practical patterns for registering queries, calling them from mutations or actions via ctx.runQuery, and leveraging file-based routing references.
  • Pagination, indexing, and full-text search guidelines to build scalable, high-performance read paths.
  • Use Case: When building a Convex-backed application that lists or filters large datasets, these patterns help ensure correctness, performance, and maintainability.

Quick Start

Read the reference guidelines in references/query-guidelines.md and apply them to implement a sample query function with validators, indexing, and a straightforward call path from a mutation using ctx.runQuery.

Frequently Asked Questions about convex-queries

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize Convex queries for large datasets?

You can optimize Convex queries by implementing pagination, leveraging withIndex for efficient database indexing, and applying full-text search guidelines. These patterns ensure scalable, high-performance data retrieval for large datasets.

What is the best way to structure Convex query functions?

Structure Convex query functions by defining argument validators, establishing return value patterns, and registering queries with file-based routing. This approach ensures maintainable and safe data access for both public and internal queries.

Can I call a Convex query from a mutation or action?

Yes, you can call Convex queries from mutations or actions using the ctx.runQuery method. This pattern allows you to safely reuse read logic and retrieve data within your backend workflows.

When do I need to use withIndex in Convex database queries?

Use withIndex in Convex database queries when filtering or sorting large datasets. It leverages database indexing to ensure high-performance read paths and maintainable data retrieval operations.

Does Convex support full-text search and pagination?

Yes, Convex supports full-text search and pagination through established query guidelines. These features allow you to build scalable, high-performance read paths for listing and filtering large datasets.