Write efficient, secure database queries using ORMs or raw SQL, preventing N+1 problems, SQL injection, and performance issues. Use this skill when writing database queries, implementing data access layers, creating repository patterns, or optimizing query performance in service files, query builders, or data access objects. Apply this skill when using parameterized queries, implementing eager loading to avoid N+1 queries, selecting only needed columns, adding WHERE/JOIN/ORDER BY clauses, or working with query optimization, indexes, and database performance tuning. This skill ensures queries use proper SQL injection prevention, implement transactions for data consistency, cache expensive queries appropriately, and follow best practices for query timeouts, connection pooling, and database resource management.
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.
queries.py, repositories/, dao/, or service layer query logicFor details, refer to the information provided in this file: backend queries