agentleFS
lgzarturolgzarturo/codeconductor/.agents/skills/rust-sqlx/SKILL.md

rust-sqlx

Skill0 starsChanged 25 days agoMITView on GitHub

sqlx in Rust: query macros and offline metadata, pool acquisition, transactions and migrations. Trigger: When touching sqlx queries, pools, transactions, .sqlx metadata or migrations in a Rust package.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Verify: cargo sqlx prepare --check exits 0.

    line 33
  2. Distinctive:

    Do not edit an applied migration.

    line 50
  3. Distinctive:

    Do not widen pool size to hide a nested-acquisition bug.

    line 51

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Rust sqlx

Activation

Apply when the owning package declares sqlx (normal dependency) and the change touches queries, pool/transaction code, .sqlx/ or migrations/. For a dev-only sqlx, apply to tests only.

Inputs

  • sqlx features (database driver, migrate, offline, runtime).
  • DATABASE_URL source, .sqlx/ directory, migrations/ directory.

Procedure

  1. Query macros. Condition: query!/query_as! are used. Action: they check against DATABASE_URL or the .sqlx metadata at build time. Any query or schema change requires regenerating metadata. Exception: queries built with non-macro query() are not checked at build. Verify: cargo sqlx prepare --check (add --workspace in a workspace).
  2. Stale metadata (sqlx.metadata-stale). Condition: queries or migrations changed. Action: run cargo sqlx prepare against a database migrated to the current schema and commit .sqlx/. Exception: repository builds only online. Verify: cargo sqlx prepare --check exits 0; CI builds with DATABASE_URL unset.
  3. Nested acquisition (sqlx.nested-acquisition). Condition: code holds a pooled connection or transaction and calls something that acquires another. Action: pass the held &mut connection/transaction down; never acquire from the pool while holding one. Exception: a pool sized above the maximum nesting, documented. Verify: a test with max_connections(1) that does not time out (acquire_timeout bounds the wait).
  4. Transactions. Condition: several statements must succeed together. Action: one transaction, explicit commit(); drop without commit rolls back. Exception: independent idempotent statements. Verify: a test forcing an error between statements and asserting no partial write.
  5. Migrations. Apply database-migrations for content; here only: embed with sqlx::migrate! and run once at startup or deploy, not per request.

Decisions and exceptions

  • Do not edit an applied migration; add a new one (checksums are validated).
  • Do not widen pool size to hide a nested-acquisition bug.
  • Unknown boundary (is this a data-access layer?): ask or report it; do not guess.

Evidence

Exit code of cargo sqlx prepare --check and of cargo test -p <package> with a database available. Without a database, report macros as unverified.

References

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.