# M05 type driven

> M05 type driven is an open-source agent skill for developer tools. Guides Rust code toward type-level designs that rule out invalid states at compile time. It is available on Claude Code.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code
- **Website:** https://github.com/k1-c/linear-tui/tree/main/.claude/skills/m05-type-driven
- **Repository:** https://github.com/k1-c/linear-tui
- **GitHub stars:** 21
- **License:** MIT
- **Skill name:** m05-type-driven
- **Collection:** https://github.com/k1-c/linear-tui
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-02

## About

This skill steers an agent to answer design questions with the type system before reaching for runtime checks. It walks through patterns such as newtypes for semantic values, type state for state machines, PhantomData for phantom parameters, marker traits for capabilities, builders for gradual construction and sealed traits for closed sets of implementations. Each pattern comes with a short Rust example and a quick reference table.

The guidance is organised as a thinking routine: the agent checks whether a constraint can be encoded in types, whether validation can happen at construction or at a state transition, and who needs to know the invariant. It also lists anti-patterns such as boolean flags for states and public fields that carry invariants, with the preferred alternative for each.

The skill is a single instruction file with no scripts. It expects Rust code and points to related skills for domain modelling, trait design and error handling in constructors.

## When your agent uses it

> CRITICAL: Use for type-driven design. Triggers: type state, PhantomData, newtype, marker trait, builder pattern, make invalid states unrepresentable, compile-time validation, sealed trait, ZST, 类型状态, 新类型模式, 类型驱动设计

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/k1-c/linear-tui/tree/HEAD/.claude/skills/m05-type-driven)
- [License: MIT](https://github.com/k1-c/linear-tui/tree/HEAD/.claude/skills/m05-type-driven)

## Features

- **Newtype wrappers:** Shows how to wrap primitives in named types so that semantic values cannot be mixed up.
- **Type state machines:** Explains encoding valid states of an object as distinct types with transitions between them.
- **PhantomData usage:** Covers using phantom type parameters for variance, lifetimes and state tracking.
- **Marker and sealed traits:** Describes capability marker traits and sealing traits to restrict external implementations.
- **Builder pattern guidance:** Advises when a builder helps construct values gradually instead of using uninitialized options.
- **Design anti-patterns:** Lists common mistakes such as boolean state flags and public fields with invariants, with alternatives.

## Good for

- Refactor a connection API so it cannot send data before authenticating
- Replace raw String identifiers with distinct newtype wrappers
- Design a builder that forces required fields before building a struct
- Seal a trait so that downstream crates cannot implement it
- Review a Rust module for boolean flags that should become types

## Install

### Claude Code

Copy the skill folder to `~/.claude/skills/m05-type-driven` to use it in all your projects:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/k1-c/linear-tui.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/m05-type-driven &&
cp -R "$tmp/.claude/skills/m05-type-driven" ~/.claude/skills/m05-type-driven &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/m05-type-driven` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/m05-type-driven` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/k1-c/linear-tui.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/m05-type-driven &&
cp -R "$tmp/.claude/skills/m05-type-driven" ~/.agents/skills/m05-type-driven &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/m05-type-driven` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/m05-type-driven` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/k1-c/linear-tui.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/m05-type-driven &&
cp -R "$tmp/.claude/skills/m05-type-driven" ~/.cursor/skills/m05-type-driven &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/m05-type-driven` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/k1-c/linear-tui.git --path .claude/skills/m05-type-driven
```

Or copy the folder to `~/.gemini/skills/m05-type-driven` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/m05-type-driven`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/k1-c/linear-tui.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/m05-type-driven &&
cp -R "$tmp/.claude/skills/m05-type-driven" ~/.copilot/skills/m05-type-driven &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/m05-type-driven` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/k1-c/linear-tui.git
```

Then copy `linear-tui/.claude/skills/m05-type-driven` into your agent's skills folder as `m05-type-driven`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does M05 type driven need to run?

It is a single SKILL.md file with no scripts. It is written for Rust code and does not list other tools.

### When does the skill trigger?

It triggers on terms such as type state, PhantomData, newtype, marker trait, builder pattern, sealed trait, ZST and compile-time validation, including Chinese keywords for type-state and newtype design.

### How do I install M05 type driven in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/m05-type-driven to use it in all your projects, or to .claude/skills/m05-type-driven in one project.

### Does M05 type driven run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use M05 type driven?

Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.

### What are the best alternatives to M05 type driven?

The closest alternatives to M05 type driven are Principle type system discipline, M09 domain, TypeScript best practices, M04 zero cost and Principle model the domain.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Principle type system discipline](https://ai-powered.com/skills/principle-type-system-discipline): Principle type system discipline is an open-source agent skill for developer tools.
- [M09 domain](https://ai-powered.com/skills/m09-domain): M09 domain is an open-source agent skill for developer tools.
- [TypeScript best practices](https://ai-powered.com/skills/typescript-best-practices): TypeScript best practices is an open-source agent skill for developer tools.
- [M04 zero cost](https://ai-powered.com/skills/m04-zero-cost): M04 zero cost is an open-source agent skill for developer tools.
- [Principle model the domain](https://ai-powered.com/skills/principle-model-the-domain): Principle model the domain is an open-source agent skill for developer tools.
- [M06 error handling](https://ai-powered.com/skills/m06-error-handling): M06 error handling is an open-source agent skill for developer tools.
- [Coding guidelines](https://ai-powered.com/skills/coding-guidelines): Coding guidelines is an open-source agent skill for developer tools.
- [M15 anti pattern](https://ai-powered.com/skills/m15-anti-pattern): M15 anti pattern is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/m05-type-driven
