backend-queries
Write secure, performant database queries following best practices for data retrieval and manipulation. Use this skill when writing SQL queries, ORM query methods, or database query builders. Use this skill when fetching data with joins, filters, or complex query conditions. Use this skill when implementing eager loading to prevent N+1 query problems. Use this skill when optimizing query performance with proper indexing strategies. Use this skill when writing parameterized queries to prevent SQL injection. Use this skill when implementing database transactions for related operations. Use this skill when working with query optimization, caching strategies, or query timeout handling.
When & Why to Use This Skill
This Claude skill enables the generation of secure, high-performance database queries by following industry best practices for data retrieval and manipulation. It assists developers in writing optimized SQL, utilizing ORMs effectively, and implementing critical performance patterns like eager loading and indexing while ensuring protection against SQL injection.
Use Cases
- Optimizing application performance by identifying and resolving N+1 query problems through eager loading strategies.
- Securing database interactions by implementing parameterized queries and best practices to prevent SQL injection vulnerabilities.
- Designing complex data retrieval logic involving multiple joins, filters, and sorting criteria using SQL or ORM query builders.
- Maintaining data integrity during concurrent operations by implementing robust database transactions and proper timeout handling.
- Improving system responsiveness by implementing query result caching and setting appropriate query timeouts for expensive operations.
| name | Backend Queries |
|---|---|
| description | Write secure, performant database queries following best practices for data retrieval and manipulation. Use this skill when writing SQL queries, ORM query methods, or database query builders. Use this skill when fetching data with joins, filters, or complex query conditions. Use this skill when implementing eager loading to prevent N+1 query problems. Use this skill when optimizing query performance with proper indexing strategies. Use this skill when writing parameterized queries to prevent SQL injection. Use this skill when implementing database transactions for related operations. Use this skill when working with query optimization, caching strategies, or query timeout handling. |
Backend Queries
When to use this skill
- When writing SQL queries or ORM query methods
- When fetching related data using joins or eager loading
- When implementing filtering, sorting, or search functionality
- When optimizing queries to prevent N+1 query problems
- When using parameterized queries to prevent SQL injection
- When implementing database transactions for consistency
- When selecting specific columns instead of using SELECT *
- When adding query timeouts to prevent runaway queries
- When implementing query result caching for expensive operations
- When working with query builders or repository pattern implementations
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