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.
npx skills add actionbook/rust-skills --skill m05-type-driven -a claude-codeWhat 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
Emailas a validated newtype and show where construction should validate it. - Model
Connectionwith type states forDisconnected→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-code2Manually: put the files in place
~/.claude/skills/m05-type-driven/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/m05-type-driven/
1Skills CLI (Vercel)
npx skills add actionbook/rust-skills --skill m05-type-driven -a codex2Manually: put the files in place
.agents/skills/m05-type-driven/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add actionbook/rust-skills --skill m05-type-driven -a cursor2Manually: put the files in place
.cursor/skills/m05-type-driven/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install actionbook/rust-skills m05-type-driven2Manually: put the files in place
.github/skills/m05-type-driven/SKILL.md1Skills CLI (Vercel)
npx skills add actionbook/rust-skills --skill m05-type-driven -a gemini-cli2Platform CLI
gemini skills install https://github.com/actionbook/rust-skills --path skills/m05-type-drivenManually: put the files in place
.devin/skills/m05-type-driven/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add actionbook/rust-skills --skill m05-type-driven -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
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.