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

sqlx-code-reviewsqlx 代码审查

Agent Skill

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

总安装

5,141

周安装

210

GitHub Stars

公开资料未说明

下载量

1,663
OpenClaw

安装说明

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

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

ClawHubOpenClaw
openclaw skills install sqlx-code-review

简介

审查 sqlx 数据库代码以进行编译时检查。

  • 支持连接池管理、迁移模式和 PostgreSQL 用法审查。
  • 识别潜在的性能和安全问题。sqlx-code-review 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 适用于 Go 项目数据库代码质量保障。
  • 提升 sqlx 框架下的代码健壮性和可维护性。

SKILL.md

name
sqlx-code-review
description
Reviews sqlx database code for compile-time query checking, connection pool management, migration patterns, and PostgreSQL-specific usage. Use when reviewing Rust code that uses sqlx, database queries, connection pools, or migrations. Covers offline mode, type mapping, and transaction patterns.

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

Gates (evidence before severity)

Complete in order; do not assign Critical / Major until the gate for that claim is passed.

  1. Scope — Identify the crate under review (Cargo.toml path) and the .rs files (or directory) you opened. Pass: At least one concrete path you inspected is named.
  2. sqlx / compile claims — Before asserting issues about query! / query_as!, offline mode, sqlx.toml, DATABASE_URL, or Cargo features: open the relevant Cargo.toml and, if applicable, sqlx.toml or documented env. Pass: The finding cites a line or you state that those files were absent / out of scope.
  3. Finding anchors — Each reported issue includes [FILE:LINE] per Output Format. Pass: No Critical or Major without a line reference.
  4. Protocol — Load and complete beagle-rust:review-verification-protocol after gates 1–3 and before final severity labels. Pass: Protocol steps satisfied for each retained finding.

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

Complete Gates (evidence before severity), then load and follow beagle-rust:review-verification-protocol before reporting any issue.

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

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

04

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

补充不同宿主或平台的使用分布数据

能力 5

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

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

平台分布

OpenClaw

70.41%
按下载量换算1,171

安全审计

VirusTotal

未展示

ClawScan

通过

Static analysis

通过

权限和风险

需要联网

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

安装前确认

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

来源信息

继续浏览同类 Skills