/vibe-types:rustfrom vibe-types
Guides Rust type-system patterns: ownership, borrowing, lifetimes, traits, generics, Send/Sync, const generics. Helps debug borrow-checker errors and port type patterns from other languages.
Ships in vibe-types. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Base path:
${CLAUDE_PLUGIN_ROOT}/skills/rust
Let the type checker carry as much of correctness as it can. The idea is to move guarantees out of runtime checks, tests, and discipline and into the types, so that holding a value is itself evidence that its invariants hold. Wherever you can, make a bad state impossible to express instead of checking for it later. Treat these as defaults to apply with judgment, not as absolute rules.
usecases/UC01-invalid-states.mdcatalog/T26-refinement-types.mdusecases/UC11-effect-tracking.mdcatalog/T58-witness-evidence.mdBool has two and a three-case enum has three) match the values that are legal for the job, holding every value that should occur and as few as possible that should not. A practical rule: among the types that can represent every legal value, choose the one with the fewest inhabitants, since the extra inhabitants are exactly the values that should never occur and that you would otherwise have to check for. For a yes or no choice, Bool is more precise than Int; a closed enum is more precise than a String; NonEmptyList is more precise than List. A newtype covers a second case: UserId and OrderId may have the same number of inhabitants as the integer underneath, but as distinct types they can no longer be passed in place of one another. The limiting case, a type with no illegal inhabitants at all, is just make illegal states unrepresentable. → catalog/T03-newtypes-opaque.mdOption or Result so that "no answer" becomes a case the caller has to handle. Or narrow the input, for example taking a NonEmptyList so that head always has an answer. When you match, cover every constructor and avoid a catch-all case unless the set of cases is genuinely open, so that adding a variant later becomes a compile error instead of a silent fall-through. For a branch that genuinely cannot occur, close it with a value of an empty type (the uninhabited type, written Nothing, Never, !, or Empty depending on the language), which has no inhabitants and so proves the branch unreachable, rather than throwing a "can't happen" error that a later change can turn into a real crash. Finally, prefer a definition that provably terminates over one you only expect to terminate. → usecases/UC03-exhaustiveness.md, catalog/T34-never-bottom.mdcatalog/T32-immutability-markers.mdusecases/UC13-state-machines.mdClock, an HttpClient, a PaymentGateway, and so on) instead of calling a global or a singleton. A function whose type does not name a given authority then cannot use it, the caller decides what to pass down, and the code becomes easy to test by passing a different value. → catalog/T12-effect-tracking.mdOwnership & moves — prevent use-after-free and double-free; ensure deterministic cleanup → catalog/T10-ownership-moves.md
Borrowing & mutability — eliminate data races and iterator invalidation via aliasing rules (&T xor &mut T) → catalog/T11-borrowing-mutability.md
Lifetimes — prevent dangling references; prove every reference valid for its usage → catalog/T48-lifetimes.md
Structs, enums, newtypes — make invalid states unrepresentable; exhaustive match forces handling all variants → catalog/T01-algebraic-data-types.md
Generics & where clauses — generic code compiles only when operations are justified by declared bounds → catalog/T04-generics-bounds.md
Traits & impls — enforce contracts on types; one impl per trait-type pair globally → catalog/T05-type-classes.md
Associated types & advanced traits — lock output types per implementor; reduce caller confusion → catalog/T49-associated-types.md
Trait objects (dyn) — runtime polymorphism when concrete types are unknown; only object-safe traits qualify → catalog/T36-trait-objects.md
Inference, aliases, conversions — maintain type safety while permitting local inference; no silent conversions → catalog/T18-conversions-coercions.md
Smart pointers & interior mutability — flexible ownership (shared, interior-mutable) while preserving memory safety → catalog/T24-smart-pointers.md
Send & Sync — prevent data races at compile time by controlling what crosses thread boundaries → catalog/T50-send-sync.md
Const generics — encode sizes, dimensions, capacities in types; distinct values = distinct types → catalog/T15-const-generics.md
Coherence & orphan rules — prevent conflicting impls across crates; ensure independent publishing → catalog/T25-coherence-orphan.md
Trait solver & param env — deterministic zero-cost trait resolution; guides correct bounds → catalog/T37-trait-solver.md
Refinement types — newtype + smart constructor pattern; validated values with private fields; nutype derive macro → catalog/T26-refinement-types.md
Literal types — Rust lacks first-class literal types; const generics, enums, and typenum serve as alternatives → catalog/T52-literal-types.md
Path-dependent types — associated types as path-dependent analogs; GATs for higher-kinded path dependence → catalog/T53-path-dependent-types.md
Newtypes — zero-cost wrapper types with private fields; prevent value mix-ups → catalog/T03-newtypes-opaque.md
Derive macros — #[derive(Debug, Clone, Serialize)]; auto-generate trait impls from structure → catalog/T06-derivation.md
Null safety — no null in Rust; Option<T> enforces handling of absent values → catalog/T13-null-safety.md
Type narrowing — if let, match, let-else; exhaustive pattern matching → catalog/T14-type-narrowing.md
Compile-time computation — const fn, const blocks, compile-time evaluation → catalog/T16-compile-time-ops.md
Macros — macro_rules!, proc macros, syn/quote for code generation → catalog/T17-macros-metaprogramming.md
Equality safety — PartialEq/Eq are opt-in; no accidental cross-type equality → catalog/T20-equality-safety.md
Encapsulation — pub/pub(crate)/private-by-default module system → catalog/T21-encapsulation.md
Callable typing — Fn/FnMut/FnOnce trait hierarchy; closures and function pointers → catalog/T22-callable-typing.md
Type aliases — type Alias = ConcreteType; transparent aliases vs newtypes → catalog/T23-type-aliases.md
Phantom types — PhantomData<T> for variance control, typestate, lifetime markers → catalog/T27-erased-phantom.md
Record types — named-field structs; struct update syntax; destructuring → catalog/T31-record-types.md
Immutability — immutable by default; mut is opt-in; const for compile-time constants → catalog/T32-immutability-markers.md
Self type — Self refers to the implementing type; builders, From/Into → catalog/T33-self-type.md
Never type — ! bottom type; Infallible; empty enums; coerces to any type → catalog/T34-never-bottom.md
Union types (via enums) — enums as sum types; trait bounds as intersection → catalog/T02-union-intersection.md
Structural typing (via traits) — nominal typing with trait-based contracts → catalog/T07-structural-typing.md
Variance (implicit rules) — compiler-inferred variance; PhantomData for control → catalog/T08-variance-subtyping.md
Effect tracking (via Result) — Result<T,E> + ?; async/await; unsafe boundaries → catalog/T12-effect-tracking.md
Extension methods (via traits) — extension trait pattern; orphan rules → catalog/T19-extension-methods.md
Functor / Monad (via Iterator/Option/Result) — map, and_then, ? operator → catalog/T54-functor-applicative-monad.md
Monad transformers (via middleware) — tower layers, async middleware → catalog/T55-monad-transformers.md
Tagless final (via trait DI) — trait-based dependency injection → catalog/T56-tagless-final.md
Typestate pattern — PhantomData for zero-cost state encoding; canonical Rust pattern → catalog/T57-typestate.md
Witness types (via PhantomData markers) — compile-time evidence of preconditions → catalog/T58-witness-evidence.md
Existential types — dyn Trait, impl Trait; type erasure with contracts → catalog/T59-existential-types.md
Linear / affine types — ownership IS affine typing; each value used at most once (linear would require exactly once) → catalog/T60-linear-affine.md
Recursive types — enum + Box for indirection; compiler requires known size → catalog/T61-recursive-types.md
usecases/UC01-invalid-states.mdusecases/UC20-ownership-apis.mdusecases/UC04-generic-constraints.mdusecases/UC14-extensibility.mdSend/Sync) → usecases/UC21-concurrency.mdusecases/UC18-type-arithmetic.mdREADME.md (opens in a new tab)analysis/00-schema.md (opens in a new tab)analysis/10-rbe-findings.md (opens in a new tab)analysis/11-book-findings.md (opens in a new tab)analysis/12-rustcore-findings.md (opens in a new tab)analysis/20-merged-map.md (opens in a new tab)analysis/30-crossref-plan.md (opens in a new tab)analysis/40-readiness-report.md (opens in a new tab)catalog/00-overview.md (opens in a new tab)catalog/T01-algebraic-data-types.md (opens in a new tab)catalog/T02-union-intersection.md (opens in a new tab)catalog/T03-newtypes-opaque.md (opens in a new tab)catalog/T04-generics-bounds.md (opens in a new tab)catalog/T05-type-classes.md (opens in a new tab)catalog/T06-derivation.md (opens in a new tab)catalog/T07-structural-typing.md (opens in a new tab)catalog/T08-variance-subtyping.md (opens in a new tab)catalog/T10-ownership-moves.md (opens in a new tab)catalog/T11-borrowing-mutability.md (opens in a new tab)catalog/T12-effect-tracking.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
rust-type-system, borrow-checker, lifetimes, traits, generics, compile-time-safety
npx claudepluginhub jpablo/vibe-types --plugin vibe-types7 skills in this plugin
/leanvibe-types:leanLean 4 compile-time safety techniques — dependent types, inductive types, type classes, termination checking, propositions as types, proof automation. Use this skill whenever the user writes Lean 4 code, mentions dependent types, asks about theorem proving, discusses inductive types, type classes, tactics (simp, omega, decide), subtypes, termination proofs, or any Lean type system feature. Also use when formalizing invariants, writing proof-carrying code, or porting type patterns from Scala, Rust, or Haskell to Lean./pythonvibe-types:pythonPython type-checking constraint techniques — annotations, Union, Literal, TypedDict, Protocol, generics, TypeGuard, Final, dataclasses. Use this skill whenever the user writes Python with type hints, mentions mypy or pyright, asks about typing module features, discusses Protocol, TypedDict, NewType, dataclasses, Literal, overload, ParamSpec, or any type annotation. Also use when adding types to untyped code or debugging type checker errors./scalavibe-types:scalaScala 3 compile-time safety techniques — opaque types, enums/ADTs/GADTs, givens, match types, inline, capture checking. Use this skill whenever the user writes Scala 3 code, mentions type safety, asks about compiler errors, discusses ADTs, opaque types, given instances, context functions, match types, extension methods, or any Scala type system feature. Also use when porting type patterns from Rust, Python, or Haskell to Scala 3./typescriptvibe-types:typescriptTypeScript compile-time safety techniques — discriminated unions/exhaustive narrowing, structural typing, conditional types (keyof, infer, extends), mapped and utility types (Partial/Required/Readonly/Pick/Omit, DeepPartial), template literal types, branded/nominal types, satisfies/const assertions, strictNullChecks/noUncheckedIndexedAccess, generics. Use this skill whenever the user writes TypeScript/TS code; wants to derive static types from validation schemas (Zod z.infer, io-ts, Valibot, TypeBox) to keep schema and types in sync; mentions mapped/utility types (“make every field readonly and optional”), keyof/infer/generic constraints, template literal types, discriminated unions/narrowing or exhaustiveness checks, or asks about tsc/tsserver errors like TS2322/TS2345/TS2559/TS2367; also when porting type-level patterns from Scala, Rust, Python, or Haskell to TypeScript. Do not use for JavaScript runtime code, framework behavior (Node/React), build tooling, performance, or schema parsing/validation runtime concerns./verify-markdown-snippetsVerify every code snippet embedded in a markdown file for syntactic and type correctness, using the language-specific project under `projects/`. Use this skill proactively whenever the user asks to check, verify, validate, lint, or type-check code examples inside markdown — docs, tutorials, PR reviews of documentation changes, skill catalogs, blog posts, README files, anything with fenced code blocks. Also use it when the user is reviewing a pull request that touches markdown files containing code examples, or when they mention wanting to make sure their documentation code is "runnable" or "doesn't lie". The skill produces a per-snippet report (both markdown and JSON) listing exact syntax errors, type errors, and any snippets that lack a language tag./cleanvibe-types:cleanApply vibe-types catalog and use-case knowledge to refactor source files in place. Use when the user invokes /vibe-clean (or asks you to "vibe-clean" a file, directory, or branch) to systematically improve code using the techniques in the loaded vibe-types skill. Does NOT change observable behavior, public APIs, or test assertions.
Other plugins' skills for the same job