Skip to main content
skill CX Codex

m05-type-driven — Claude Code skill: design and install

This skill helps shape Rust types so invalid states can be rejected by the compiler. Use it for newtypes, type-state APIs, and checked builders.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add actionbook/rust-skills --skill m05-type-driven -a claude-code
Open on GitHub

What m05-type-driven does

m05-type-driven frames type-driven design around one question: can a constraint live in the type system instead of a runtime check? It covers newtypes for semantic values, type state for state transitions, PhantomData, marker traits, builders, sealed traits, and zero-sized marker types.

The skill maps common design needs to patterns. A primitive wrapper handles type safety, a type parameter can encode a valid state, and a builder can control gradual construction. Its examples include Connection<Connected>, PhantomData<T>, and a private sealed trait that blocks outside implementations.

For a Rust project, that is a reason to inspect invariants before adding runtime validation. Public fields can let callers break those invariants, while Option may leave initialization state unclear. The skill is available for Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, and OpenCode.

What it helps with

  • encode an invariant in a type
  • separate object states at compile time
  • wrap a primitive in a semantic newtype
  • construct an API with a typed builder
  • prevent external trait implementations

Example prompts for the agent

  • Design Email as a validated newtype and show where construction should validate it.
  • Model Connection with type states for Disconnected → Connected → Authenticated.
  • Review this Rust API and replace runtime checks with a suitable newtype, PhantomData, marker trait, or builder.

How to install m05-type-driven

1Skills CLI (Vercel)

npx skills add actionbook/rust-skills --skill m05-type-driven -a claude-code

2Manually: put the files in place

~/.claude/skills/m05-type-driven/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/m05-type-driven/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about m05-type-driven

How do I install m05-type-driven in Claude Code?

Run npx skills add actionbook/rust-skills --skill m05-type-driven -a claude-code, then check ~/.claude/skills/m05-type-driven/SKILL.md. The listed installation sequence repeats the same command: npx skills add actionbook/rust-skills --skill m05-type-driven -a claude-code.

What does m05-type-driven do?

It helps choose Rust patterns for encoding invariants with newtypes, type states, PhantomData, marker traits, builders, sealed traits, and ZSTs. The focus is moving checks into the type system when that is possible.

Which patterns does m05-type-driven cover?

It uses newtypes for primitive type safety, type state for compile-time state validation, and builders for gradual construction. PhantomData is used for lifetime and variance markers.

Similar skills

All skills for Programming languages →

From the same set33

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor