| name | Backend Queries |
| description | Write optimized and secure database queries using parameterized queries, eager loading, and proper indexing strategies. Use this skill when writing database queries, constructing SQL statements, using ORM query methods, implementing data fetching logic, preventing SQL injection attacks, optimizing query performance, avoiding N+1 query problems, selecting specific columns instead of all data, implementing transactions for related operations, setting query timeouts, caching expensive queries, or working with WHERE clauses, JOINs, and ORDER BY statements. Apply this skill when fetching data from databases, optimizing slow queries, refactoring data access code, or reviewing query security and performance. |
Backend Queries
When to use this skill
- When writing database queries in any file that interacts with the database
- When constructing SQL statements or using ORM query builders (Prisma, Sequelize, ActiveRecord, etc.)
- When preventing SQL injection by using parameterized queries
- When optimizing queries to avoid N+1 query problems (use eager loading or joins)
- When selecting only needed columns instead of using SELECT * or fetching all fields
- When adding indexes to columns used in WHERE, JOIN, or ORDER BY clauses
- When implementing database transactions for related operations
- When setting query timeouts to prevent runaway queries
- When caching results of complex or frequently-run queries
- When writing JOIN operations to fetch related data efficiently
- When implementing pagination, filtering, or sorting with query parameters
- When reviewing query performance and optimization opportunities
This Skill provides Claude Code with specific guidance on how to adhere to coding standards as they relate to how it should handle backend queries.
Instructions
For details, refer to the information provided in this file: backend queries