Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

sqlx-code-reviewsqlx 代码审查

Agent Skill

sqlx-code-review 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

517

周安装

22

GitHub Stars

54

下载量

181
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:sqlx-code-review(sqlx 代码审查)
来源仓库:https://github.com/existential-birds/beagle
仓库路径:skills/sqlx-code-review
安装命令:
npx skills add https://github.com/existential-birds/beagle --skill sqlx-code-review
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/existential-birds/beagle --skill sqlx-code-review

简介

sqlx-code-review 用于 SQLx 数据库代码审查,确保类型安全与迁移安全。

  • 检查 compile-time 查询验证与连接池配置合理性。
  • 验证 migrations 文件命名与回滚脚本完整性。
  • 需确认 runtime 与 compile-time 查询的选择依据。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

sqlx Code Review

Review Workflow

  1. Check Cargo.toml — Note sqlx features (runtime-tokio, tls-rustls/tls-native-tls, postgres/mysql/sqlite, uuid, chrono, json, migrate) and Rust edition (2024 changes RPIT lifetime capture and removes need for async-trait)
  2. Check query patterns — Compile-time checked (query!, query_as!) vs runtime (query, query_as)
  3. Check pool configuration — Connection limits, timeouts, idle settings
  4. Check migrations — File naming, reversibility, data migration safety
  5. Check type mappings — Rust types align with SQL column types

Output Format

Report findings as:

[FILE:LINE] ISSUE_TITLE
Severity: Critical | Major | Minor | Informational
Description of the issue and why it matters.

Quick Reference

Issue TypeReference
Query macros, bind parameters, result mappingreferences/queries.md
Migrations, pool config, transaction patternsreferences/migrations.md

Review Checklist

Query Patterns

  • Compile-time checked queries (query!, query_as!) used where possible
  • sqlx.toml or DATABASE_URL configured for offline compile-time checking
  • No string interpolation in queries (SQL injection risk) — use bind parameters ($1, $2)
  • query_as! maps to named structs, not anonymous records, for public APIs
  • .fetch_one(), .fetch_optional(), .fetch_all() chosen appropriately
  • .fetch() (streaming) used for large result sets

Connection Pool

  • PgPool shared via Arc or framework state (not created per-request)
  • Pool size configured for the deployment (not left at defaults in production)
  • Connection acquisition timeout set
  • Idle connection cleanup configured
  • Edition 2024: Pool initialization uses std::sync::LazyLock (not once_cell::sync::Lazy or lazy_static!) for static pool singletons

Transactions

  • pool.begin() used for multi-statement operations
  • Transaction committed explicitly (not relying on implicit rollback on drop)
  • Errors within transactions trigger rollback before propagation
  • Nested transactions use savepoints (tx.begin()) if needed

Type Mapping

  • sqlx::Type derives match database column types
  • Enum representations consistent between Rust, serde, and SQL
  • Uuid, DateTime<Utc>, Decimal types used (not strings for structured data)
  • Option<T> used for nullable columns
  • serde_json::Value used for JSONB columns
  • No enum variants or struct fields named gen — reserved keyword in edition 2024 (use r#gen with #[sqlx(rename = "gen")] or choose a different name)

Edition 2024 Compatibility

  • Functions returning -> impl Stream or -> impl Future account for RPIT lifetime capture changes (all in-scope lifetimes captured by default; use + use<'a> for precise control)
  • Custom FromRow or Type trait impls use native async fn in traits where applicable (no #[async_trait] needed, stable since Rust 1.75)
  • Prefer #[expect(unused)] over #[allow(unused)] for compile-time query fields only used in some code paths (self-cleaning lint suppression, stable since 1.81)
  • Static pool initialization uses std::sync::LazyLock (not once_cell or lazy_static!)

Migrations

  • Migration files follow naming convention (YYYYMMDDHHMMSS_description.sql)
  • Destructive migrations (DROP, ALTER DROP COLUMN) are reversible or have data backup plan
  • No data-dependent schema changes in same migration as data changes
  • sqlx::migrate!() called at application startup

Severity Calibration

Critical

  • String interpolation in SQL queries (SQL injection)
  • Missing transaction for multi-statement writes (partial writes on error)
  • Connection pool created per-request (connection exhaustion)
  • Missing bind parameter escaping

Major

  • Runtime queries (query()) where compile-time (query!()) could verify correctness
  • Missing transaction rollback on error paths
  • Enum type mismatch between Rust and database
  • Unbounded .fetch_all() on potentially large tables
  • Field or variant named gen without r#gen escape (edition 2024 compile failure)

Minor

  • Pool defaults used in production without tuning
  • Missing .fetch_optional() (using .fetch_one() then handling error for "not found")
  • Overly broad SELECT * when only specific columns needed
  • Missing indexes for queried columns (flag only if query pattern is clearly slow)
  • Edition 2024: once_cell::sync::Lazy or lazy_static! used where std::sync::LazyLock works
  • Using #[allow(unused)] instead of #[expect(unused)] for query fields (prefer self-cleaning lint suppression)

Informational

  • Suggestions to use query_as! for type-safe result mapping
  • Suggestions to add database-level constraints alongside Rust validation
  • Migration organization improvements

Valid Patterns (Do NOT Flag)

  • Runtime query() for dynamic queries — Compile-time checking doesn't work with dynamic SQL
  • sqlx::FromRow derive — Valid alternative to query_as! for reusable row types
  • TEXT columns for enum storage — Valid with sqlx::Type derive, simpler than custom SQL types
  • .execute() ignoring row count — Acceptable for idempotent operations (upserts, deletes)
  • Shared DB with other languages — e.g., Elixir owns migrations, Rust reads. This is a valid architecture.
  • r#gen with #[sqlx(rename = "gen")] — Correct edition 2024 workaround for gen columns in database types
  • + use<'a> on query helper return types — Precise RPIT lifetime capture (edition 2024)
  • std::sync::LazyLock for static pool initialization — Replaces once_cell/lazy_static (stable since Rust 1.80)
  • Native async fn in custom FromRow/Type trait implsasync-trait crate no longer needed (stable since Rust 1.75)

Before Submitting Findings

Load and follow beagle-rust:review-verification-protocol before reporting any issue.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.91%
按下载量换算65

Claude

29.59%
按下载量换算54

Cursor

18.32%
按下载量换算33

Gemini CLI

9.8%
按下载量换算18

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills