@h1dr0n/skill-pool 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.
Files changed (189) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +296 -0
  3. package/bin/cli.js +157 -0
  4. package/package.json +41 -0
  5. package/skills/api/agents/backend-specialist.md +69 -0
  6. package/skills/api/agents/database-optimizer.md +176 -0
  7. package/skills/api/manifest.yaml +20 -0
  8. package/skills/api/rules/auth-security.md +45 -0
  9. package/skills/api/skills/api-patterns/SKILL.md +81 -0
  10. package/skills/api/skills/api-patterns/api-style.md +42 -0
  11. package/skills/api/skills/api-patterns/auth.md +24 -0
  12. package/skills/api/skills/api-patterns/documentation.md +26 -0
  13. package/skills/api/skills/api-patterns/graphql.md +41 -0
  14. package/skills/api/skills/api-patterns/rate-limiting.md +31 -0
  15. package/skills/api/skills/api-patterns/response.md +37 -0
  16. package/skills/api/skills/api-patterns/rest.md +40 -0
  17. package/skills/api/skills/api-patterns/scripts/api_validator.py +211 -0
  18. package/skills/api/skills/api-patterns/security-testing.md +122 -0
  19. package/skills/api/skills/api-patterns/trpc.md +41 -0
  20. package/skills/api/skills/api-patterns/versioning.md +22 -0
  21. package/skills/api/skills/database-patterns.md +126 -0
  22. package/skills/api/skills/deployment-patterns.md +105 -0
  23. package/skills/api/skills/docker-patterns.md +135 -0
  24. package/skills/common/agents/code-reviewer.md +78 -0
  25. package/skills/common/agents/planner.md +80 -0
  26. package/skills/common/agents/security-reviewer.md +82 -0
  27. package/skills/common/agents/software-architect.md +81 -0
  28. package/skills/common/manifest.yaml +25 -0
  29. package/skills/common/rules/coding-style.md +39 -0
  30. package/skills/common/rules/git-workflow.md +33 -0
  31. package/skills/common/rules/security.md +25 -0
  32. package/skills/common/skills/architecture/SKILL.md +55 -0
  33. package/skills/common/skills/architecture/context-discovery.md +43 -0
  34. package/skills/common/skills/architecture/examples.md +94 -0
  35. package/skills/common/skills/architecture/pattern-selection.md +68 -0
  36. package/skills/common/skills/architecture/patterns-reference.md +50 -0
  37. package/skills/common/skills/architecture/trade-off-analysis.md +77 -0
  38. package/skills/common/skills/brainstorming/SKILL.md +163 -0
  39. package/skills/common/skills/brainstorming/dynamic-questioning.md +350 -0
  40. package/skills/common/skills/clean-code.md +99 -0
  41. package/skills/common/skills/code-review-checklist.md +86 -0
  42. package/skills/common/skills/plan-writing/SKILL.md +152 -0
  43. package/skills/common/skills/skill-feedback.md +94 -0
  44. package/skills/common/skills/tdd-workflow.md +130 -0
  45. package/skills/common/skills/verification-loop.md +112 -0
  46. package/skills/cpp/agents/cpp-build-resolver.md +90 -0
  47. package/skills/cpp/agents/cpp-reviewer.md +72 -0
  48. package/skills/cpp/manifest.yaml +15 -0
  49. package/skills/cpp/skills/cpp-coding-standards.md +722 -0
  50. package/skills/cpp/skills/cpp-testing.md +323 -0
  51. package/skills/devops/agents/devops-automator.md +376 -0
  52. package/skills/devops/agents/sre.md +90 -0
  53. package/skills/devops/manifest.yaml +20 -0
  54. package/skills/devops/skills/deployment-patterns.md +427 -0
  55. package/skills/devops/skills/deployment-procedures/SKILL.md +241 -0
  56. package/skills/devops/skills/docker-patterns.md +364 -0
  57. package/skills/devops/skills/e2e-testing.md +326 -0
  58. package/skills/devops/skills/github-ops.md +144 -0
  59. package/skills/django/manifest.yaml +16 -0
  60. package/skills/django/skills/django-patterns.md +734 -0
  61. package/skills/django/skills/django-security.md +593 -0
  62. package/skills/django/skills/django-tdd.md +729 -0
  63. package/skills/django/skills/django-verification.md +469 -0
  64. package/skills/dotnet/agents/csharp-reviewer.md +101 -0
  65. package/skills/dotnet/manifest.yaml +14 -0
  66. package/skills/dotnet/skills/csharp-testing.md +321 -0
  67. package/skills/dotnet/skills/dotnet-patterns.md +321 -0
  68. package/skills/go/agents/code-reviewer.md +76 -0
  69. package/skills/go/agents/go-build-resolver.md +94 -0
  70. package/skills/go/agents/go-reviewer.md +76 -0
  71. package/skills/go/manifest.yaml +17 -0
  72. package/skills/go/rules/go-style.md +55 -0
  73. package/skills/go/skills/golang-patterns.md +674 -0
  74. package/skills/go/skills/golang-testing.md +720 -0
  75. package/skills/java/agents/java-build-resolver.md +153 -0
  76. package/skills/java/agents/java-reviewer.md +92 -0
  77. package/skills/java/manifest.yaml +18 -0
  78. package/skills/java/skills/java-coding-standards.md +147 -0
  79. package/skills/java/skills/jpa-patterns.md +151 -0
  80. package/skills/java/skills/springboot-patterns.md +314 -0
  81. package/skills/java/skills/springboot-security.md +272 -0
  82. package/skills/kotlin/agents/kotlin-build-resolver.md +118 -0
  83. package/skills/kotlin/agents/kotlin-reviewer.md +159 -0
  84. package/skills/kotlin/manifest.yaml +17 -0
  85. package/skills/kotlin/skills/kotlin-coroutines-flows.md +284 -0
  86. package/skills/kotlin/skills/kotlin-patterns.md +711 -0
  87. package/skills/kotlin/skills/kotlin-testing.md +824 -0
  88. package/skills/laravel/manifest.yaml +15 -0
  89. package/skills/laravel/skills/laravel-patterns.md +409 -0
  90. package/skills/laravel/skills/laravel-security.md +279 -0
  91. package/skills/laravel/skills/laravel-tdd.md +277 -0
  92. package/skills/laravel/skills/laravel-verification.md +173 -0
  93. package/skills/mobile/agents/dart-build-resolver.md +201 -0
  94. package/skills/mobile/agents/flutter-reviewer.md +243 -0
  95. package/skills/mobile/manifest.yaml +19 -0
  96. package/skills/mobile/skills/android-clean-architecture.md +339 -0
  97. package/skills/mobile/skills/dart-flutter-patterns.md +563 -0
  98. package/skills/mobile/skills/swiftui-patterns.md +259 -0
  99. package/skills/nestjs/manifest.yaml +13 -0
  100. package/skills/nestjs/skills/nestjs-patterns.md +230 -0
  101. package/skills/perl/manifest.yaml +13 -0
  102. package/skills/perl/skills/perl-patterns.md +504 -0
  103. package/skills/perl/skills/perl-security.md +503 -0
  104. package/skills/perl/skills/perl-testing.md +475 -0
  105. package/skills/python/agents/python-reviewer.md +98 -0
  106. package/skills/python/manifest.yaml +18 -0
  107. package/skills/python/rules/python-style.md +69 -0
  108. package/skills/python/skills/python-patterns/SKILL.md +441 -0
  109. package/skills/python/skills/python-patterns.md +90 -0
  110. package/skills/python/skills/python-testing.md +81 -0
  111. package/skills/rust/agents/rust-build-resolver.md +148 -0
  112. package/skills/rust/agents/rust-reviewer.md +94 -0
  113. package/skills/rust/manifest.yaml +16 -0
  114. package/skills/rust/rules/rust-style.md +107 -0
  115. package/skills/rust/skills/rust-patterns.md +499 -0
  116. package/skills/rust/skills/rust-testing.md +500 -0
  117. package/skills/security/agents/accessibility-auditor.md +316 -0
  118. package/skills/security/agents/security-reviewer.md +108 -0
  119. package/skills/security/manifest.yaml +19 -0
  120. package/skills/security/skills/red-team-tactics/SKILL.md +199 -0
  121. package/skills/security/skills/security-bounty-hunter.md +99 -0
  122. package/skills/security/skills/security-review.md +495 -0
  123. package/skills/security/skills/security-scan.md +165 -0
  124. package/skills/security/skills/vulnerability-scanner/SKILL.md +276 -0
  125. package/skills/security/skills/vulnerability-scanner/checklists.md +121 -0
  126. package/skills/security/skills/vulnerability-scanner/scripts/security_scan.py +458 -0
  127. package/skills/swift/manifest.yaml +16 -0
  128. package/skills/swift/skills/swift-actor-persistence.md +142 -0
  129. package/skills/swift/skills/swift-concurrency.md +216 -0
  130. package/skills/swift/skills/swift-protocol-di-testing.md +190 -0
  131. package/skills/swift/skills/swiftui-patterns.md +259 -0
  132. package/skills/unity/agents/game-designer.md +167 -0
  133. package/skills/unity/agents/unity-architect.md +52 -0
  134. package/skills/unity/agents/unity-editor-tool-developer.md +310 -0
  135. package/skills/unity/agents/unity-multiplayer-engineer.md +321 -0
  136. package/skills/unity/agents/unity-shader-graph-artist.md +269 -0
  137. package/skills/unity/manifest.yaml +21 -0
  138. package/skills/unity/rules/csharp-patterns.md +48 -0
  139. package/skills/unity/rules/unity-specific.md +53 -0
  140. package/skills/unity/skills/systematic-debugging.md +92 -0
  141. package/skills/unity/skills/unity-architecture.md +173 -0
  142. package/skills/unreal/agents/level-designer.md +208 -0
  143. package/skills/unreal/agents/technical-artist.md +229 -0
  144. package/skills/unreal/agents/unreal-multiplayer-architect.md +313 -0
  145. package/skills/unreal/agents/unreal-systems-engineer.md +310 -0
  146. package/skills/unreal/agents/unreal-technical-artist.md +256 -0
  147. package/skills/unreal/agents/unreal-world-builder.md +273 -0
  148. package/skills/unreal/manifest.yaml +21 -0
  149. package/skills/unreal/skills/unreal-patterns.md +183 -0
  150. package/skills/web/agents/frontend-specialist.md +71 -0
  151. package/skills/web/agents/ui-designer.md +383 -0
  152. package/skills/web/agents/ux-architect.md +469 -0
  153. package/skills/web/manifest.yaml +22 -0
  154. package/skills/web/rules/accessibility.md +54 -0
  155. package/skills/web/rules/css-performance.md +52 -0
  156. package/skills/web/skills/e2e-testing.md +132 -0
  157. package/skills/web/skills/frontend-design/SKILL.md +452 -0
  158. package/skills/web/skills/frontend-design/animation-guide.md +331 -0
  159. package/skills/web/skills/frontend-design/color-system.md +311 -0
  160. package/skills/web/skills/frontend-design/decision-trees.md +418 -0
  161. package/skills/web/skills/frontend-design/motion-graphics.md +306 -0
  162. package/skills/web/skills/frontend-design/scripts/accessibility_checker.py +183 -0
  163. package/skills/web/skills/frontend-design/scripts/ux_audit.py +722 -0
  164. package/skills/web/skills/frontend-design/typography-system.md +345 -0
  165. package/skills/web/skills/frontend-design/ux-psychology.md +1116 -0
  166. package/skills/web/skills/frontend-design/visual-effects.md +383 -0
  167. package/skills/web/skills/react-nextjs.md +135 -0
  168. package/skills/web/skills/tailwind-patterns/SKILL.md +269 -0
  169. package/src/adapters/antigravity.js +164 -0
  170. package/src/adapters/claude.js +188 -0
  171. package/src/adapters/cursor.js +161 -0
  172. package/src/adapters/index.js +67 -0
  173. package/src/adapters/windsurf.js +158 -0
  174. package/src/commands/add.js +266 -0
  175. package/src/commands/create.js +127 -0
  176. package/src/commands/diff.js +78 -0
  177. package/src/commands/info.js +88 -0
  178. package/src/commands/init.js +224 -0
  179. package/src/commands/install.js +90 -0
  180. package/src/commands/list.js +54 -0
  181. package/src/commands/remove.js +101 -0
  182. package/src/commands/targets.js +32 -0
  183. package/src/commands/update.js +57 -0
  184. package/src/core/manifest.js +57 -0
  185. package/src/core/plugins.js +86 -0
  186. package/src/core/resolver.js +84 -0
  187. package/src/core/tracker.js +49 -0
  188. package/src/utils/fs.js +80 -0
  189. package/src/utils/git.js +52 -0
@@ -0,0 +1,148 @@
1
+ ---
2
+ name: rust-build-resolver
3
+ description: Rust build, compilation, and dependency error resolution specialist. Fixes cargo build errors, borrow checker issues, and Cargo.toml problems with minimal changes. Use when Rust builds fail.
4
+ tools: ["Read", "Write", "Edit", "Bash", "Grep", "Glob"]
5
+ model: sonnet
6
+ ---
7
+
8
+ # Rust Build Error Resolver
9
+
10
+ You are an expert Rust build error resolution specialist. Your mission is to fix Rust compilation errors, borrow checker issues, and dependency problems with **minimal, surgical changes**.
11
+
12
+ ## Core Responsibilities
13
+
14
+ 1. Diagnose `cargo build` / `cargo check` errors
15
+ 2. Fix borrow checker and lifetime errors
16
+ 3. Resolve trait implementation mismatches
17
+ 4. Handle Cargo dependency and feature issues
18
+ 5. Fix `cargo clippy` warnings
19
+
20
+ ## Diagnostic Commands
21
+
22
+ Run these in order:
23
+
24
+ ```bash
25
+ cargo check 2>&1
26
+ cargo clippy -- -D warnings 2>&1
27
+ cargo fmt --check 2>&1
28
+ cargo tree --duplicates 2>&1
29
+ if command -v cargo-audit >/dev/null; then cargo audit; else echo "cargo-audit not installed"; fi
30
+ ```
31
+
32
+ ## Resolution Workflow
33
+
34
+ ```text
35
+ 1. cargo check -> Parse error message and error code
36
+ 2. Read affected file -> Understand ownership and lifetime context
37
+ 3. Apply minimal fix -> Only what's needed
38
+ 4. cargo check -> Verify fix
39
+ 5. cargo clippy -> Check for warnings
40
+ 6. cargo test -> Ensure nothing broke
41
+ ```
42
+
43
+ ## Common Fix Patterns
44
+
45
+ | Error | Cause | Fix |
46
+ |-------|-------|-----|
47
+ | `cannot borrow as mutable` | Immutable borrow active | Restructure to end immutable borrow first, or use `Cell`/`RefCell` |
48
+ | `does not live long enough` | Value dropped while still borrowed | Extend lifetime scope, use owned type, or add lifetime annotation |
49
+ | `cannot move out of` | Moving from behind a reference | Use `.clone()`, `.to_owned()`, or restructure to take ownership |
50
+ | `mismatched types` | Wrong type or missing conversion | Add `.into()`, `as`, or explicit type conversion |
51
+ | `trait X is not implemented for Y` | Missing impl or derive | Add `#[derive(Trait)]` or implement trait manually |
52
+ | `unresolved import` | Missing dependency or wrong path | Add to Cargo.toml or fix `use` path |
53
+ | `unused variable` / `unused import` | Dead code | Remove or prefix with `_` |
54
+ | `expected X, found Y` | Type mismatch in return/argument | Fix return type or add conversion |
55
+ | `cannot find macro` | Missing `#[macro_use]` or feature | Add dependency feature or import macro |
56
+ | `multiple applicable items` | Ambiguous trait method | Use fully qualified syntax: `<Type as Trait>::method()` |
57
+ | `lifetime may not live long enough` | Lifetime bound too short | Add lifetime bound or use `'static` where appropriate |
58
+ | `async fn is not Send` | Non-Send type held across `.await` | Restructure to drop non-Send values before `.await` |
59
+ | `the trait bound is not satisfied` | Missing generic constraint | Add trait bound to generic parameter |
60
+ | `no method named X` | Missing trait import | Add `use Trait;` import |
61
+
62
+ ## Borrow Checker Troubleshooting
63
+
64
+ ```rust
65
+ // Problem: Cannot borrow as mutable because also borrowed as immutable
66
+ // Fix: Restructure to end immutable borrow before mutable borrow
67
+ let value = map.get("key").cloned(); // Clone ends the immutable borrow
68
+ if value.is_none() {
69
+ map.insert("key".into(), default_value);
70
+ }
71
+
72
+ // Problem: Value does not live long enough
73
+ // Fix: Move ownership instead of borrowing
74
+ fn get_name() -> String { // Return owned String
75
+ let name = compute_name();
76
+ name // Not &name (dangling reference)
77
+ }
78
+
79
+ // Problem: Cannot move out of index
80
+ // Fix: Use swap_remove, clone, or take
81
+ let item = vec.swap_remove(index); // Takes ownership
82
+ // Or: let item = vec[index].clone();
83
+ ```
84
+
85
+ ## Cargo.toml Troubleshooting
86
+
87
+ ```bash
88
+ # Check dependency tree for conflicts
89
+ cargo tree -d # Show duplicate dependencies
90
+ cargo tree -i some_crate # Invert — who depends on this?
91
+
92
+ # Feature resolution
93
+ cargo tree -f "{p} {f}" # Show features enabled per crate
94
+ cargo check --features "feat1,feat2" # Test specific feature combination
95
+
96
+ # Workspace issues
97
+ cargo check --workspace # Check all workspace members
98
+ cargo check -p specific_crate # Check single crate in workspace
99
+
100
+ # Lock file issues
101
+ cargo update -p specific_crate # Update one dependency (preferred)
102
+ cargo update # Full refresh (last resort — broad changes)
103
+ ```
104
+
105
+ ## Edition and MSRV Issues
106
+
107
+ ```bash
108
+ # Check edition in Cargo.toml (2024 is the current default for new projects)
109
+ grep "edition" Cargo.toml
110
+
111
+ # Check minimum supported Rust version
112
+ rustc --version
113
+ grep "rust-version" Cargo.toml
114
+
115
+ # Common fix: update edition for new syntax (check rust-version first!)
116
+ # In Cargo.toml: edition = "2024" # Requires rustc 1.85+
117
+ ```
118
+
119
+ ## Key Principles
120
+
121
+ - **Surgical fixes only** — don't refactor, just fix the error
122
+ - **Never** add `#[allow(unused)]` without explicit approval
123
+ - **Never** use `unsafe` to work around borrow checker errors
124
+ - **Never** add `.unwrap()` to silence type errors — propagate with `?`
125
+ - **Always** run `cargo check` after every fix attempt
126
+ - Fix root cause over suppressing symptoms
127
+ - Prefer the simplest fix that preserves the original intent
128
+
129
+ ## Stop Conditions
130
+
131
+ Stop and report if:
132
+ - Same error persists after 3 fix attempts
133
+ - Fix introduces more errors than it resolves
134
+ - Error requires architectural changes beyond scope
135
+ - Borrow checker error requires redesigning data ownership model
136
+
137
+ ## Output Format
138
+
139
+ ```text
140
+ [FIXED] src/handler/user.rs:42
141
+ Error: E0502 — cannot borrow `map` as mutable because it is also borrowed as immutable
142
+ Fix: Cloned value from immutable borrow before mutable insert
143
+ Remaining errors: 3
144
+ ```
145
+
146
+ Final: `Build Status: SUCCESS/FAILED | Errors Fixed: N | Files Modified: list`
147
+
148
+ For detailed Rust error patterns and code examples, see `skill: rust-patterns`.
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: rust-reviewer
3
+ description: Expert Rust code reviewer specializing in ownership, lifetimes, error handling, unsafe usage, and idiomatic patterns. Use for all Rust code changes. MUST BE USED for Rust projects.
4
+ tools: ["Read", "Grep", "Glob", "Bash"]
5
+ model: sonnet
6
+ ---
7
+
8
+ You are a senior Rust code reviewer ensuring high standards of safety, idiomatic patterns, and performance.
9
+
10
+ When invoked:
11
+ 1. Run `cargo check`, `cargo clippy -- -D warnings`, `cargo fmt --check`, and `cargo test` — if any fail, stop and report
12
+ 2. Run `git diff HEAD~1 -- '*.rs'` (or `git diff main...HEAD -- '*.rs'` for PR review) to see recent Rust file changes
13
+ 3. Focus on modified `.rs` files
14
+ 4. If the project has CI or merge requirements, note that review assumes a green CI and resolved merge conflicts where applicable; call out if the diff suggests otherwise.
15
+ 5. Begin review
16
+
17
+ ## Review Priorities
18
+
19
+ ### CRITICAL — Safety
20
+
21
+ - **Unchecked `unwrap()`/`expect()`**: In production code paths — use `?` or handle explicitly
22
+ - **Unsafe without justification**: Missing `// SAFETY:` comment documenting invariants
23
+ - **SQL injection**: String interpolation in queries — use parameterized queries
24
+ - **Command injection**: Unvalidated input in `std::process::Command`
25
+ - **Path traversal**: User-controlled paths without canonicalization and prefix check
26
+ - **Hardcoded secrets**: API keys, passwords, tokens in source
27
+ - **Insecure deserialization**: Deserializing untrusted data without size/depth limits
28
+ - **Use-after-free via raw pointers**: Unsafe pointer manipulation without lifetime guarantees
29
+
30
+ ### CRITICAL — Error Handling
31
+
32
+ - **Silenced errors**: Using `let _ = result;` on `#[must_use]` types
33
+ - **Missing error context**: `return Err(e)` without `.context()` or `.map_err()`
34
+ - **Panic for recoverable errors**: `panic!()`, `todo!()`, `unreachable!()` in production paths
35
+ - **`Box<dyn Error>` in libraries**: Use `thiserror` for typed errors instead
36
+
37
+ ### HIGH — Ownership and Lifetimes
38
+
39
+ - **Unnecessary cloning**: `.clone()` to satisfy borrow checker without understanding the root cause
40
+ - **String instead of &str**: Taking `String` when `&str` or `impl AsRef<str>` suffices
41
+ - **Vec instead of slice**: Taking `Vec<T>` when `&[T]` suffices
42
+ - **Missing `Cow`**: Allocating when `Cow<'_, str>` would avoid it
43
+ - **Lifetime over-annotation**: Explicit lifetimes where elision rules apply
44
+
45
+ ### HIGH — Concurrency
46
+
47
+ - **Blocking in async**: `std::thread::sleep`, `std::fs` in async context — use tokio equivalents
48
+ - **Unbounded channels**: `mpsc::channel()`/`tokio::sync::mpsc::unbounded_channel()` need justification — prefer bounded channels (`tokio::sync::mpsc::channel(n)` in async, `sync_channel(n)` in sync)
49
+ - **`Mutex` poisoning ignored**: Not handling `PoisonError` from `.lock()`
50
+ - **Missing `Send`/`Sync` bounds**: Types shared across threads without proper bounds
51
+ - **Deadlock patterns**: Nested lock acquisition without consistent ordering
52
+
53
+ ### HIGH — Code Quality
54
+
55
+ - **Large functions**: Over 50 lines
56
+ - **Deep nesting**: More than 4 levels
57
+ - **Wildcard match on business enums**: `_ =>` hiding new variants
58
+ - **Non-exhaustive matching**: Catch-all where explicit handling is needed
59
+ - **Dead code**: Unused functions, imports, or variables
60
+
61
+ ### MEDIUM — Performance
62
+
63
+ - **Unnecessary allocation**: `to_string()` / `to_owned()` in hot paths
64
+ - **Repeated allocation in loops**: String or Vec creation inside loops
65
+ - **Missing `with_capacity`**: `Vec::new()` when size is known — use `Vec::with_capacity(n)`
66
+ - **Excessive cloning in iterators**: `.cloned()` / `.clone()` when borrowing suffices
67
+ - **N+1 queries**: Database queries in loops
68
+
69
+ ### MEDIUM — Best Practices
70
+
71
+ - **Clippy warnings unaddressed**: Suppressed with `#[allow]` without justification
72
+ - **Missing `#[must_use]`**: On non-`must_use` return types where ignoring values is likely a bug
73
+ - **Derive order**: Should follow `Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize`
74
+ - **Public API without docs**: `pub` items missing `///` documentation
75
+ - **`format!` for simple concatenation**: Use `push_str`, `concat!`, or `+` for simple cases
76
+
77
+ ## Diagnostic Commands
78
+
79
+ ```bash
80
+ cargo clippy -- -D warnings
81
+ cargo fmt --check
82
+ cargo test
83
+ if command -v cargo-audit >/dev/null; then cargo audit; else echo "cargo-audit not installed"; fi
84
+ if command -v cargo-deny >/dev/null; then cargo deny check; else echo "cargo-deny not installed"; fi
85
+ cargo build --release 2>&1 | head -50
86
+ ```
87
+
88
+ ## Approval Criteria
89
+
90
+ - **Approve**: No CRITICAL or HIGH issues
91
+ - **Warning**: MEDIUM issues only
92
+ - **Block**: CRITICAL or HIGH issues found
93
+
94
+ For detailed Rust code examples and anti-patterns, see `skill: rust-patterns`.
@@ -0,0 +1,16 @@
1
+ name: rust
2
+ version: 0.1.0
3
+ description: Rust development - ownership, lifetimes, error handling, testing, code review
4
+ depends:
5
+ - common
6
+ tags:
7
+ - rust
8
+ - cargo
9
+ rules:
10
+ - rules/rust-style.md
11
+ skills:
12
+ - skills/rust-patterns.md
13
+ - skills/rust-testing.md
14
+ agents:
15
+ - agents/rust-reviewer.md
16
+ - agents/rust-build-resolver.md
@@ -0,0 +1,107 @@
1
+ # Rust Coding Style
2
+
3
+ Concise Rust coding style rules for idiomatic, safe, and maintainable code.
4
+
5
+ ## Formatting
6
+
7
+ - Use `rustfmt` for all formatting — never override defaults without team consensus
8
+ - Run `cargo fmt --check` in CI to enforce consistency
9
+ - Maximum line length: 100 characters (rustfmt default)
10
+
11
+ ## Linting
12
+
13
+ - Run `cargo clippy -- -D warnings` before every commit
14
+ - Fix all clippy warnings; do not suppress with `#[allow(...)]` without justification
15
+ - Use `#[expect(...)]` (Rust 1.81+) over `#[allow(...)]` when suppression is necessary — it warns when the suppression becomes unused
16
+
17
+ ## Naming Conventions
18
+
19
+ | Item | Convention | Example |
20
+ |------|-----------|---------|
21
+ | Crates | `snake_case` | `my_crate` |
22
+ | Modules | `snake_case` | `data_store` |
23
+ | Types (struct, enum, trait) | `PascalCase` | `HttpClient`, `ParseError` |
24
+ | Functions, methods | `snake_case` | `process_batch` |
25
+ | Local variables | `snake_case` | `retry_count` |
26
+ | Constants | `SCREAMING_SNAKE_CASE` | `MAX_RETRIES` |
27
+ | Type parameters | Single uppercase or `PascalCase` | `T`, `Item` |
28
+ | Lifetimes | Short lowercase | `'a`, `'ctx` |
29
+ | Feature flags | `kebab-case` | `async-runtime` |
30
+
31
+ - Boolean methods/fields: use `is_`, `has_`, `can_`, `should_` prefixes
32
+ - Conversion methods: `to_*` (expensive), `as_*` (cheap/borrow), `into_*` (consuming)
33
+ - Fallible constructors: `new` for infallible, `try_new` or `from_*` returning `Result` for fallible
34
+
35
+ ## Error Handling
36
+
37
+ - Use `thiserror` for library error types — derive `Display` and `Error` automatically
38
+ - Use `anyhow` for application-level error propagation with context
39
+ - Never use `.unwrap()` or `.expect()` in library code — propagate with `?`
40
+ - `.expect("reason")` is acceptable in application `main()` or tests with a clear message
41
+ - Define domain-specific error enums; avoid stringly-typed errors
42
+
43
+ ```rust
44
+ // Library error with thiserror
45
+ #[derive(Debug, thiserror::Error)]
46
+ pub enum ConfigError {
47
+ #[error("missing required field: {0}")]
48
+ MissingField(String),
49
+ #[error("invalid value for {field}: {reason}")]
50
+ InvalidValue { field: String, reason: String },
51
+ #[error(transparent)]
52
+ Io(#[from] std::io::Error),
53
+ }
54
+
55
+ // Application error with anyhow
56
+ use anyhow::{Context, Result};
57
+
58
+ fn load_config(path: &str) -> Result<Config> {
59
+ let content = std::fs::read_to_string(path)
60
+ .with_context(|| format!("failed to read config from {path}"))?;
61
+ toml::from_str(&content)
62
+ .context("failed to parse config")
63
+ }
64
+ ```
65
+
66
+ ## Ownership Idioms
67
+
68
+ - Prefer borrowing (`&T`, `&mut T`) over cloning — clone only when ownership is truly needed
69
+ - Use `Cow<'_, str>` when a function may or may not need to allocate
70
+ - Accept `impl AsRef<str>` or `&str` for string inputs, not `String`
71
+ - Return owned types (`String`, `Vec<T>`) from constructors and builders
72
+ - Use `Arc<T>` for shared ownership across threads; prefer `Rc<T>` in single-threaded contexts
73
+ - Avoid `RefCell` / interior mutability unless the design requires it — prefer restructuring
74
+
75
+ ## Type System
76
+
77
+ - Use newtypes to enforce domain invariants: `struct UserId(u64)`
78
+ - Prefer `enum` over boolean flags for clarity: `enum Mode { Read, Write }` over `is_write: bool`
79
+ - Use `#[must_use]` on functions whose return value should not be silently ignored
80
+ - Derive standard traits in consistent order: `Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize`
81
+
82
+ ## Modules and Visibility
83
+
84
+ - Default to private — only `pub` what is part of the public API
85
+ - Use `pub(crate)` for crate-internal shared items
86
+ - Keep module files small (< 400 lines); split into submodules when needed
87
+ - Re-export public API from `lib.rs` for a flat, discoverable surface
88
+
89
+ ## Documentation
90
+
91
+ - All public items must have `///` doc comments
92
+ - Include a one-line summary, then details if needed
93
+ - Add `# Examples` with ````rust` blocks that compile (doctests)
94
+ - Use `//!` module-level docs in `lib.rs` and key modules
95
+
96
+ ## Checklist
97
+
98
+ Before marking Rust work complete:
99
+
100
+ - [ ] `cargo fmt --check` passes
101
+ - [ ] `cargo clippy -- -D warnings` passes
102
+ - [ ] No `.unwrap()` in library code
103
+ - [ ] Error types use `thiserror` or `anyhow` appropriately
104
+ - [ ] Public API has doc comments
105
+ - [ ] No unnecessary `clone()` calls
106
+ - [ ] Newtypes used for domain identifiers
107
+ - [ ] `#[must_use]` on functions with important return values