# Backend Queries

> Write efficient, secure database queries that prevent SQL injection, avoid N+1 problems, and optimize performance through proper indexing and caching strategies. Use this skill when writing SQL queries for PostgreSQL, MySQL, SQLite, or any SQL database; when using ORM query builders like Prisma, Sequelize, TypeORM, ActiveRecord, Django ORM; when implementing parameterized queries to prevent SQL injection; when optimizing query performance with proper indexing; when eager loading relationships to avoid N+1 queries; when selecting specific columns instead of SELECT *; when wrapping related operations in transactions for data consistency; when implementing query timeouts to prevent runaway operations; when caching expensive query results; or when working with database query optimization and performance tuning. Use when this capability is needed.

- Skill: `tomevault-io/backend-queries` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/backend-queries`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/backend-queries/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Data & Analytics
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/backend-queries

---


# Backend Queries

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.

## When to use this skill

- When writing SQL queries or using ORM query builders
- When preventing SQL injection with parameterized queries
- When optimizing queries to avoid N+1 problems
- When selecting specific columns for better performance
- When indexing columns used in WHERE, JOIN, and ORDER BY clauses
- When wrapping related database operations in transactions
- When implementing query timeouts and performance safeguards
- When caching expensive or frequently-run query results
- When working with PostgreSQL, MySQL, SQLite, ORMs, or database query optimization

## Instructions

For details, refer to the information provided in this file:
[backend queries](../../../agent-os/standards/backend/queries.md)

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/shynlee04) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-14 -->

