agy-superpowers 5.2.2 → 5.2.3

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 (220) hide show
  1. package/README.md +47 -150
  2. package/package.json +1 -1
  3. package/template/agent/rules/scratch-scripts.md +37 -0
  4. package/template/agent/rules/superpowers.md +4 -51
  5. package/template/agent/skills/ai-integrated-product/SKILL.md +0 -57
  6. package/template/agent/skills/analytics-setup/SKILL.md +0 -51
  7. package/template/agent/skills/api-design/SKILL.md +0 -193
  8. package/template/agent/skills/app-store-optimizer/SKILL.md +0 -127
  9. package/template/agent/skills/auth-and-identity/SKILL.md +0 -167
  10. package/template/agent/skills/backend-developer/SKILL.md +0 -148
  11. package/template/agent/skills/bootstrapper-finance/SKILL.md +0 -55
  12. package/template/agent/skills/chrome-extension-developer/SKILL.md +0 -53
  13. package/template/agent/skills/community-manager/SKILL.md +0 -115
  14. package/template/agent/skills/content-marketer/SKILL.md +0 -111
  15. package/template/agent/skills/conversion-optimizer/SKILL.md +0 -142
  16. package/template/agent/skills/cto-architect/SKILL.md +0 -133
  17. package/template/agent/skills/customer-success-manager/SKILL.md +0 -126
  18. package/template/agent/skills/data-analyst/SKILL.md +0 -147
  19. package/template/agent/skills/devops-engineer/SKILL.md +0 -117
  20. package/template/agent/skills/email-infrastructure/SKILL.md +0 -164
  21. package/template/agent/skills/game-design/SKILL.md +0 -194
  22. package/template/agent/skills/game-developer/SKILL.md +0 -175
  23. package/template/agent/skills/growth-hacker/SKILL.md +0 -122
  24. package/template/agent/skills/idea-validator/SKILL.md +0 -55
  25. package/template/agent/skills/indie-legal/SKILL.md +0 -53
  26. package/template/agent/skills/influencer-marketer/SKILL.md +0 -141
  27. package/template/agent/skills/landing-page-builder/SKILL.md +0 -59
  28. package/template/agent/skills/launch-strategist/SKILL.md +0 -62
  29. package/template/agent/skills/market-researcher/SKILL.md +0 -53
  30. package/template/agent/skills/micro-saas-builder/SKILL.md +0 -56
  31. package/template/agent/skills/monetization-strategist/SKILL.md +0 -119
  32. package/template/agent/skills/paid-acquisition-specialist/SKILL.md +0 -119
  33. package/template/agent/skills/pricing-psychologist/SKILL.md +0 -58
  34. package/template/agent/skills/real-time-features/SKILL.md +0 -194
  35. package/template/agent/skills/retention-specialist/SKILL.md +0 -123
  36. package/template/agent/skills/rust-developer/SKILL.md +0 -281
  37. package/template/agent/skills/rust-developer/references/rust-rules/_sections.md +0 -231
  38. package/template/agent/skills/rust-developer/references/rust-rules/anti-clone-excessive.md +0 -124
  39. package/template/agent/skills/rust-developer/references/rust-rules/anti-collect-intermediate.md +0 -131
  40. package/template/agent/skills/rust-developer/references/rust-rules/anti-empty-catch.md +0 -132
  41. package/template/agent/skills/rust-developer/references/rust-rules/anti-expect-lazy.md +0 -95
  42. package/template/agent/skills/rust-developer/references/rust-rules/anti-format-hot-path.md +0 -141
  43. package/template/agent/skills/rust-developer/references/rust-rules/anti-index-over-iter.md +0 -125
  44. package/template/agent/skills/rust-developer/references/rust-rules/anti-lock-across-await.md +0 -127
  45. package/template/agent/skills/rust-developer/references/rust-rules/anti-over-abstraction.md +0 -120
  46. package/template/agent/skills/rust-developer/references/rust-rules/anti-panic-expected.md +0 -131
  47. package/template/agent/skills/rust-developer/references/rust-rules/anti-premature-optimize.md +0 -156
  48. package/template/agent/skills/rust-developer/references/rust-rules/anti-string-for-str.md +0 -122
  49. package/template/agent/skills/rust-developer/references/rust-rules/anti-stringly-typed.md +0 -167
  50. package/template/agent/skills/rust-developer/references/rust-rules/anti-type-erasure.md +0 -134
  51. package/template/agent/skills/rust-developer/references/rust-rules/anti-unwrap-abuse.md +0 -143
  52. package/template/agent/skills/rust-developer/references/rust-rules/anti-vec-for-slice.md +0 -121
  53. package/template/agent/skills/rust-developer/references/rust-rules/api-builder-must-use.md +0 -143
  54. package/template/agent/skills/rust-developer/references/rust-rules/api-builder-pattern.md +0 -187
  55. package/template/agent/skills/rust-developer/references/rust-rules/api-common-traits.md +0 -165
  56. package/template/agent/skills/rust-developer/references/rust-rules/api-default-impl.md +0 -177
  57. package/template/agent/skills/rust-developer/references/rust-rules/api-extension-trait.md +0 -163
  58. package/template/agent/skills/rust-developer/references/rust-rules/api-from-not-into.md +0 -146
  59. package/template/agent/skills/rust-developer/references/rust-rules/api-impl-asref.md +0 -142
  60. package/template/agent/skills/rust-developer/references/rust-rules/api-impl-into.md +0 -160
  61. package/template/agent/skills/rust-developer/references/rust-rules/api-must-use.md +0 -125
  62. package/template/agent/skills/rust-developer/references/rust-rules/api-newtype-safety.md +0 -162
  63. package/template/agent/skills/rust-developer/references/rust-rules/api-non-exhaustive.md +0 -177
  64. package/template/agent/skills/rust-developer/references/rust-rules/api-parse-dont-validate.md +0 -184
  65. package/template/agent/skills/rust-developer/references/rust-rules/api-sealed-trait.md +0 -168
  66. package/template/agent/skills/rust-developer/references/rust-rules/api-serde-optional.md +0 -182
  67. package/template/agent/skills/rust-developer/references/rust-rules/api-typestate.md +0 -199
  68. package/template/agent/skills/rust-developer/references/rust-rules/async-bounded-channel.md +0 -175
  69. package/template/agent/skills/rust-developer/references/rust-rules/async-broadcast-pubsub.md +0 -185
  70. package/template/agent/skills/rust-developer/references/rust-rules/async-cancellation-token.md +0 -203
  71. package/template/agent/skills/rust-developer/references/rust-rules/async-clone-before-await.md +0 -171
  72. package/template/agent/skills/rust-developer/references/rust-rules/async-join-parallel.md +0 -158
  73. package/template/agent/skills/rust-developer/references/rust-rules/async-joinset-structured.md +0 -195
  74. package/template/agent/skills/rust-developer/references/rust-rules/async-mpsc-queue.md +0 -171
  75. package/template/agent/skills/rust-developer/references/rust-rules/async-no-lock-await.md +0 -156
  76. package/template/agent/skills/rust-developer/references/rust-rules/async-oneshot-response.md +0 -191
  77. package/template/agent/skills/rust-developer/references/rust-rules/async-select-racing.md +0 -198
  78. package/template/agent/skills/rust-developer/references/rust-rules/async-spawn-blocking.md +0 -154
  79. package/template/agent/skills/rust-developer/references/rust-rules/async-tokio-fs.md +0 -167
  80. package/template/agent/skills/rust-developer/references/rust-rules/async-tokio-runtime.md +0 -169
  81. package/template/agent/skills/rust-developer/references/rust-rules/async-try-join.md +0 -172
  82. package/template/agent/skills/rust-developer/references/rust-rules/async-watch-latest.md +0 -189
  83. package/template/agent/skills/rust-developer/references/rust-rules/doc-all-public.md +0 -113
  84. package/template/agent/skills/rust-developer/references/rust-rules/doc-cargo-metadata.md +0 -147
  85. package/template/agent/skills/rust-developer/references/rust-rules/doc-errors-section.md +0 -122
  86. package/template/agent/skills/rust-developer/references/rust-rules/doc-examples-section.md +0 -161
  87. package/template/agent/skills/rust-developer/references/rust-rules/doc-hidden-setup.md +0 -149
  88. package/template/agent/skills/rust-developer/references/rust-rules/doc-intra-links.md +0 -138
  89. package/template/agent/skills/rust-developer/references/rust-rules/doc-link-types.md +0 -169
  90. package/template/agent/skills/rust-developer/references/rust-rules/doc-module-inner.md +0 -116
  91. package/template/agent/skills/rust-developer/references/rust-rules/doc-panics-section.md +0 -128
  92. package/template/agent/skills/rust-developer/references/rust-rules/doc-question-mark.md +0 -136
  93. package/template/agent/skills/rust-developer/references/rust-rules/doc-safety-section.md +0 -131
  94. package/template/agent/skills/rust-developer/references/rust-rules/err-anyhow-app.md +0 -179
  95. package/template/agent/skills/rust-developer/references/rust-rules/err-context-chain.md +0 -144
  96. package/template/agent/skills/rust-developer/references/rust-rules/err-custom-type.md +0 -152
  97. package/template/agent/skills/rust-developer/references/rust-rules/err-doc-errors.md +0 -145
  98. package/template/agent/skills/rust-developer/references/rust-rules/err-expect-bugs-only.md +0 -133
  99. package/template/agent/skills/rust-developer/references/rust-rules/err-from-impl.md +0 -152
  100. package/template/agent/skills/rust-developer/references/rust-rules/err-lowercase-msg.md +0 -124
  101. package/template/agent/skills/rust-developer/references/rust-rules/err-no-unwrap-prod.md +0 -115
  102. package/template/agent/skills/rust-developer/references/rust-rules/err-question-mark.md +0 -151
  103. package/template/agent/skills/rust-developer/references/rust-rules/err-result-over-panic.md +0 -130
  104. package/template/agent/skills/rust-developer/references/rust-rules/err-source-chain.md +0 -155
  105. package/template/agent/skills/rust-developer/references/rust-rules/err-thiserror-lib.md +0 -171
  106. package/template/agent/skills/rust-developer/references/rust-rules/lint-cargo-metadata.md +0 -138
  107. package/template/agent/skills/rust-developer/references/rust-rules/lint-deny-correctness.md +0 -107
  108. package/template/agent/skills/rust-developer/references/rust-rules/lint-missing-docs.md +0 -154
  109. package/template/agent/skills/rust-developer/references/rust-rules/lint-pedantic-selective.md +0 -118
  110. package/template/agent/skills/rust-developer/references/rust-rules/lint-rustfmt-check.md +0 -157
  111. package/template/agent/skills/rust-developer/references/rust-rules/lint-unsafe-doc.md +0 -133
  112. package/template/agent/skills/rust-developer/references/rust-rules/lint-warn-complexity.md +0 -131
  113. package/template/agent/skills/rust-developer/references/rust-rules/lint-warn-perf.md +0 -136
  114. package/template/agent/skills/rust-developer/references/rust-rules/lint-warn-style.md +0 -135
  115. package/template/agent/skills/rust-developer/references/rust-rules/lint-warn-suspicious.md +0 -122
  116. package/template/agent/skills/rust-developer/references/rust-rules/lint-workspace-lints.md +0 -172
  117. package/template/agent/skills/rust-developer/references/rust-rules/mem-arena-allocator.md +0 -168
  118. package/template/agent/skills/rust-developer/references/rust-rules/mem-arrayvec.md +0 -142
  119. package/template/agent/skills/rust-developer/references/rust-rules/mem-assert-type-size.md +0 -168
  120. package/template/agent/skills/rust-developer/references/rust-rules/mem-avoid-format.md +0 -147
  121. package/template/agent/skills/rust-developer/references/rust-rules/mem-box-large-variant.md +0 -158
  122. package/template/agent/skills/rust-developer/references/rust-rules/mem-boxed-slice.md +0 -139
  123. package/template/agent/skills/rust-developer/references/rust-rules/mem-clone-from.md +0 -147
  124. package/template/agent/skills/rust-developer/references/rust-rules/mem-compact-string.md +0 -149
  125. package/template/agent/skills/rust-developer/references/rust-rules/mem-reuse-collections.md +0 -174
  126. package/template/agent/skills/rust-developer/references/rust-rules/mem-smaller-integers.md +0 -159
  127. package/template/agent/skills/rust-developer/references/rust-rules/mem-smallvec.md +0 -138
  128. package/template/agent/skills/rust-developer/references/rust-rules/mem-thinvec.md +0 -142
  129. package/template/agent/skills/rust-developer/references/rust-rules/mem-with-capacity.md +0 -156
  130. package/template/agent/skills/rust-developer/references/rust-rules/mem-write-over-format.md +0 -172
  131. package/template/agent/skills/rust-developer/references/rust-rules/mem-zero-copy.md +0 -164
  132. package/template/agent/skills/rust-developer/references/rust-rules/name-acronym-word.md +0 -99
  133. package/template/agent/skills/rust-developer/references/rust-rules/name-as-free.md +0 -104
  134. package/template/agent/skills/rust-developer/references/rust-rules/name-consts-screaming.md +0 -94
  135. package/template/agent/skills/rust-developer/references/rust-rules/name-crate-no-rs.md +0 -78
  136. package/template/agent/skills/rust-developer/references/rust-rules/name-funcs-snake.md +0 -76
  137. package/template/agent/skills/rust-developer/references/rust-rules/name-into-ownership.md +0 -123
  138. package/template/agent/skills/rust-developer/references/rust-rules/name-is-has-bool.md +0 -127
  139. package/template/agent/skills/rust-developer/references/rust-rules/name-iter-convention.md +0 -129
  140. package/template/agent/skills/rust-developer/references/rust-rules/name-iter-method.md +0 -131
  141. package/template/agent/skills/rust-developer/references/rust-rules/name-iter-type-match.md +0 -142
  142. package/template/agent/skills/rust-developer/references/rust-rules/name-lifetime-short.md +0 -86
  143. package/template/agent/skills/rust-developer/references/rust-rules/name-no-get-prefix.md +0 -154
  144. package/template/agent/skills/rust-developer/references/rust-rules/name-to-expensive.md +0 -118
  145. package/template/agent/skills/rust-developer/references/rust-rules/name-type-param-single.md +0 -92
  146. package/template/agent/skills/rust-developer/references/rust-rules/name-types-camel.md +0 -65
  147. package/template/agent/skills/rust-developer/references/rust-rules/name-variants-camel.md +0 -101
  148. package/template/agent/skills/rust-developer/references/rust-rules/opt-bounds-check.md +0 -161
  149. package/template/agent/skills/rust-developer/references/rust-rules/opt-cache-friendly.md +0 -187
  150. package/template/agent/skills/rust-developer/references/rust-rules/opt-codegen-units.md +0 -142
  151. package/template/agent/skills/rust-developer/references/rust-rules/opt-cold-unlikely.md +0 -152
  152. package/template/agent/skills/rust-developer/references/rust-rules/opt-inline-always-rare.md +0 -141
  153. package/template/agent/skills/rust-developer/references/rust-rules/opt-inline-never-cold.md +0 -181
  154. package/template/agent/skills/rust-developer/references/rust-rules/opt-inline-small.md +0 -160
  155. package/template/agent/skills/rust-developer/references/rust-rules/opt-likely-hint.md +0 -171
  156. package/template/agent/skills/rust-developer/references/rust-rules/opt-lto-release.md +0 -130
  157. package/template/agent/skills/rust-developer/references/rust-rules/opt-pgo-profile.md +0 -167
  158. package/template/agent/skills/rust-developer/references/rust-rules/opt-simd-portable.md +0 -144
  159. package/template/agent/skills/rust-developer/references/rust-rules/opt-target-cpu.md +0 -154
  160. package/template/agent/skills/rust-developer/references/rust-rules/own-arc-shared.md +0 -141
  161. package/template/agent/skills/rust-developer/references/rust-rules/own-borrow-over-clone.md +0 -95
  162. package/template/agent/skills/rust-developer/references/rust-rules/own-clone-explicit.md +0 -135
  163. package/template/agent/skills/rust-developer/references/rust-rules/own-copy-small.md +0 -124
  164. package/template/agent/skills/rust-developer/references/rust-rules/own-cow-conditional.md +0 -135
  165. package/template/agent/skills/rust-developer/references/rust-rules/own-lifetime-elision.md +0 -134
  166. package/template/agent/skills/rust-developer/references/rust-rules/own-move-large.md +0 -134
  167. package/template/agent/skills/rust-developer/references/rust-rules/own-mutex-interior.md +0 -105
  168. package/template/agent/skills/rust-developer/references/rust-rules/own-rc-single-thread.md +0 -65
  169. package/template/agent/skills/rust-developer/references/rust-rules/own-refcell-interior.md +0 -97
  170. package/template/agent/skills/rust-developer/references/rust-rules/own-rwlock-readers.md +0 -122
  171. package/template/agent/skills/rust-developer/references/rust-rules/own-slice-over-vec.md +0 -119
  172. package/template/agent/skills/rust-developer/references/rust-rules/perf-black-box-bench.md +0 -153
  173. package/template/agent/skills/rust-developer/references/rust-rules/perf-chain-avoid.md +0 -136
  174. package/template/agent/skills/rust-developer/references/rust-rules/perf-collect-into.md +0 -133
  175. package/template/agent/skills/rust-developer/references/rust-rules/perf-collect-once.md +0 -120
  176. package/template/agent/skills/rust-developer/references/rust-rules/perf-drain-reuse.md +0 -137
  177. package/template/agent/skills/rust-developer/references/rust-rules/perf-entry-api.md +0 -134
  178. package/template/agent/skills/rust-developer/references/rust-rules/perf-extend-batch.md +0 -150
  179. package/template/agent/skills/rust-developer/references/rust-rules/perf-iter-lazy.md +0 -123
  180. package/template/agent/skills/rust-developer/references/rust-rules/perf-iter-over-index.md +0 -113
  181. package/template/agent/skills/rust-developer/references/rust-rules/perf-profile-first.md +0 -175
  182. package/template/agent/skills/rust-developer/references/rust-rules/perf-release-profile.md +0 -149
  183. package/template/agent/skills/rust-developer/references/rust-rules/proj-bin-dir.md +0 -142
  184. package/template/agent/skills/rust-developer/references/rust-rules/proj-flat-small.md +0 -133
  185. package/template/agent/skills/rust-developer/references/rust-rules/proj-lib-main-split.md +0 -148
  186. package/template/agent/skills/rust-developer/references/rust-rules/proj-mod-by-feature.md +0 -130
  187. package/template/agent/skills/rust-developer/references/rust-rules/proj-mod-rs-dir.md +0 -120
  188. package/template/agent/skills/rust-developer/references/rust-rules/proj-prelude-module.md +0 -155
  189. package/template/agent/skills/rust-developer/references/rust-rules/proj-pub-crate-internal.md +0 -139
  190. package/template/agent/skills/rust-developer/references/rust-rules/proj-pub-super-parent.md +0 -135
  191. package/template/agent/skills/rust-developer/references/rust-rules/proj-pub-use-reexport.md +0 -162
  192. package/template/agent/skills/rust-developer/references/rust-rules/proj-workspace-deps.md +0 -186
  193. package/template/agent/skills/rust-developer/references/rust-rules/proj-workspace-large.md +0 -162
  194. package/template/agent/skills/rust-developer/references/rust-rules/test-arrange-act-assert.md +0 -160
  195. package/template/agent/skills/rust-developer/references/rust-rules/test-cfg-test-module.md +0 -151
  196. package/template/agent/skills/rust-developer/references/rust-rules/test-criterion-bench.md +0 -171
  197. package/template/agent/skills/rust-developer/references/rust-rules/test-descriptive-names.md +0 -142
  198. package/template/agent/skills/rust-developer/references/rust-rules/test-doctest-examples.md +0 -168
  199. package/template/agent/skills/rust-developer/references/rust-rules/test-fixture-raii.md +0 -151
  200. package/template/agent/skills/rust-developer/references/rust-rules/test-integration-dir.md +0 -144
  201. package/template/agent/skills/rust-developer/references/rust-rules/test-mock-traits.md +0 -189
  202. package/template/agent/skills/rust-developer/references/rust-rules/test-mockall-mocking.md +0 -226
  203. package/template/agent/skills/rust-developer/references/rust-rules/test-proptest-properties.md +0 -161
  204. package/template/agent/skills/rust-developer/references/rust-rules/test-should-panic.md +0 -130
  205. package/template/agent/skills/rust-developer/references/rust-rules/test-tokio-async.md +0 -154
  206. package/template/agent/skills/rust-developer/references/rust-rules/test-use-super.md +0 -127
  207. package/template/agent/skills/rust-developer/references/rust-rules/type-enum-states.md +0 -154
  208. package/template/agent/skills/rust-developer/references/rust-rules/type-generic-bounds.md +0 -142
  209. package/template/agent/skills/rust-developer/references/rust-rules/type-never-diverge.md +0 -146
  210. package/template/agent/skills/rust-developer/references/rust-rules/type-newtype-ids.md +0 -160
  211. package/template/agent/skills/rust-developer/references/rust-rules/type-newtype-validated.md +0 -159
  212. package/template/agent/skills/rust-developer/references/rust-rules/type-no-stringly.md +0 -144
  213. package/template/agent/skills/rust-developer/references/rust-rules/type-option-nullable.md +0 -137
  214. package/template/agent/skills/rust-developer/references/rust-rules/type-phantom-marker.md +0 -188
  215. package/template/agent/skills/rust-developer/references/rust-rules/type-repr-transparent.md +0 -143
  216. package/template/agent/skills/rust-developer/references/rust-rules/type-result-fallible.md +0 -131
  217. package/template/agent/skills/saas-architect/SKILL.md +0 -139
  218. package/template/agent/skills/security-engineer/SKILL.md +0 -133
  219. package/template/agent/skills/seo-specialist/SKILL.md +0 -130
  220. package/template/agent/skills/solo-founder-ops/SKILL.md +0 -56
@@ -1,123 +0,0 @@
1
- ---
2
- name: retention-specialist
3
- description: Use when improving user retention, designing onboarding flows, reducing churn, analyzing engagement, or building re-engagement campaigns
4
- ---
5
-
6
- # Retention Specialist Lens
7
-
8
- > **Philosophy:** Retention is the multiplier on everything else. Double retention = double LTV.
9
- > Acquisition brings users in; retention determines if your business exists in 12 months.
10
-
11
- ---
12
-
13
- ## Core Instincts
14
-
15
- - **Retention is a product problem, not a marketing problem** — you can't lifecycle-email your way out of a bad product
16
- - **Find the aha moment first** — the single action most correlated with long-term retention
17
- - **Day 1 retention is the most important** — users who don't return on Day 1 rarely return at all
18
- - **Habit formation takes 21–66 days** — retention strategy must operate over weeks, not days
19
- - **Segment by engagement tier** — power users, casual users, and at-risk users need different interventions
20
-
21
- ---
22
-
23
- ## Retention Benchmarks
24
-
25
- ### Mobile Apps (by category) — 2024 benchmarks
26
-
27
- | Category | D1 (good) | D7 (good) | D30 (good) |
28
- |----------|-----------|-----------|------------|
29
- | Games | > 28% | > 12% | > 6% |
30
- | Finance / Fintech | > 25% | > 16% | > 10% |
31
- | Education | > 26% | > 16% | > 7% |
32
- | Entertainment | > 27% | > 16% | > 5% |
33
- | Health & Fitness | > 25% | > 10% | > 5% |
34
- | Social / Messaging | > 27% | > 11% | > 6% |
35
- | Productivity / Utilities | > 24% | > 15% | > 5% |
36
-
37
- **Context:** Industry-wide D1 average is ~25–28%; D7 ~13–18%; D30 ~5–8%. Apps hitting D30 > 15% are genuinely strong performers.
38
- **General rule:** D30 < 5% = investigate immediately. D30 > 12% = strong. D30 > 20% = exceptional.
39
-
40
- ### SaaS / Web Apps — 2024 benchmarks
41
- | Metric | Poor | Average | Good |
42
- |--------|------|---------|------|
43
- | Monthly churn (B2B SaaS) | > 8% | 3.5–5% | < 2% |
44
- | Monthly churn (B2C / consumer) | > 10% | 5–8% | < 3% |
45
- | Annual churn (B2B) | > 60% | 30–50% | < 20% |
46
- | NPS | < 20 | 30–50 | > 50 |
47
-
48
- **Context:** Industry average B2B SaaS monthly churn is ~4.2% (Recurly 2024). "< 2% monthly" is excellent / enterprise-level, not just "good".
49
-
50
- ---
51
-
52
- ## Push Notification Benchmarks
53
-
54
- | Platform | Average open rate | Good open rate |
55
- |----------|------------------|---------------|
56
- | iOS | 3–5% | > 7% |
57
- | Android | 4–7% | > 10% |
58
- | Email re-engagement | 10–15% | > 20% |
59
-
60
- **Push notification rules:**
61
- - Personalized > generic (2–3× higher open rate)
62
- - Time-based (sent at user's local peak usage time) > blast sends
63
- - Opt-in rate drops if you send > 1 notification/day
64
-
65
- ---
66
-
67
- ## ❌ Anti-Patterns to Avoid
68
-
69
- | ❌ NEVER DO | Why | ✅ DO INSTEAD |
70
- |------------|-----|--------------|
71
- | Lifecycle emails before finding aha moment | Emails can't fix a broken product | Find and shorten path to aha moment first |
72
- | Generic "come back" push notifications | Low open rate, high unsubscribe | Trigger-based, personalized context |
73
- | Daily active user target only | DAU ignores depth of engagement | Track DAU + session depth + feature usage |
74
- | Ignore Day 1 drop-off | 60–80% of users churn on Day 1 | Instrument and fix Day 1 experience first |
75
- | Same onboarding for all user types | Different users need different paths | Personalize onboarding from first question |
76
- | Cancel flow with no save attempt | 20–40% of cancellers are saveable | Offer pause, downgrade, or discount before cancel |
77
-
78
- ---
79
-
80
- ## Questions You Always Ask
81
-
82
- **When diagnosing retention:**
83
- - What does the Day 1/7/30 retention curve look like? Where's the steepest drop?
84
- - What's the aha moment, and what % of users reach it in session 1?
85
- - What do retained users do differently from churned users in week 1?
86
-
87
- **When designing retention interventions:**
88
- - Is this a product problem (users don't understand value) or a habit problem (value understood, not habitual)?
89
- - What's the churn reason? (Run exit survey — "I didn't use it enough" vs "too expensive" vs "found alternative")
90
-
91
- ---
92
-
93
- ## Red Flags
94
-
95
- **Must fix:**
96
- - [ ] Day 1 retention < 20% (broken first experience)
97
- - [ ] No aha moment defined or instrumented
98
- - [ ] Monthly churn > 8% with no active investigation
99
- - [ ] No exit survey / churn reason tracking
100
-
101
- **Should fix:**
102
- - [ ] No push notification strategy (relying only on email)
103
- - [ ] No in-app re-engagement for users inactive > 7 days
104
- - [ ] Onboarding identical for all user segments
105
- - [ ] No cancel flow / save attempt
106
-
107
- ---
108
-
109
- ## Who to Pair With
110
- - `product-manager` — for aha moment and activation event design
111
- - `growth-hacker` — for AARRR funnel optimization
112
- - `data-analyst` — for cohort analysis and retention curve modeling
113
-
114
- ---
115
-
116
- ## Key Formulas
117
-
118
- ```
119
- Retention rate (Day N) = users_still_active_on_day_N / users_who_signed_up_N_days_ago
120
- Monthly churn = churned_users_this_month / users_at_start_of_month
121
- Annual churn ≈ 1 - (1 - monthly_churn)^12
122
- NPS = % Promoters (9–10) - % Detractors (0–6)
123
- ```
@@ -1,281 +0,0 @@
1
- ---
2
- name: rust-developer
3
- description: Use when writing Rust code, reviewing Rust, debugging ownership/borrow errors, designing APIs in Rust, or choosing async patterns, memory strategies, and idiomatic Rust conventions
4
- ---
5
-
6
- # Rust Developer Lens
7
-
8
- > **Philosophy:** Make invalid states unrepresentable. Let the compiler prove correctness.
9
- > If it compiles without `unsafe`, `unwrap`, or `clone` sprawl, it's probably right.
10
-
11
- ---
12
-
13
- ## ⚠️ ASK BEFORE ASSUMING
14
-
15
- If the context is unspecified, ask:
16
-
17
- | What | Why it matters |
18
- |------|----------------|
19
- | **Async runtime?** Tokio / async-std / none | Shapes the entire async stack |
20
- | **Library or application?** | Changes error handling strategy (`thiserror` vs `anyhow`) |
21
- | **Target?** WASM / embedded / server / CLI | Changes allowed dependencies and allocation model |
22
- | **Edition?** 2021 / 2018 | Affects imports, closures, `let`-chains |
23
-
24
- ---
25
-
26
- ## Core Instincts
27
-
28
- - **Borrow, don't clone** — every `.clone()` is a cost; most can be avoided with `&T`
29
- - **`unwrap()` is a panic bug waiting to happen** — use `?`, `.context()`, or pattern match
30
- - **Parse, don't validate** — convert untrusted input into a well-typed value at the boundary
31
- - **Make illegal states unrepresentable** — enums over booleans, newtypes over raw primitives
32
- - **Async is not free** — wrong executor choices and `Mutex` across `.await` cause silent deadlocks
33
- - **Run `cargo clippy` and `cargo fmt`** — treat clippy warnings as errors in CI
34
-
35
- ---
36
-
37
- ## ❌ Anti-Patterns to Avoid
38
-
39
- | ❌ NEVER DO | Why | ✅ DO INSTEAD |
40
- |------------|-----|--------------|
41
- | `.unwrap()` in production | Panics on unexpected input | Use `?` operator with proper error types |
42
- | `&String` / `&Vec<T>` as params | Unnecessarily restrictive | Accept `&str` / `&[T]` |
43
- | `.clone()` to satisfy borrow checker | Wasted allocation | Restructure ownership or borrow correctly |
44
- | `Box<dyn Error>` as return type | Loses type info, hard to match | Use `thiserror` enum or `anyhow::Error` |
45
- | `std::fs` in async code | Blocks the executor thread | Use `tokio::fs` |
46
- | Holding `Mutex` across `.await` | Deadlock risk | Release lock before awaiting |
47
- | Stringly-typed IDs / states | Runtime errors, no compiler help | Newtypes: `UserId(u64)`, enums for state |
48
- | `format!()` to build strings repeatedly | Unnecessary allocations | Use `write!()` or `String::with_capacity()` |
49
- | `Vec<T>` when size is fixed | Heap indirection | `Box<[T]>` or `ArrayVec` |
50
- | Ignoring clippy lint | Dead code, perf issues, bugs | Fix or `#[allow(...)]` with comment |
51
- | `unsafe` without justification | Undefined behavior, soundness hole | Minimize scope, document invariants, wrap in safe API |
52
-
53
- ---
54
-
55
- ## Ownership Quick Reference
56
-
57
- | Situation | Pattern |
58
- |-----------|---------|
59
- | Shared read-only | `&T` — borrow |
60
- | Shared multi-thread | `Arc<T>` |
61
- | Single-thread shared mutable | `Rc<RefCell<T>>` |
62
- | Multi-thread shared mutable | `Arc<Mutex<T>>` |
63
- | Read-heavy shared mutable | `Arc<RwLock<T>>` |
64
- | Conditional ownership | `Cow<'a, T>` |
65
- | Small, `Copy`able types | Derive `Copy` |
66
- | Large data transfer | Move, don't clone |
67
- | Function param (read) | `&str` / `&[T]` / `&T` |
68
- | Function param (owned) | `impl Into<T>` |
69
-
70
- ---
71
-
72
- ## Error Handling Strategy
73
-
74
- ```
75
- Library crate? → thiserror + custom enum
76
- Application? → anyhow + .context("what failed")
77
- Both? → thiserror internally, anyhow at main/binary layer
78
- ```
79
-
80
- **Pattern:**
81
- ```rust
82
- // Library: typed, matchable errors
83
- #[derive(Debug, thiserror::Error)]
84
- pub enum AppError {
85
- #[error("user {0} not found")]
86
- NotFound(UserId),
87
- #[error("database error")]
88
- Db(#[from] sqlx::Error),
89
- }
90
-
91
- // Application: add context at call site
92
- let user = db.find_user(id).await.context("loading user for request")?;
93
- ```
94
-
95
- **Rules:**
96
- - Error messages: lowercase, no trailing punctuation
97
- - Use `?` for propagation — not `match Ok/Err`
98
- - Document errors with `# Errors` section in doc comments
99
- - `.expect()` only for programming errors (invariants): `vec.first().expect("vec always has one element")`
100
-
101
- ---
102
-
103
- ## Async Patterns
104
-
105
- | Pattern | Use when |
106
- |---------|----------|
107
- | `tokio::spawn` | Fire-and-forget task |
108
- | `tokio::join!` | Parallel independent futures |
109
- | `tokio::try_join!` | Parallel fallible futures |
110
- | `tokio::select!` | Race / timeout |
111
- | `JoinSet` | Dynamic set of tasks |
112
- | `mpsc` channel | Work queue, producer → consumer |
113
- | `broadcast` channel | Pub/sub, one → many |
114
- | `watch` channel | Latest value (config, state) |
115
- | `oneshot` channel | Request/response pattern |
116
- | `spawn_blocking` | CPU-bound work from async context |
117
- | `CancellationToken` | Graceful shutdown signal |
118
-
119
- **Critical rules:**
120
- - Never hold `Mutex` / `RwLock` guard across `.await`
121
- - Use `tokio::fs`, not `std::fs` in async code
122
- - Clone data *before* await points, release locks *before* yield
123
-
124
- ---
125
-
126
- ## Memory Optimization Quick Reference
127
-
128
- | Situation | Tool |
129
- |-----------|------|
130
- | Know the size upfront | `Vec::with_capacity(n)` |
131
- | Usually small (≤ ~8 items) | `SmallVec<[T; 8]>` |
132
- | Bounded max size | `ArrayVec<T, N>` |
133
- | Often-empty vec | `ThinVec<T>` |
134
- | Fixed-size, no growth | `Box<[T]>` |
135
- | Small strings (≤ 24 bytes) | `CompactString` |
136
- | Reuse allocation in loop | `vec.clear()` (don't drop) |
137
- | Zero-copy reads | `&[u8]` / `bytes::Bytes` |
138
-
139
- ---
140
-
141
- ## API Design Rules
142
-
143
- - **Builder pattern** for structs with ≥ 3 optional fields; add `#[must_use]` to builder type
144
- - **Newtype** for domain primitives: `struct UserId(u64)`, `struct Email(String)`
145
- - **Typestate** for compile-time state machines: `Connection<Connected>` vs `Connection<Idle>`
146
- - **`impl Into<T>`** for string parameters (accepts `&str`, `String`, `Cow<str>`)
147
- - **`impl AsRef<T>`** for borrowed inputs (accepts `String`, `&str`, `Path`, etc.)
148
- - **`From<X> for Y`**, not `Into<Y> for X` — `Into` is auto-derived
149
- - **`#[non_exhaustive]`** on enums / structs you may extend in a minor version
150
- - **`#[must_use]`** on `Result`-returning functions
151
- - Gate `serde` behind a feature flag in libraries
152
-
153
- ---
154
-
155
- ## Naming Conventions
156
-
157
- | Item | Convention | Example |
158
- |------|------------|---------|
159
- | Types, traits, enums | `UpperCamelCase` | `UserService` |
160
- | Enum variants | `UpperCamelCase` | `NotFound` |
161
- | Functions, methods, modules | `snake_case` | `find_user` |
162
- | Constants, statics | `SCREAMING_SNAKE_CASE` | `MAX_RETRIES` |
163
- | Lifetimes | Short lowercase | `'a`, `'de`, `'src` |
164
- | Type params | Single uppercase | `T`, `E`, `K`, `V` |
165
- | Getter (cheap) | No `get_` prefix | `.name()` not `.get_name()` |
166
- | Boolean methods | `is_`, `has_`, `can_` | `.is_empty()` |
167
- | Free conversion (ref) | `as_` prefix | `.as_str()` |
168
- | Expensive conversion | `to_` prefix | `.to_string()` |
169
- | Ownership transfer | `into_` prefix | `.into_bytes()` |
170
- | Acronyms | Treat as word | `Uuid`, `HttpClient` |
171
- | Crate names | No `-rs` suffix | `my-tool` not `my-tool-rs` |
172
-
173
- ---
174
-
175
- ## Testing Checklist
176
-
177
- ```rust
178
- // Unit tests: inline, same file
179
- #[cfg(test)]
180
- mod tests {
181
- use super::*;
182
-
183
- #[test]
184
- fn test_name_describes_what_and_expected_result() {
185
- // Arrange
186
- // Act
187
- // Assert
188
- }
189
-
190
- #[tokio::test]
191
- async fn async_test_name() { ... }
192
- }
193
- ```
194
-
195
- - Integration tests → `tests/` directory
196
- - Property-based testing → `proptest` crate
197
- - Trait mocking → `mockall` crate
198
- - Benchmarks → `criterion` crate
199
- - Doc examples must be runnable (they are tested)
200
- - RAII pattern for test cleanup (implement `Drop`)
201
-
202
- ---
203
-
204
- ## Questions You Always Ask
205
-
206
- **When writing Rust code:**
207
- - Is this a library or an application? (determines error handling strategy)
208
- - Can I borrow instead of clone here?
209
- - What happens if this `.unwrap()` receives `None` / `Err` in production?
210
- - Is this `unsafe` block minimized and its invariants documented?
211
-
212
- **When reviewing Rust code:**
213
- - Are all `?` propagations wrapped with `.context()`?
214
- - Would a newtype prevent misuse here (e.g., mixing up `UserId` and `PostId`)?
215
- - Is this async code holding a lock guard across an `.await`?
216
- - Does `cargo clippy` pass clean? Any suppressed lints without justification?
217
-
218
- ---
219
-
220
- ## Validation Checklist Before Finishing
221
-
222
- ```bash
223
- cargo fmt # Format
224
- cargo clippy # Lint (treat warnings as errors)
225
- cargo test # All tests pass
226
- cargo doc --open # Docs render correctly (check `# Errors`, examples)
227
- ```
228
-
229
- For performance-sensitive code:
230
- ```bash
231
- cargo bench # via criterion
232
- RUSTFLAGS="-C target-cpu=native" cargo build --release
233
- ```
234
-
235
- ---
236
-
237
- ## Red Flags in Code Review
238
-
239
- **Must fix:**
240
- - [ ] `.unwrap()` or `.expect()` in non-obvious invariant code
241
- - [ ] `&String` / `&Vec<T>` function parameters
242
- - [ ] `Box<dyn Error>` as error type in library
243
- - [ ] `std::fs` used in async function
244
- - [ ] Mutex/RwLock guard held across `.await`
245
- - [ ] Clones that could be borrows
246
-
247
- **Should fix:**
248
- - [ ] Missing `# Errors` doc section on fallible public functions
249
- - [ ] No error context added (`?` with no `.context()`)
250
- - [ ] Missing `with_capacity` when size is known
251
- - [ ] Stringly-typed IDs or status values
252
- - [ ] Clippy warnings left unaddressed
253
-
254
- ---
255
-
256
- ## Platform References
257
-
258
- When this skill is invoked for a Rust project, check `references/rust-rules/`
259
- for 179 individual rule files from [leonardomso/rust-skills](https://github.com/leonardomso/rust-skills).
260
-
261
- Each rule covers one specific pattern with:
262
- - Why it matters
263
- - Bad code example
264
- - Good code example
265
- - Links to official docs
266
-
267
- Read `references/rust-rules/_sections.md` for the full index organized by
268
- priority (CRITICAL → REFERENCE). Reference individual rules when working
269
- on specific areas (ownership, error handling, async, memory, API design, etc.).
270
-
271
- ---
272
-
273
- ## Sources
274
-
275
- Rules curated from:
276
- - [Rust API Guidelines](https://rust-lang.github.io/api-guidelines/)
277
- - [Rust Performance Book](https://nnethercote.github.io/perf-book/)
278
- - [Rust Design Patterns](https://rust-unofficial.github.io/patterns/)
279
- - [leonardomso/rust-skills](https://github.com/leonardomso/rust-skills) — 179 rules for AI coding agents
280
- - [Ranrar/rustic-prompt](https://github.com/Ranrar/rustic-prompt) — multi-agent Rust instruction set
281
- - Real-world code from: ripgrep, tokio, serde, axum, polars
@@ -1,231 +0,0 @@
1
- # Rust Rules Index
2
-
3
- 179 rules from [leonardomso/rust-skills](https://github.com/leonardomso/rust-skills), organized by priority.
4
-
5
- ## Rule Categories by Priority
6
-
7
- | Priority | Category | Impact | Prefix | Rules |
8
- |----------|----------|--------|--------|-------|
9
- | 1 | Ownership & Borrowing | CRITICAL | `own-` | 12 |
10
- | 2 | Error Handling | CRITICAL | `err-` | 12 |
11
- | 3 | Memory Optimization | CRITICAL | `mem-` | 15 |
12
- | 4 | API Design | HIGH | `api-` | 15 |
13
- | 5 | Async/Await | HIGH | `async-` | 15 |
14
- | 6 | Compiler Optimization | HIGH | `opt-` | 12 |
15
- | 7 | Naming Conventions | MEDIUM | `name-` | 16 |
16
- | 8 | Type Safety | MEDIUM | `type-` | 10 |
17
- | 9 | Testing | MEDIUM | `test-` | 13 |
18
- | 10 | Documentation | MEDIUM | `doc-` | 11 |
19
- | 11 | Performance Patterns | MEDIUM | `perf-` | 11 |
20
- | 12 | Project Structure | LOW | `proj-` | 11 |
21
- | 13 | Clippy & Linting | LOW | `lint-` | 11 |
22
- | 14 | Anti-patterns | REFERENCE | `anti-` | 15 |
23
-
24
- ---
25
-
26
- ### 1. Ownership & Borrowing (CRITICAL)
27
- - `own-borrow-over-clone` - Prefer `&T` borrowing over `.clone()`
28
- - `own-slice-over-vec` - Accept `&[T]` not `&Vec<T>`, `&str` not `&String`
29
- - `own-cow-conditional` - Use `Cow<'a, T>` for conditional ownership
30
- - `own-arc-shared` - Use `Arc<T>` for thread-safe shared ownership
31
- - `own-rc-single-thread` - Use `Rc<T>` for single-threaded sharing
32
- - `own-refcell-interior` - Use `RefCell<T>` for interior mutability (single-thread)
33
- - `own-mutex-interior` - Use `Mutex<T>` for interior mutability (multi-thread)
34
- - `own-rwlock-readers` - Use `RwLock<T>` when reads dominate writes
35
- - `own-copy-small` - Derive `Copy` for small, trivial types
36
- - `own-clone-explicit` - Make `Clone` explicit, avoid implicit copies
37
- - `own-move-large` - Move large data instead of cloning
38
- - `own-lifetime-elision` - Rely on lifetime elision when possible
39
-
40
- ### 2. Error Handling (CRITICAL)
41
- - `err-thiserror-lib` - Use `thiserror` for library error types
42
- - `err-anyhow-app` - Use `anyhow` for application error handling
43
- - `err-result-over-panic` - Return `Result`, don't panic on expected errors
44
- - `err-context-chain` - Add context with `.context()` or `.with_context()`
45
- - `err-no-unwrap-prod` - Never use `.unwrap()` in production code
46
- - `err-expect-bugs-only` - Use `.expect()` only for programming errors
47
- - `err-question-mark` - Use `?` operator for clean propagation
48
- - `err-from-impl` - Use `#[from]` for automatic error conversion
49
- - `err-source-chain` - Use `#[source]` to chain underlying errors
50
- - `err-lowercase-msg` - Error messages: lowercase, no trailing punctuation
51
- - `err-doc-errors` - Document errors with `# Errors` section
52
- - `err-custom-type` - Create custom error types, not `Box<dyn Error>`
53
-
54
- ### 3. Memory Optimization (CRITICAL)
55
- - `mem-with-capacity` - Use `with_capacity()` when size is known
56
- - `mem-smallvec` - Use `SmallVec` for usually-small collections
57
- - `mem-arrayvec` - Use `ArrayVec` for bounded-size collections
58
- - `mem-box-large-variant` - Box large enum variants to reduce type size
59
- - `mem-boxed-slice` - Use `Box<[T]>` instead of `Vec<T>` when fixed
60
- - `mem-thinvec` - Use `ThinVec` for often-empty vectors
61
- - `mem-clone-from` - Use `clone_from()` to reuse allocations
62
- - `mem-reuse-collections` - Reuse collections with `clear()` in loops
63
- - `mem-avoid-format` - Avoid `format!()` when string literals work
64
- - `mem-write-over-format` - Use `write!()` instead of `format!()`
65
- - `mem-arena-allocator` - Use arena allocators for batch allocations
66
- - `mem-zero-copy` - Use zero-copy patterns with slices and `Bytes`
67
- - `mem-compact-string` - Use `CompactString` for small string optimization
68
- - `mem-smaller-integers` - Use smallest integer type that fits
69
- - `mem-assert-type-size` - Assert hot type sizes to prevent regressions
70
-
71
- ### 4. API Design (HIGH)
72
- - `api-builder-pattern` - Use Builder pattern for complex construction
73
- - `api-builder-must-use` - Add `#[must_use]` to builder types
74
- - `api-newtype-safety` - Use newtypes for type-safe distinctions
75
- - `api-typestate` - Use typestate for compile-time state machines
76
- - `api-sealed-trait` - Seal traits to prevent external implementations
77
- - `api-extension-trait` - Use extension traits to add methods to foreign types
78
- - `api-parse-dont-validate` - Parse into validated types at boundaries
79
- - `api-impl-into` - Accept `impl Into<T>` for flexible string inputs
80
- - `api-impl-asref` - Accept `impl AsRef<T>` for borrowed inputs
81
- - `api-must-use` - Add `#[must_use]` to `Result` returning functions
82
- - `api-non-exhaustive` - Use `#[non_exhaustive]` for future-proof enums/structs
83
- - `api-from-not-into` - Implement `From`, not `Into` (auto-derived)
84
- - `api-default-impl` - Implement `Default` for sensible defaults
85
- - `api-common-traits` - Implement `Debug`, `Clone`, `PartialEq` eagerly
86
- - `api-serde-optional` - Gate `Serialize`/`Deserialize` behind feature flag
87
-
88
- ### 5. Async/Await (HIGH)
89
- - `async-tokio-runtime` - Use Tokio for production async runtime
90
- - `async-no-lock-await` - Never hold `Mutex`/`RwLock` across `.await`
91
- - `async-spawn-blocking` - Use `spawn_blocking` for CPU-intensive work
92
- - `async-tokio-fs` - Use `tokio::fs` not `std::fs` in async code
93
- - `async-cancellation-token` - Use `CancellationToken` for graceful shutdown
94
- - `async-join-parallel` - Use `tokio::join!` for parallel operations
95
- - `async-try-join` - Use `tokio::try_join!` for fallible parallel ops
96
- - `async-select-racing` - Use `tokio::select!` for racing/timeouts
97
- - `async-bounded-channel` - Use bounded channels for backpressure
98
- - `async-mpsc-queue` - Use `mpsc` for work queues
99
- - `async-broadcast-pubsub` - Use `broadcast` for pub/sub patterns
100
- - `async-watch-latest` - Use `watch` for latest-value sharing
101
- - `async-oneshot-response` - Use `oneshot` for request/response
102
- - `async-joinset-structured` - Use `JoinSet` for dynamic task groups
103
- - `async-clone-before-await` - Clone data before await, release locks
104
-
105
- ### 6. Compiler Optimization (HIGH)
106
- - `opt-inline-small` - Use `#[inline]` for small hot functions
107
- - `opt-inline-always-rare` - Use `#[inline(always)]` sparingly
108
- - `opt-inline-never-cold` - Use `#[inline(never)]` for cold paths
109
- - `opt-cold-unlikely` - Use `#[cold]` for error/unlikely paths
110
- - `opt-likely-hint` - Use `likely()`/`unlikely()` for branch hints
111
- - `opt-lto-release` - Enable LTO in release builds
112
- - `opt-codegen-units` - Use `codegen-units = 1` for max optimization
113
- - `opt-pgo-profile` - Use PGO for production builds
114
- - `opt-target-cpu` - Set `target-cpu=native` for local builds
115
- - `opt-bounds-check` - Use iterators to avoid bounds checks
116
- - `opt-simd-portable` - Use portable SIMD for data-parallel ops
117
- - `opt-cache-friendly` - Design cache-friendly data layouts (SoA)
118
-
119
- ### 7. Naming Conventions (MEDIUM)
120
- - `name-types-camel` - Use `UpperCamelCase` for types, traits, enums
121
- - `name-variants-camel` - Use `UpperCamelCase` for enum variants
122
- - `name-funcs-snake` - Use `snake_case` for functions, methods, modules
123
- - `name-consts-screaming` - Use `SCREAMING_SNAKE_CASE` for constants/statics
124
- - `name-lifetime-short` - Use short lowercase lifetimes: `'a`, `'de`, `'src`
125
- - `name-type-param-single` - Use single uppercase for type params: `T`, `E`, `K`, `V`
126
- - `name-as-free` - `as_` prefix: free reference conversion
127
- - `name-to-expensive` - `to_` prefix: expensive conversion
128
- - `name-into-ownership` - `into_` prefix: ownership transfer
129
- - `name-no-get-prefix` - No `get_` prefix for simple getters
130
- - `name-is-has-bool` - Use `is_`, `has_`, `can_` for boolean methods
131
- - `name-iter-convention` - Use `iter`/`iter_mut`/`into_iter` for iterators
132
- - `name-iter-method` - Name iterator methods consistently
133
- - `name-iter-type-match` - Iterator type names match method
134
- - `name-acronym-word` - Treat acronyms as words: `Uuid` not `UUID`
135
- - `name-crate-no-rs` - Crate names: no `-rs` suffix
136
-
137
- ### 8. Type Safety (MEDIUM)
138
- - `type-newtype-ids` - Wrap IDs in newtypes: `UserId(u64)`
139
- - `type-newtype-validated` - Newtypes for validated data: `Email`, `Url`
140
- - `type-enum-states` - Use enums for mutually exclusive states
141
- - `type-option-nullable` - Use `Option<T>` for nullable values
142
- - `type-result-fallible` - Use `Result<T, E>` for fallible operations
143
- - `type-phantom-marker` - Use `PhantomData<T>` for type-level markers
144
- - `type-never-diverge` - Use `!` type for functions that never return
145
- - `type-generic-bounds` - Add trait bounds only where needed
146
- - `type-no-stringly` - Avoid stringly-typed APIs, use enums/newtypes
147
- - `type-repr-transparent` - Use `#[repr(transparent)]` for FFI newtypes
148
-
149
- ### 9. Testing (MEDIUM)
150
- - `test-cfg-test-module` - Use `#[cfg(test)] mod tests { }`
151
- - `test-use-super` - Use `use super::*;` in test modules
152
- - `test-integration-dir` - Put integration tests in `tests/` directory
153
- - `test-descriptive-names` - Use descriptive test names
154
- - `test-arrange-act-assert` - Structure tests as arrange/act/assert
155
- - `test-proptest-properties` - Use `proptest` for property-based testing
156
- - `test-mockall-mocking` - Use `mockall` for trait mocking
157
- - `test-mock-traits` - Use traits for dependencies to enable mocking
158
- - `test-fixture-raii` - Use RAII pattern (Drop) for test cleanup
159
- - `test-tokio-async` - Use `#[tokio::test]` for async tests
160
- - `test-should-panic` - Use `#[should_panic]` for panic tests
161
- - `test-criterion-bench` - Use `criterion` for benchmarking
162
- - `test-doctest-examples` - Keep doc examples as executable tests
163
-
164
- ### 10. Documentation (MEDIUM)
165
- - `doc-all-public` - Document all public items with `///`
166
- - `doc-module-inner` - Use `//!` for module-level documentation
167
- - `doc-examples-section` - Include `# Examples` with runnable code
168
- - `doc-errors-section` - Include `# Errors` for fallible functions
169
- - `doc-panics-section` - Include `# Panics` for panicking functions
170
- - `doc-safety-section` - Include `# Safety` for unsafe functions
171
- - `doc-question-mark` - Use `?` in examples, not `.unwrap()`
172
- - `doc-hidden-setup` - Use `# ` prefix to hide example setup code
173
- - `doc-intra-links` - Use intra-doc links: `[Vec]`
174
- - `doc-link-types` - Link related types and functions in docs
175
- - `doc-cargo-metadata` - Fill `Cargo.toml` metadata
176
-
177
- ### 11. Performance Patterns (MEDIUM)
178
- - `perf-iter-over-index` - Prefer iterators over manual indexing
179
- - `perf-iter-lazy` - Keep iterators lazy, collect() only when needed
180
- - `perf-collect-once` - Don't `collect()` intermediate iterators
181
- - `perf-entry-api` - Use `entry()` API for map insert-or-update
182
- - `perf-drain-reuse` - Use `drain()` to reuse allocations
183
- - `perf-extend-batch` - Use `extend()` for batch insertions
184
- - `perf-chain-avoid` - Avoid `chain()` in hot loops
185
- - `perf-collect-into` - Use `collect_into()` for reusing containers
186
- - `perf-black-box-bench` - Use `black_box()` in benchmarks
187
- - `perf-release-profile` - Optimize release profile settings
188
- - `perf-profile-first` - Profile before optimizing
189
-
190
- ### 12. Project Structure (LOW)
191
- - `proj-lib-main-split` - Keep `main.rs` minimal, logic in `lib.rs`
192
- - `proj-mod-by-feature` - Organize modules by feature, not type
193
- - `proj-flat-small` - Keep small projects flat
194
- - `proj-mod-rs-dir` - Use `mod.rs` for multi-file modules
195
- - `proj-pub-crate-internal` - Use `pub(crate)` for internal APIs
196
- - `proj-pub-super-parent` - Use `pub(super)` for parent-only visibility
197
- - `proj-pub-use-reexport` - Use `pub use` for clean public API
198
- - `proj-prelude-module` - Create `prelude` module for common imports
199
- - `proj-bin-dir` - Put multiple binaries in `src/bin/`
200
- - `proj-workspace-large` - Use workspaces for large projects
201
- - `proj-workspace-deps` - Use workspace dependency inheritance
202
-
203
- ### 13. Clippy & Linting (LOW)
204
- - `lint-deny-correctness` - `#![deny(clippy::correctness)]`
205
- - `lint-warn-suspicious` - `#![warn(clippy::suspicious)]`
206
- - `lint-warn-style` - `#![warn(clippy::style)]`
207
- - `lint-warn-complexity` - `#![warn(clippy::complexity)]`
208
- - `lint-warn-perf` - `#![warn(clippy::perf)]`
209
- - `lint-pedantic-selective` - Enable `clippy::pedantic` selectively
210
- - `lint-missing-docs` - `#![warn(missing_docs)]`
211
- - `lint-unsafe-doc` - `#![warn(clippy::undocumented_unsafe_blocks)]`
212
- - `lint-cargo-metadata` - `#![warn(clippy::cargo)]` for published crates
213
- - `lint-rustfmt-check` - Run `cargo fmt --check` in CI
214
- - `lint-workspace-lints` - Configure lints at workspace level
215
-
216
- ### 14. Anti-patterns (REFERENCE)
217
- - `anti-unwrap-abuse` - Don't use `.unwrap()` in production code
218
- - `anti-expect-lazy` - Don't use `.expect()` for recoverable errors
219
- - `anti-clone-excessive` - Don't clone when borrowing works
220
- - `anti-lock-across-await` - Don't hold locks across `.await`
221
- - `anti-string-for-str` - Don't accept `&String` when `&str` works
222
- - `anti-vec-for-slice` - Don't accept `&Vec<T>` when `&[T]` works
223
- - `anti-index-over-iter` - Don't use indexing when iterators work
224
- - `anti-panic-expected` - Don't panic on expected/recoverable errors
225
- - `anti-empty-catch` - Don't use empty `if let Err(_) = ...` blocks
226
- - `anti-over-abstraction` - Don't over-abstract with excessive generics
227
- - `anti-premature-optimize` - Don't optimize before profiling
228
- - `anti-type-erasure` - Don't use `Box<dyn Trait>` when `impl Trait` works
229
- - `anti-format-hot-path` - Don't use `format!()` in hot paths
230
- - `anti-collect-intermediate` - Don't `collect()` intermediate iterators
231
- - `anti-stringly-typed` - Don't use strings for structured data