Backend Queries

Write secure, parameterized SQL and ORM queries with indexing and transactions.

1|Updated Jan 9, 2026
One-click install
npx skills add https://github.com/TorbenMerrald/StableManager --skill backend-queries-torbenmerrald
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Backend Queries
Source: https://github.com/TorbenMerrald/StableManager/tree/main/.claude/skills/backend-queries
Command: npx skills add https://github.com/TorbenMerrald/StableManager --skill backend-queries-torbenmerrald

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing backend queries safely and efficiently is error-prone and performance-sensitive. This skill guides you to craft secure, high-performance SQL and ORM queries, avoid N+1 issues, and apply proper indexing and transactions.

Core Features & Use Cases

  • Secure, parameterized queries to prevent SQL injection across SQL and ORM layers
  • Performance optimization through appropriate indexing, eager loading, and selective column retrieval
  • Transactional integrity for related operations and consistent data state
  • Effective use of joins, filters, sorts, and query builders in data access patterns

Quick Start

Write a parameterized query that fetches active users and their recent orders in a single transaction

Frequently Asked Questions about Backend Queries

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

FAQPage Schema
How do I write parameterized database queries to prevent SQL injection?

Parameterized database queries prevent SQL injection by enforcing safe query patterns that separate code from user input. This skill guides you in structuring data retrieval and filtering to ensure all backend queries are secure across SQL and ORM layers.

What is the best way to fix N+1 query issues in an ORM?

Fixing N+1 query issues in an ORM requires applying eager loading strategies to fetch related data in fewer trips. This skill helps you optimize performance through selective column retrieval and proper join construction to eliminate redundant database calls.

How do I handle transactions for related database operations?

Handling transactions for related database operations ensures consistent data state and transactional integrity. This skill directs you in wrapping complex query construction and related data modifications within proper transaction boundaries to prevent partial updates.

When do I need database indexing for backend query optimization?

Database indexing for backend query optimization is needed when filtering and sorting operations cause performance bottlenecks. This skill identifies appropriate indexing strategies to accelerate data retrieval and enforce high-performance query execution patterns.

Does this approach work for both raw SQL and ORM query builders?

This approach works for both raw SQL and ORM query builders by applying universal performance and security principles. The skill enforces parameterization, proper indexing, and safe query patterns across diverse data access layers to prevent injection and performance issues.

Why do my backend queries have performance issues despite correct indexing?

Backend queries have performance issues despite correct indexing when lacking selective column retrieval or using inefficient joins. This skill addresses performance optimization comprehensively, evaluating eager loading strategies and complex query construction to resolve bottlenecks.