/vibe-types:leanfrom vibe-types
Guides writing Lean 4 code with compile-time safety: dependent types, inductive types, type classes, proof automation, and making illegal states unrepresentable.
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/lean
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. → catalog/T51-totality.md, catalog/T28-termination.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.mdInductive types & pattern matching — closed type hierarchies with exhaustive matching; compiler rejects incomplete matches → catalog/T01-algebraic-data-types.md
Dependent types & Pi types — return/field types depend on values; compiler checks index consistency → catalog/T09-dependent-types.md
Structures, inheritance, constructors — named-field product types with single-constructor guarantees; extends for inheritance → catalog/T31-record-types.md
Type classes & instance resolution — constrain generic functions to types with required capabilities → catalog/T05-type-classes.md
Universes & universe polymorphism — prevent type-in-type paradoxes; Sort u, Type u, Prop → catalog/T35-universes-kinds.md
Propositions as types (Prop) — encode invariants as Prop; compiler requires proof terms as evidence → catalog/T29-propositions-as-types.md
Termination & well-founded recursion — every recursive function must terminate; structural recursion or termination_by proof → catalog/T28-termination.md
Totality, partial functions — functions must handle all inputs; partial opts out but taints the result → catalog/T51-totality.md
Monads, do-notation, IO — side effects tracked via monadic types; IO demarcates impure computation → catalog/T12-effect-tracking.md
Coercions & Coe — automatic safe conversions between types; compiler inserts coercions where declared → catalog/T18-conversions-coercions.md
Auto-bound implicits & instances — compiler infers implicit arguments; [inst : C a] constrains to types with evidence → catalog/T38-implicits-auto-bound.md
Macros, elaboration, syntax — compile-time metaprogramming via syntax, macro_rules, and elab → catalog/T17-macros-metaprogramming.md
Proof automation (simp, decide, omega) — automate proof obligations; state what must hold, let tactics verify it → catalog/T30-proof-automation.md
Subtypes & refinement types — attach predicates to types ({ n : Nat // n > 0 }); construction requires proof → catalog/T26-refinement-types.md
Opaque definitions & reducibility — opaque def prevents unfolding outside the module; definitional encapsulation → catalog/T21-encapsulation.md
Notation, attributes, options — @[simp], @[inline], @[reducible] control how the checker treats definitions → catalog/T39-notation-attributes.md
Literal types — dependent types subsume literal types; any value can appear in a type via indexing → catalog/T52-literal-types.md
Path-dependent types — dependent types subsume path dependence; structures with type-valued fields → catalog/T53-path-dependent-types.md
Newtypes & opaque definitions — single-field structures, abbrev, opaque for hidden definitions → catalog/T03-newtypes-opaque.md
Null safety — no null in Lean; Option α is the standard pattern → catalog/T13-null-safety.md
Type narrowing — pattern matching narrows types; dependent match refines per branch → catalog/T14-type-narrowing.md
Compile-time computation — everything is compile-time; #eval, decide, simp, native_decide → catalog/T16-compile-time-ops.md
Equality safety — BEq/DecidableEq are opt-in; propositional vs boolean equality → catalog/T20-equality-safety.md
Callable typing — first-class functions, dependent function types, automatic currying → catalog/T22-callable-typing.md
Type aliases — abbrev (reducible), def (semireducible), opaque (irreducible) → catalog/T23-type-aliases.md
Erased types & Prop — Prop universe is erased at runtime; zero-cost proof evidence → catalog/T27-erased-phantom.md
Immutability — everything immutable by default; IO.Ref for controlled mutation → catalog/T32-immutability-markers.md
Empty & False — Empty type and False proposition; absurd for impossible cases → catalog/T34-never-bottom.md
Type lambdas — type-level functions are just functions; no special syntax needed → catalog/T40-type-lambdas.md
Match on types — dependent match works at the type level naturally → catalog/T41-match-types.md
Const generics (via dependent types) — dependent types subsume value-parameterized types → catalog/T15-const-generics.md
Union types (via inductives) — Sum α β or custom inductives for alternatives → catalog/T02-union-intersection.md
Generics (via type classes) — instance arguments [Ord α] serve as bounds → catalog/T04-generics-bounds.md
Derivation (limited) — deriving Repr, BEq, Inhabited; Mathlib extends further → catalog/T06-derivation.md
Extension methods (via scoped instances) — namespaced dot notation, open ... in → catalog/T19-extension-methods.md
Coherence (via scoping) — instance priority, scoped instance, overlap handling → catalog/T25-coherence-orphan.md
Self type (via dependent types) — no Self keyword; dependent types express this naturally → catalog/T33-self-type.md
Instance resolution — synthesis, backtracking, priority ordering → catalog/T37-trait-solver.md
Context functions (via instance arguments) — [Ord α] is automatically supplied → catalog/T42-context-functions.md
Associated types (via structure fields) — type-valued fields with outParam → catalog/T49-associated-types.md
Runtime polymorphism (via coercions + type classes) — heterogeneous collections, existential wrappers for open dispatch → catalog/T36-trait-objects.md
Functor / Applicative / Monad — native type classes; do-notation desugars to bind → catalog/T54-functor-applicative-monad.md
Monad transformers — StateT, ReaderT, ExceptT; MonadLift between layers → catalog/T55-monad-transformers.md
Tagless final (via type class abstraction) — polymorphic interpretation → catalog/T56-tagless-final.md
Typestate pattern — indexed inductive types for protocol states → catalog/T57-typestate.md
Witness & evidence types — Prop proofs as evidence; Decidable for runtime → catalog/T58-witness-evidence.md
Existential types — Sigma types, existential quantification → catalog/T59-existential-types.md
Recursive types — inductive types ARE recursive types; termination checked → catalog/T61-recursive-types.md
usecases/UC01-invalid-states.mdusecases/UC02-domain-modeling.mdusecases/UC03-exhaustiveness.mdusecases/UC12-compile-time.mdusecases/UC11-effect-tracking.mdusecases/UC04-generic-constraints.mdusecases/UC24-termination.mdusecases/UC10-encapsulation.mdREADME.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/T09-dependent-types.md (opens in a new tab)catalog/T12-effect-tracking.md (opens in a new tab)catalog/T13-null-safety.md (opens in a new tab)catalog/T14-type-narrowing.md (opens in a new tab)catalog/T15-const-generics.md (opens in a new tab)catalog/T16-compile-time-ops.md (opens in a new tab)catalog/T17-macros-metaprogramming.md (opens in a new tab)catalog/T18-conversions-coercions.md (opens in a new tab)catalog/T19-extension-methods.md (opens in a new tab)catalog/T20-equality-safety.md (opens in a new tab)catalog/T21-encapsulation.md (opens in a new tab)catalog/T22-callable-typing.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub jpablo/vibe-types --plugin vibe-types7 skills in this plugin
/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./rustvibe-types:rustRust compile-time safety techniques — ownership, borrowing, lifetimes, traits, generics, Send/Sync, const generics. Use this skill whenever the user writes Rust code, mentions ownership or borrowing, asks about lifetime errors, discusses trait bounds, Send/Sync, derive macros, PhantomData, newtype patterns, or any Rust type system feature. Also use when debugging borrow checker errors or porting type patterns from Scala, Python, or Haskell to Rust./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