AgentSkillsCN

Backend Queries

使用参数化查询、正确的急载和事务管理编写安全、高效的数据库查询。在编写数据库查询、ORM 操作、原始 SQL 语句,或存储库方法时使用此技能。在 repositories/、queries/、services/,或任何与数据库交互的代码中工作时使用。在优化查询性能、防止 N+1 查询、实施事务、添加查询超时,或缓存昂贵查询时使用。在审查代码是否存在 SQL 注入漏洞时使用。

SKILL.md
--- frontmatter
name: Backend Queries
description: Write secure, performant database queries using parameterized queries, proper eager loading, and transaction management. Use this skill when writing database queries, ORM operations, raw SQL statements, or repository methods. When working on files in repositories/, queries/, services/, or any code that interacts with the database. When optimizing query performance, preventing N+1 queries, implementing transactions, adding query timeouts, or caching expensive queries. When reviewing code for SQL injection vulnerabilities.

When to use this skill:

  • When writing database queries (ORM or raw SQL)
  • When creating repository or data access layer methods
  • When working on files in repositories/, queries/, services/, or dal/ directories
  • When using SELECT statements and choosing which columns to fetch
  • When implementing eager loading or joins to prevent N+1 queries
  • When wrapping related operations in database transactions
  • When adding indexes to optimize WHERE, JOIN, or ORDER BY clauses
  • When implementing query timeouts for long-running queries
  • When caching results of expensive or frequently-run queries
  • When reviewing code for SQL injection vulnerabilities
  • When using parameterized queries to prevent injection attacks

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.

Instructions

For details, refer to the information provided in this file: backend queries