Backend Queries Standards

Enforces parameterized SQL and ORM queries with eager loading and indexing.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/DennisToma/repo_example --skill backend-queries-standards-dennistoma
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Backend Queries Standards
Source: https://github.com/DennisToma/repo_example/tree/main/.claude/skills/backend-queries-standards
Command: npx skills add https://github.com/DennisToma/repo_example --skill backend-queries-standards-dennistoma

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps teams write secure, optimized database queries by enforcing best practices that prevent common pitfalls such as SQL injection, N+1 queries, and inefficient data retrieval.

Core Features & Use Cases

  • Parameterized Queries: Ensure all inputs are passed as parameters to prevent injection and improve plan reuse.
  • N+1 Prevention through Eager Loading: Recommend and implement strategies (joins, includes) to minimize per-record queries.
  • Indexing & Performance: Advise on selecting needed columns, proper indexing, and query timeouts for predictable performance.
  • Use Case: When refactoring data access layers or building repository patterns, apply these standards to SQL and ORM queries to improve security and speed.

Quick Start

To begin adopting these standards, audit a sample query file, then refactor to use parameterized queries and eager loading where appropriate, and verify performance improvements.

Frequently Asked Questions about Backend Queries Standards

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

FAQPage Schema
How do I prevent N+1 queries when using ORM eager loading in my backend services?

To prevent N+1 queries, you should implement eager loading strategies such as joins or includes in your ORM queries. This approach minimizes per-record queries by fetching related data upfront, significantly improving data access layer speed.

How do I stop SQL injection vulnerabilities in my database queries?

To stop SQL injection, you must use parameterized queries across all SQL and ORM data access layers. Passing all inputs as parameters ensures malicious input is treated strictly as data, preventing injection while also improving query plan reuse.

What is the best way to optimize SQL queries and indexing for backend performance at scale?

Optimizing SQL queries at scale requires selecting only needed columns, applying strategic indexing, and enforcing query timeouts. These practices ensure predictable database performance and efficient data retrieval across high-volume backend services.

How do I manage transaction boundaries correctly in a repository pattern?

Managing transaction boundaries in a repository pattern involves enforcing proper transaction limits across your data access layers. This ensures database integrity and predictable performance when refactoring SQL or ORM queries in backend services.

Can I apply these database query standards to both raw SQL and ORM frameworks?

Yes, these database query standards apply directly to both raw SQL and ORM queries. They enforce secure, optimized data retrieval practices across repository patterns and data access layers in any backend service architecture.