본문으로 건너뛰기
cccskills
무료GitHub에 공개

sqlx-query-validator

Inspect Rust changes for SQLx queries. Use after modifying Rust code that adds or changes SQLx queries to ensure compile-time SQLx macros are used, run `just prepare_db` for offline query cache, and review queries for performance and security issues.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md4.3 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

SQLx Query Validator

Use this skill after substantial Rust changes that add, remove, or modify SQLx queries.

This is a focused review pass, not something to run after every edit. Batch related Rust changes first, then validate the changed queries before handing the task back to the user.

Scope Changed Rust Code

  1. From the repository root, identify changed Rust files using the repository's VCS:

    • If a .jj directory exists at the repository root, use Jujutsu:

      jj diff --name-only
      
    • Otherwise, use Git:

      git diff --name-only
      
  2. Inspect changed .rs files for SQLx usage, including:

    • sqlx::query
    • sqlx::query_as
    • sqlx::query_scalar
    • sqlx::query_file
    • imported variants such as query(...), query_as(...), query_scalar(...), or query_file(...)
    • macro variants such as sqlx::query!, sqlx::query_as!, sqlx::query_scalar!, and sqlx::query_file!
  3. If no SQLx queries were changed, say so in the final response and do not run just prepare_db unless the user explicitly asked for it.

Require SQLx Macros

Prefer compile-time checked SQLx macros for changed queries:

  • sqlx::query!
  • sqlx::query_as!
  • sqlx::query_scalar!
  • sqlx::query_file!

Flag changed code that calls SQLx query functions directly, such as:

sqlx::query("SELECT ...")
sqlx::query_as::<_, MyType>("SELECT ...")
sqlx::query_scalar("SELECT ...")

Replace direct function calls with the equivalent macro whenever the SQL text is static enough for SQLx to check at compile time.

Only allow direct SQLx query functions when the SQL must be dynamically assembled and cannot reasonably be expressed with a macro. In that case:

  • Keep dynamic fragments constrained to trusted allowlists, not raw user input.
  • Bind all values with .bind(...); never interpolate user-controlled values into SQL strings.
  • Add or preserve a clear comment explaining why a macro cannot be used.

Refresh SQLx Offline Cache

When SQLx queries were changed, run this from the repository root:

just prepare_db

If it fails, inspect the error. Fix in-scope query/cache issues and rerun just prepare_db. If it still fails for environmental reasons, stop and report the failure clearly.

Performance Review Checklist

For each changed query, inspect the SQL and surrounding code for likely performance problems:

  • Avoid unbounded result sets; prefer explicit LIMIT, pagination, or keyset pagination where applicable.
  • Ensure filters and joins are likely backed by appropriate indexes for high-cardinality or frequently queried columns.
  • Avoid SELECT * in production queries; select only needed columns.
  • Avoid N+1 query patterns in loops; prefer batching or joins.
  • Watch for leading-wildcard LIKE / ILIKE searches, broad JSON scans, or functions on indexed columns that may prevent index use.
  • Check joins for accidental cross joins or missing join predicates.
  • Prefer stable ordering for paginated queries.

Security Review Checklist

For each changed query, inspect for security issues:

  • No string interpolation, format!, concatenation, or raw user input in SQL text.
  • User-controlled values must be passed as SQLx bind parameters.
  • Dynamic identifiers, order-by fields, directions, table names, and column names must come from trusted allowlists.
  • Avoid leaking sensitive data by selecting or returning columns that are not needed.
  • Verify tenant, organization, user, or access-control predicates are present where the surrounding domain requires them.
  • Be cautious with destructive statements (DELETE, UPDATE, INSERT ... ON CONFLICT) and ensure predicates are correctly scoped.

Final Response

Briefly summarize:

  • Which changed SQLx queries were reviewed.
  • Whether all changed queries use SQLx macros, or why any direct function call remains justified.
  • Whether just prepare_db passed, failed, or was skipped because no SQLx queries changed.
  • Any performance or security concerns found and fixed, or that none were found.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Wrap a new backend endpoint in the TypeScript SDK (packages/sdk), or record it as skipped. Use when `just coverage` fails, or after adding an endpoint to a Rust service.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

macro-inc/macro4.7천2026년 10월 19일 업데이트

add-tour

무료

Add or change an in-app feature tour (a view's guided flyover) in the web app. Use when adding a tour to a view, adding or editing tour steps, pointing a step at a new control, or when a step's target needs something opened first.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

macro-inc/macro4.7천2026년 10월 19일 업데이트

audit

무료

Post-change checks before handing off. Works out which checks apply from the files changed (directory AGENTS.md Checks sections and matching .agents/rules), runs or verifies each, and reports pass/fail/skipped. Use before saying work is done, before pushing, or when asked to audit or verify a change.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

macro-inc/macro4.7천2026년 10월 19일 업데이트

Enforce hexagonal architecture in the Rust backend. Use before modifying crates/ or Rust services, especially inbound axum/tool/listener adapters, domain services/ports, outbound adapters, authorization, permissions, database access, or external clients.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

macro-inc/macro4.7천2026년 10월 19일 업데이트

Use when adding collaborative markdown, notes, or descriptions to a feature with collab surfaces. Covers parent entities, service entry points, authorization, content storage, and lifecycle.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

macro-inc/macro4.7천2026년 10월 19일 업데이트

Build a new AI tool end-to-end — Rust implementation, toolset wiring, infra, schema generation, and frontend UI.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

macro-inc/macro4.7천2026년 10월 19일 업데이트

macro-inc의 스킬 모두 보기

이 스킬의 문제 신고