cc-codeconductor 1.7.1 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2689 -528
- package/dist/library.js +859 -715
- package/dist/validation/schemas.d.ts +784 -138
- package/dist/validation/scoped-context-schemas.d.ts +1074 -0
- package/package.json +3 -2
- package/presets/agy/skills/database-migrations/SKILL.md +64 -0
- package/presets/agy/skills/rust-async/SKILL.md +64 -0
- package/presets/agy/skills/rust-engineering/SKILL.md +69 -0
- package/presets/agy/skills/rust-sqlx/SKILL.md +64 -0
- package/presets/claude/settings.json +1 -8
- package/presets/claude/skills/database-migrations/SKILL.md +64 -0
- package/presets/claude/skills/rust-async/SKILL.md +64 -0
- package/presets/claude/skills/rust-engineering/SKILL.md +69 -0
- package/presets/claude/skills/rust-sqlx/SKILL.md +64 -0
- package/presets/codex/skills/database-migrations/SKILL.md +64 -0
- package/presets/codex/skills/rust-async/SKILL.md +64 -0
- package/presets/codex/skills/rust-engineering/SKILL.md +69 -0
- package/presets/codex/skills/rust-sqlx/SKILL.md +64 -0
- package/presets/cursor/skills/database-migrations/SKILL.md +64 -0
- package/presets/cursor/skills/rust-async/SKILL.md +64 -0
- package/presets/cursor/skills/rust-engineering/SKILL.md +69 -0
- package/presets/cursor/skills/rust-sqlx/SKILL.md +64 -0
- package/presets/opencode/skills/database-migrations/SKILL.md +64 -0
- package/presets/opencode/skills/rust-async/SKILL.md +64 -0
- package/presets/opencode/skills/rust-engineering/SKILL.md +69 -0
- package/presets/opencode/skills/rust-sqlx/SKILL.md +64 -0
- package/src/presets/shared-skills.yml +8 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: rust-sqlx
|
|
3
|
+
name: rust-sqlx
|
|
4
|
+
description: >
|
|
5
|
+
sqlx in Rust: query macros and offline metadata, pool acquisition,
|
|
6
|
+
transactions and migrations.
|
|
7
|
+
Trigger: When touching sqlx queries, pools, transactions, .sqlx metadata or migrations in a Rust package.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Rust sqlx
|
|
11
|
+
|
|
12
|
+
## Activation
|
|
13
|
+
|
|
14
|
+
Apply when the owning package declares `sqlx` (normal dependency) and the
|
|
15
|
+
change touches queries, pool/transaction code, `.sqlx/` or `migrations/`. For a
|
|
16
|
+
dev-only `sqlx`, apply to tests only.
|
|
17
|
+
|
|
18
|
+
## Inputs
|
|
19
|
+
|
|
20
|
+
- `sqlx` features (database driver, `migrate`, `offline`, runtime).
|
|
21
|
+
- `DATABASE_URL` source, `.sqlx/` directory, `migrations/` directory.
|
|
22
|
+
|
|
23
|
+
## Procedure
|
|
24
|
+
|
|
25
|
+
1. **Query macros.** Condition: `query!`/`query_as!` are used. Action: they check
|
|
26
|
+
against `DATABASE_URL` or the `.sqlx` metadata at build time. Any query or
|
|
27
|
+
schema change requires regenerating metadata. Exception: queries built with
|
|
28
|
+
non-macro `query()` are not checked at build. Verify: `cargo sqlx prepare
|
|
29
|
+
--check` (add `--workspace` in a workspace).
|
|
30
|
+
2. **Stale metadata** (`sqlx.metadata-stale`). Condition: queries or migrations
|
|
31
|
+
changed. Action: run `cargo sqlx prepare` against a database migrated to the
|
|
32
|
+
current schema and commit `.sqlx/`. Exception: repository builds only online.
|
|
33
|
+
Verify: `cargo sqlx prepare --check` exits 0; CI builds with `DATABASE_URL`
|
|
34
|
+
unset.
|
|
35
|
+
3. **Nested acquisition** (`sqlx.nested-acquisition`). Condition: code holds a
|
|
36
|
+
pooled connection or transaction and calls something that acquires another.
|
|
37
|
+
Action: pass the held `&mut` connection/transaction down; never acquire from
|
|
38
|
+
the pool while holding one. Exception: a pool sized above the maximum nesting,
|
|
39
|
+
documented. Verify: a test with `max_connections(1)` that does not time out
|
|
40
|
+
(`acquire_timeout` bounds the wait).
|
|
41
|
+
4. **Transactions.** Condition: several statements must succeed together.
|
|
42
|
+
Action: one transaction, explicit `commit()`; drop without commit rolls
|
|
43
|
+
back. Exception: independent idempotent statements. Verify: a test forcing
|
|
44
|
+
an error between statements and asserting no partial write.
|
|
45
|
+
5. **Migrations.** Apply `database-migrations` for content; here only: embed
|
|
46
|
+
with `sqlx::migrate!` and run once at startup or deploy, not per request.
|
|
47
|
+
|
|
48
|
+
## Decisions and exceptions
|
|
49
|
+
|
|
50
|
+
- Do not edit an applied migration; add a new one (checksums are validated).
|
|
51
|
+
- Do not widen pool size to hide a nested-acquisition bug.
|
|
52
|
+
- Unknown boundary (is this a data-access layer?): ask or report it; do not guess.
|
|
53
|
+
|
|
54
|
+
## Evidence
|
|
55
|
+
|
|
56
|
+
Exit code of `cargo sqlx prepare --check` and of `cargo test -p <package>`
|
|
57
|
+
with a database available. Without a database, report macros as unverified.
|
|
58
|
+
|
|
59
|
+
## References
|
|
60
|
+
|
|
61
|
+
- https://docs.rs/sqlx/latest/sqlx/macro.query.html (offline mode)
|
|
62
|
+
- https://github.com/launchbadge/sqlx/blob/main/sqlx-cli/README.md
|
|
63
|
+
- https://docs.rs/sqlx/latest/sqlx/macro.migrate.html
|
|
64
|
+
- https://docs.rs/sqlx/latest/sqlx/pool/struct.PoolOptions.html
|
|
@@ -132,3 +132,11 @@ skills:
|
|
|
132
132
|
targets: [claude, codex, opencode]
|
|
133
133
|
- name: security
|
|
134
134
|
targets: [claude, opencode]
|
|
135
|
+
- name: rust-engineering
|
|
136
|
+
targets: [claude, codex, cursor, opencode, agy]
|
|
137
|
+
- name: rust-async
|
|
138
|
+
targets: [claude, codex, cursor, opencode, agy]
|
|
139
|
+
- name: rust-sqlx
|
|
140
|
+
targets: [claude, codex, cursor, opencode, agy]
|
|
141
|
+
- name: database-migrations
|
|
142
|
+
targets: [claude, codex, cursor, opencode, agy]
|