pi-rust-skills 0.1.0

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.
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: rust-database
3
+ description: Builds and reviews Rust database code with SQLx, Diesel, migrations, transactions, pooling, query validation, test databases, schema drift checks, and async database error handling. Use for Rust persistence and data access work.
4
+ license: MIT
5
+ compatibility: Rust stable. Common tools include SQLx, Diesel, refinery, sea-query, PostgreSQL, SQLite, and MySQL.
6
+ ---
7
+
8
+ # Rust Database
9
+
10
+ Use this skill when implementing, testing, or reviewing Rust data access layers, migrations, and database-backed workflows.
11
+
12
+ ## Workflow
13
+
14
+ 1. Inspect `Cargo.toml`, workspace shape, feature flags, target crates, and `rust_project_context` output when available.
15
+ 2. Identify the database engine, migration tool, connection pool, schema ownership, and transaction boundaries.
16
+ 3. Keep SQL/data access behind a small module or repository boundary that is easy to test.
17
+ 4. Add tests for migrations, query behavior, transaction rollback, uniqueness/conflict handling, and missing-row behavior.
18
+ 5. Validate schema and query checks using the project's chosen tool.
19
+
20
+ ## Design rules
21
+
22
+ - Prefer compile-time checked queries when SQLx offline data or live database validation is available.
23
+ - Keep migrations forward-only unless the project already maintains down migrations.
24
+ - Use transactions for multi-step invariants and make rollback behavior explicit.
25
+ - Configure pool size, timeouts, and retry policy deliberately.
26
+ - Map database errors into domain errors at the boundary.
27
+ - Avoid leaking raw SQL errors to user-facing API responses.
28
+ - Treat schema drift between migrations, generated types, and tests as a correctness bug.
29
+
30
+ ## Commands
31
+
32
+ ```bash
33
+ cargo test --workspace --all-features
34
+ cargo clippy --workspace --all-targets --all-features -- -D warnings
35
+ sqlx migrate run
36
+ sqlx prepare --check
37
+ diesel migration run
38
+ ```
39
+
40
+ Use the commands that match the project. Do not require SQLx or Diesel if the project uses another migration path.
41
+
42
+ ## Testing
43
+
44
+ - Use isolated test databases, transactions, schemas, or temporary SQLite files.
45
+ - Seed only the records each test needs.
46
+ - Test constraints and conflict cases, not only happy-path queries.
47
+ - Keep tests deterministic and independent of production data.
48
+
49
+ ## Avoid
50
+
51
+ - Do not build SQL by string concatenation with untrusted input.
52
+ - Do not add global database state that makes tests order-dependent.
53
+ - Do not hide failed migrations or query validation behind broad error handling.
54
+
55
+ ## Output expectations
56
+
57
+ Report schema or query changes, migration behavior, transaction assumptions, validation commands, and required database setup.
@@ -0,0 +1,100 @@
1
+ ---
2
+ name: rust-debugging
3
+ description: Diagnoses Rust compiler errors, borrow checker issues, panics, failing tests, cargo build problems, feature resolution conflicts, runtime bugs, and platform-specific failures. Use when Rust code does not compile or behaves incorrectly.
4
+ license: MIT
5
+ compatibility: Rust stable toolchain with cargo recommended.
6
+ ---
7
+
8
+ # Rust Debugging
9
+
10
+ Use this skill when Rust code fails to compile, tests fail, a panic occurs, or behavior differs from expectations.
11
+
12
+ ## Workflow
13
+
14
+ 1. Inspect `Cargo.toml`, workspace shape, feature flags, target crates, and `rust_project_context` output when available.
15
+ 2. Capture the exact failing command and full error output.
16
+ 3. Identify the failure class:
17
+ - Compiler error.
18
+ - Borrow checker or lifetime issue.
19
+ - Trait bound or type inference issue.
20
+ - Cargo dependency, feature, or workspace issue.
21
+ - Test assertion failure.
22
+ - Runtime panic or logic bug.
23
+ - Proc macro, build script, generated code, or target-specific failure.
24
+ 4. Reduce the problem to the smallest relevant module, function, feature set, target, or test.
25
+ 5. Apply the narrowest fix that preserves intent.
26
+ 6. Re-run the original failing command and then the broader validation suite.
27
+
28
+ ## Useful commands
29
+
30
+ ```bash
31
+ cargo check --all-targets --all-features
32
+ cargo test --all-features -- --nocapture
33
+ RUST_BACKTRACE=1 cargo test failing_test_name -- --nocapture
34
+ cargo tree -e features
35
+ cargo metadata --format-version 1
36
+ cargo clean -p crate_name
37
+ ```
38
+
39
+ For workspaces, prefer package-scoped commands while isolating the problem:
40
+
41
+ ```bash
42
+ cargo check -p crate_name --all-targets --all-features
43
+ cargo test -p crate_name test_name -- --nocapture
44
+ cargo check --target target-triple
45
+ ```
46
+
47
+ For macro-heavy or generated code:
48
+
49
+ ```bash
50
+ cargo expand package_or_module
51
+ ```
52
+
53
+ Use `cargo expand` only if installed or worth installing.
54
+
55
+ Use `cargo bisect-rustc` only when a compiler regression is plausible and the issue cannot be explained by project changes.
56
+
57
+ ## Triage notes
58
+
59
+ - For proc macro failures, inspect expanded code and the compile-fail test if one exists.
60
+ - For `build.rs` failures, inspect environment variables, native toolchain assumptions, generated files, and rerun directives.
61
+ - For feature conflicts, compare `cargo tree -e features` output for the failing and passing commands.
62
+ - For target-specific failures, confirm `cfg` branches, target dependencies, linker settings, and installed targets.
63
+ - Prefer a small reproducer in a temporary crate when dependency, compiler, or macro behavior is unclear.
64
+
65
+ ## Borrow checker strategy
66
+
67
+ - First, shorten borrow scopes with blocks or temporary variables.
68
+ - Split immutable reads from mutable writes.
69
+ - Move computation before mutation when possible.
70
+ - Prefer `Option::take`, `mem::take`, or `std::mem::replace` when moving out of fields.
71
+ - Avoid reflexively adding `clone`; only clone when ownership is semantically required.
72
+ - If lifetimes become complex, reconsider the data model and ownership boundaries.
73
+
74
+ ## Trait and generic errors
75
+
76
+ - Find the first real error; later errors are often fallout.
77
+ - Check whether a type parameter needs a bound like `Send`, `Sync`, `Clone`, `Debug`, `DeserializeOwned`, or a lifetime bound.
78
+ - Prefer simple concrete types until generic reuse is justified.
79
+ - For async trait issues, check whether the returned future must be `Send`.
80
+
81
+ ## Panics
82
+
83
+ - Search for `unwrap`, `expect`, indexing, `panic!`, `todo!`, and `unreachable!`.
84
+ - Add context-rich errors rather than silently defaulting.
85
+ - For tests, assert the expected error rather than accepting any failure.
86
+
87
+ ## Avoid
88
+
89
+ - Do not hide errors with broad defaults, extra clones, or relaxed trait bounds.
90
+ - Do not weaken tests, lints, or feature coverage to make a failure disappear.
91
+ - Do not rewrite unrelated working code while isolating the root cause.
92
+
93
+ ## Output expectations
94
+
95
+ Provide:
96
+
97
+ - Root cause.
98
+ - Minimal code change.
99
+ - Why the fix satisfies Rust's ownership/type rules.
100
+ - Commands used to verify the fix.
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: rust-embedded-no-std
3
+ description: Builds and reviews Rust embedded and no_std projects with target triples, HALs, panic handlers, alloc constraints, probe/debug workflows, cross-compilation, hardware abstraction, and host-side tests. Use for firmware, microcontrollers, and constrained Rust targets.
4
+ license: MIT
5
+ compatibility: Rust stable or nightly depending on target. Embedded work may require target toolchains, probe-rs, cargo-embed, and hardware access.
6
+ ---
7
+
8
+ # Rust Embedded No Std
9
+
10
+ Use this skill when working on firmware, `no_std` crates, hardware abstraction layers, or constrained Rust targets.
11
+
12
+ ## Workflow
13
+
14
+ 1. Inspect `Cargo.toml`, workspace shape, feature flags, target crates, `.cargo/config.toml`, and `rust_project_context` output when available.
15
+ 2. Identify the target triple, board, HAL, runtime, panic strategy, allocator policy, and hardware access requirements.
16
+ 3. Separate platform-neutral logic from hardware-specific code so host-side tests can cover core behavior.
17
+ 4. Validate host tests first, then target builds, then hardware or simulator checks when available.
18
+ 5. Document any hardware-only validation that could not be run locally.
19
+
20
+ ## Design rules
21
+
22
+ - Use `#![no_std]` only where required; keep shared crates `std`-optional when useful.
23
+ - Gate `alloc` usage explicitly and avoid hidden heap requirements.
24
+ - Keep interrupt handlers, DMA ownership, and peripheral access rules precise.
25
+ - Prefer HAL traits for portability when the abstraction does not hide critical hardware behavior.
26
+ - Choose panic handlers and logging/defmt strategy intentionally.
27
+ - Keep unsafe code small and document register, pointer, and concurrency invariants.
28
+
29
+ ## Commands
30
+
31
+ ```bash
32
+ cargo test --workspace --all-features
33
+ cargo build --target target-triple
34
+ cargo check -p crate_name --target target-triple --no-default-features
35
+ cargo clippy --workspace --all-targets --all-features -- -D warnings
36
+ ```
37
+
38
+ Use `probe-rs`, `cargo embed`, `cargo flash`, or board-specific tools only when the project already uses them or hardware validation is requested.
39
+
40
+ ## Testing
41
+
42
+ - Put pure logic in host-testable crates or modules.
43
+ - Use feature flags to separate host tests from firmware builds.
44
+ - For register-level or unsafe code, add compile checks and narrow unit tests around safe wrappers.
45
+ - Record board, probe, firmware profile, and target triple for hardware runs.
46
+
47
+ ## Avoid
48
+
49
+ - Do not introduce `std`, heap allocation, or blocking behavior into constrained code accidentally.
50
+ - Do not assume hardware access is available in CI.
51
+ - Do not weaken target builds because host tests pass.
52
+
53
+ ## Output expectations
54
+
55
+ Report target assumptions, feature gates, hardware validation status, commands run, and any safety invariants.
@@ -0,0 +1,103 @@
1
+ ---
2
+ name: rust-ffi
3
+ description: Implements and reviews Rust FFI with C ABI, repr(C), raw pointers, ownership transfer, bindgen, cbindgen, unsafe boundaries, dynamic libraries, and cross-language tests. Use when Rust interoperates with C, C++, or other native languages.
4
+ license: MIT
5
+ compatibility: Requires careful unsafe review. C toolchain may be required depending on target.
6
+ ---
7
+
8
+ # Rust FFI
9
+
10
+ Use this skill when Rust crosses a native language boundary through C ABI, dynamic libraries, generated bindings, or embedded Rust.
11
+
12
+ ## Workflow
13
+
14
+ 1. Inspect `Cargo.toml`, workspace shape, feature flags, target crates, and `rust_project_context` output when available.
15
+ 2. Define ownership and lifetime contracts before writing code.
16
+ 3. Keep unsafe code at the boundary and expose safe Rust internally.
17
+ 4. Use `repr(C)` only for types that cross the ABI boundary.
18
+ 5. Validate nullability, allocation ownership, string encoding, alignment, unwinding, and thread-safety.
19
+ 6. Add cross-language smoke tests or examples when possible.
20
+
21
+ ## Exporting Rust to C
22
+
23
+ ```rust
24
+ #[repr(C)]
25
+ pub struct MyResult {
26
+ pub code: i32,
27
+ }
28
+
29
+ #[unsafe(no_mangle)]
30
+ pub extern "C" fn my_library_do_work(input: *const std::ffi::c_char) -> MyResult {
31
+ if input.is_null() {
32
+ return MyResult { code: -1 };
33
+ }
34
+
35
+ let input = unsafe { std::ffi::CStr::from_ptr(input) };
36
+ match input.to_str() {
37
+ Ok(value) => {
38
+ let _ = value;
39
+ MyResult { code: 0 }
40
+ }
41
+ Err(_) => MyResult { code: -2 },
42
+ }
43
+ }
44
+ ```
45
+
46
+ Every unsafe block needs a safety comment explaining why pointers, aliasing, initialization, and lifetimes are valid.
47
+
48
+ Prevent Rust panics from crossing FFI boundaries. Convert failures into explicit status codes or error handles, and use `catch_unwind` only when the boundary can safely recover.
49
+
50
+ ## Cargo setup
51
+
52
+ For a dynamic/static library:
53
+
54
+ ```toml
55
+ [lib]
56
+ crate-type = ["cdylib", "staticlib", "rlib"]
57
+ ```
58
+
59
+ For generating headers:
60
+
61
+ ```bash
62
+ cbindgen --config cbindgen.toml --crate crate_name --output include/crate_name.h
63
+ ```
64
+
65
+ For consuming C headers:
66
+
67
+ ```bash
68
+ bindgen wrapper.h -o src/bindings.rs
69
+ ```
70
+
71
+ ## Safety checklist
72
+
73
+ - Who allocates memory?
74
+ - Who frees memory?
75
+ - Is there a paired free function for every Rust allocation handed to foreign code?
76
+ - Can null pointers be passed?
77
+ - Are buffers length-delimited?
78
+ - Are strings UTF-8, UTF-16, or platform-native?
79
+ - Are callbacks called synchronously or asynchronously?
80
+ - Can foreign code call from multiple threads?
81
+ - Is unwinding across FFI prevented?
82
+ - How is ABI versioning or symbol compatibility managed?
83
+ - Are generated headers checked into the repo or generated in release builds?
84
+
85
+ ## Validation
86
+
87
+ ```bash
88
+ cargo test --all-features
89
+ cargo clippy --workspace --all-targets --all-features -- -D warnings
90
+ ```
91
+
92
+ For FFI code, also run platform-specific build commands and any C/C++ integration test harness available.
93
+ Use sanitizers or valgrind-style tooling when the project already supports them or memory ownership is risky.
94
+
95
+ ## Output expectations
96
+
97
+ Document ABI contracts, safety invariants, ownership rules, and test evidence. Treat missing safety comments as review findings.
98
+
99
+ ## Avoid
100
+
101
+ - Do not expose Rust-owned memory without an explicit free path.
102
+ - Do not let panics unwind into foreign callers.
103
+ - Do not change ABI layout without versioning or release notes.
@@ -0,0 +1,101 @@
1
+ ---
2
+ name: rust-performance
3
+ description: Profiles and optimizes Rust code for CPU, memory, allocations, binary size, async throughput, dependency bloat, and algorithmic complexity. Use when Rust code is slow, allocates too much, or needs performance review.
4
+ license: MIT
5
+ compatibility: Rust stable. Optional tools include criterion, cargo-flamegraph, heaptrack, samply, perf, dhat, and cargo-bloat.
6
+ ---
7
+
8
+ # Rust Performance
9
+
10
+ Use this skill when the user asks to speed up Rust code, reduce allocations, shrink binary size, or explain performance tradeoffs.
11
+
12
+ ## Workflow
13
+
14
+ 1. Inspect `Cargo.toml`, workspace shape, feature flags, target crates, and `rust_project_context` output when available.
15
+ 2. Define the performance goal, workload, baseline command, and acceptable tradeoffs.
16
+ 3. Measure before changing code.
17
+ 4. Look for algorithmic improvements before micro-optimizations.
18
+ 5. Make one change at a time and compare results.
19
+ 6. Preserve readability unless the measured gain justifies complexity.
20
+
21
+ ## Measurement commands
22
+
23
+ ```bash
24
+ cargo test --release
25
+ cargo bench
26
+ cargo build --release
27
+ cargo test -p crate_name --release
28
+ ```
29
+
30
+ Optional tools when installed:
31
+
32
+ ```bash
33
+ cargo flamegraph --bench bench_name
34
+ cargo bloat --release --crates
35
+ heaptrack target/release/binary_name
36
+ ```
37
+
38
+ Use `criterion` for stable benchmarks:
39
+
40
+ ```toml
41
+ [dev-dependencies]
42
+ criterion = "0.5"
43
+
44
+ [[bench]]
45
+ name = "throughput"
46
+ harness = false
47
+ ```
48
+
49
+ Record results in a compact form:
50
+
51
+ ```text
52
+ workload: parse 10 MB fixture
53
+ baseline: 125 ms median, 12.4 MB allocated
54
+ change: reuse parse buffer
55
+ after: 88 ms median, 4.1 MB allocated
56
+ tradeoff: parser state is now explicit
57
+ ```
58
+
59
+ ## Common Rust performance checks
60
+
61
+ - Avoid unnecessary `String` allocation; prefer `&str` where ownership is not needed.
62
+ - Avoid repeated allocation inside loops; reuse buffers.
63
+ - Prefer iterator clarity, but verify generated performance when hot.
64
+ - Use `HashMap::with_capacity` when size is known.
65
+ - Avoid cloning large structures; clone IDs or handles instead.
66
+ - Use `Cow` only when it simplifies a real borrowed-or-owned API.
67
+ - Check `Debug` or formatting in hot paths.
68
+ - Avoid holding async locks in hot loops.
69
+
70
+ ## Binary size
71
+
72
+ ```toml
73
+ [profile.release]
74
+ lto = true
75
+ codegen-units = 1
76
+ strip = true
77
+ panic = "abort"
78
+ ```
79
+
80
+ Review dependencies and features before adding size-focused profile settings.
81
+
82
+ Measure before and after with `cargo bloat --release --crates`, `twiggy`, or artifact size checks when available.
83
+
84
+ ## Async throughput
85
+
86
+ - Look for blocking calls on executor workers.
87
+ - Add bounded queues for backpressure.
88
+ - Batch small operations when safe.
89
+ - Avoid unbounded task spawning.
90
+ - Use `tracing` to find slow spans.
91
+ - Measure throughput, tail latency, queue depth, and cancellation behavior under realistic concurrency.
92
+
93
+ ## Output expectations
94
+
95
+ Provide baseline measurement, change made, new measurement, tradeoffs, and commands used. If no measurement is possible, clearly label recommendations as hypotheses.
96
+
97
+ ## Avoid
98
+
99
+ - Do not optimize without a baseline unless clearly labeled as a hypothesis.
100
+ - Do not trade away correctness, cancellation, or public API clarity for unmeasured gains.
101
+ - Do not add profile settings before checking dependency and feature bloat.
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: rust-proc-macro
3
+ description: Builds and reviews Rust procedural macros with syn, quote, derive macros, attribute macros, diagnostics, span hygiene, generated code review, trybuild compile-fail tests, and cargo expand. Use for proc macro implementation and debugging.
4
+ license: MIT
5
+ compatibility: Rust stable with proc-macro crates. Common tools include syn, quote, proc-macro2, trybuild, and cargo-expand.
6
+ ---
7
+
8
+ # Rust Proc Macro
9
+
10
+ Use this skill when implementing, testing, debugging, or reviewing Rust procedural macros.
11
+
12
+ ## Workflow
13
+
14
+ 1. Inspect `Cargo.toml`, workspace shape, feature flags, target crates, and `rust_project_context` output when available.
15
+ 2. Identify the macro kind: derive, attribute, or function-like macro.
16
+ 3. Define accepted input syntax, generated API, diagnostics, and compatibility expectations.
17
+ 4. Inspect expanded output for representative examples.
18
+ 5. Add runtime tests for generated behavior and compile-fail tests for invalid input.
19
+
20
+ ## Design rules
21
+
22
+ - Keep parsing strict enough to produce useful diagnostics and permissive enough for valid Rust syntax.
23
+ - Prefer `syn` parsing types over token-string manipulation.
24
+ - Use spans from user input for errors so diagnostics point to the right code.
25
+ - Keep generated code simple, hygienic, and independent of local imports.
26
+ - Reference external crates with absolute paths or documented crate-name configuration.
27
+ - Avoid generating hidden panics for user input errors; emit compile errors instead.
28
+
29
+ ## Commands
30
+
31
+ ```bash
32
+ cargo test --workspace --all-features
33
+ cargo test -p macro_crate
34
+ cargo expand -p example_crate
35
+ cargo clippy --workspace --all-targets --all-features -- -D warnings
36
+ ```
37
+
38
+ Use `cargo expand` when installed or when generated code needs inspection.
39
+
40
+ ## Testing
41
+
42
+ - Use `trybuild` for compile-pass and compile-fail diagnostics.
43
+ - Keep test fixtures small and named after the behavior they prove.
44
+ - Add tests for generics, lifetimes, visibility, attributes, where clauses, and path hygiene.
45
+ - Review stderr snapshots before accepting diagnostic changes.
46
+
47
+ ## Avoid
48
+
49
+ - Do not parse Rust by splitting strings.
50
+ - Do not rely on caller imports unless that is part of the documented contract.
51
+ - Do not change generated public API without semver review.
52
+
53
+ ## Output expectations
54
+
55
+ Report macro inputs, generated behavior, diagnostics changed, expansion checks, and tests run.
@@ -0,0 +1,130 @@
1
+ ---
2
+ name: rust-project-bootstrap
3
+ description: Creates new Rust crates or workspaces, chooses binary/library layouts, configures Cargo.toml, rustfmt, clippy, CI, tests, examples, feature flags, and initial project structure. Use when starting or restructuring a Rust project.
4
+ license: MIT
5
+ compatibility: Rust stable toolchain with cargo, rustfmt, and clippy recommended.
6
+ ---
7
+
8
+ # Rust Project Bootstrap
9
+
10
+ Use this skill when the task is to create a new Rust project, convert a single crate into a workspace, add a new crate, or make an existing project feel production-ready.
11
+
12
+ ## Workflow
13
+
14
+ 1. Inspect the target directory first. If it already has `Cargo.toml`, inspect workspace shape, feature flags, target crates, and `rust_project_context` output when available; preserve intent.
15
+ 2. Choose the smallest fitting project shape:
16
+ - CLI app: `src/main.rs`, `src/cli.rs`, integration tests in `tests/`.
17
+ - Library crate: `src/lib.rs`, examples in `examples/`, docs on public APIs.
18
+ - Workspace: root `Cargo.toml` with `[workspace]`, one crate per responsibility under `crates/`.
19
+ 3. Add a clean baseline:
20
+ - `.gitignore` with `target/`.
21
+ - `rust-toolchain.toml` if the user wants pinned Rust.
22
+ - `rustfmt.toml` only for intentional formatting choices.
23
+ - `.cargo/config.toml` only when needed for aliases, target config, or lint consistency.
24
+ - GitHub Actions CI if the project has or should have a public repo.
25
+ 4. Create a validation path before writing much code: `cargo fmt --check`, `cargo clippy --all-targets --all-features -- -D warnings`, and `cargo test --all-features`.
26
+ 5. Prefer standard crates only until the project requirements justify dependencies.
27
+
28
+ ## Cargo defaults
29
+
30
+ Derive edition, resolver, and MSRV from the user's policy or the existing project. For new modern projects, prefer:
31
+
32
+ ```toml
33
+ [package]
34
+ edition = "2024"
35
+ rust-version = "1.85"
36
+ license = "MIT OR Apache-2.0"
37
+
38
+ [dependencies]
39
+ ```
40
+
41
+ When compatibility matters, use edition 2021 unless the user asks for latest Rust patterns.
42
+
43
+ For applications, commit `Cargo.lock`. For libraries, follow the repository's existing policy; include it only when the workspace or project wants reproducible development checks.
44
+
45
+ Design feature flags before adding optional dependencies:
46
+
47
+ - Keep default features small and unsurprising.
48
+ - Name features after capabilities, not dependency crate names, unless exposing the dependency is the intent.
49
+ - Avoid mutually exclusive features unless the target platform requires them.
50
+
51
+ ## Workspace layout
52
+
53
+ Use this shape for multi-crate projects:
54
+
55
+ ```text
56
+ project/
57
+ ├── Cargo.toml
58
+ ├── README.md
59
+ ├── crates/
60
+ │ ├── app/
61
+ │ │ ├── Cargo.toml
62
+ │ │ └── src/main.rs
63
+ │ └── core/
64
+ │ ├── Cargo.toml
65
+ │ └── src/lib.rs
66
+ ├── tests/
67
+ └── .github/workflows/ci.yml
68
+ ```
69
+
70
+ Use crate names that match responsibility, such as `core`, `cli`, `server`, or `bindings`. Avoid vague member names like `common` unless the shared boundary is clear.
71
+
72
+ ## Baseline docs
73
+
74
+ - Add README content with purpose, install/run instructions, minimal example, validation commands, and license.
75
+ - Add license files or metadata matching the selected license expression.
76
+ - Add public API docs for library crates and `--help` coverage for CLI crates.
77
+
78
+ Root manifest:
79
+
80
+ ```toml
81
+ [workspace]
82
+ members = ["crates/*"]
83
+ resolver = "3"
84
+
85
+ [workspace.package]
86
+ edition = "2024"
87
+ license = "MIT OR Apache-2.0"
88
+ rust-version = "1.85"
89
+
90
+ [workspace.lints.rust]
91
+ unsafe_code = "forbid"
92
+
93
+ [workspace.lints.clippy]
94
+ pedantic = { level = "warn", priority = -1 }
95
+ ```
96
+
97
+ Each member can opt in with:
98
+
99
+ ```toml
100
+ [lints]
101
+ workspace = true
102
+ ```
103
+
104
+ ## Validation
105
+
106
+ After generating files, run:
107
+
108
+ ```bash
109
+ cargo fmt
110
+ cargo check --workspace --all-targets --all-features
111
+ cargo clippy --workspace --all-targets --all-features -- -D warnings
112
+ cargo test --workspace --all-features
113
+ ```
114
+
115
+ If a command fails, fix the project rather than weakening linting. If a lint is intentionally noisy, document why before allowing it.
116
+
117
+ ## Avoid
118
+
119
+ - Do not pin a Rust version, add CI, or introduce workspace complexity unless it matches the project goals.
120
+ - Do not add dependencies before the first real requirement needs them.
121
+ - Do not create public APIs before the crate boundary is clear.
122
+
123
+ ## Output expectations
124
+
125
+ When done, summarize:
126
+
127
+ - Project shape chosen and why.
128
+ - Important files created or changed.
129
+ - Commands run and results.
130
+ - Next implementation tickets for the agent.