13eholder/modern-cpp-skills/m05-type-driven
Claude Code and agent skill by 13eholder/modern-cpp-skills
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Mastering C++ Type-Driven Design. Triggers: strong types, phantom types, type state pattern, builder pattern, invalid state unrepresentable.
Install
npx vskill@latest install 13eholder/modern-cpp-skills/m05-type-drivenSKILL.md
The same SKILL.md was published earlier as 13eholder/modern-cpp-skills/m05-type-driven.
C++ Type-Driven Design
Core Question
Can I make this bug a compile error?
- Primitive Obsession: Using
intfor IDs,doublefor Money. Bad. - Strong Types:
struct UserId,struct Money. Good. - Type State:
Connection<OFF>vsConnection<ON>.
Error → Design Question
| Issue | Design Question | |
|---|---|---|
| Swapped arguments | Did you pass width to height? (Use Strong Types). | |
| Invalid State | Did you call read() on closed file? (Use Type State). | |
| Unit confusion | Did you mix Meters and Feet? (Use std::chrono style units). |
Thinking Prompt
- Is this `int` unique?
- Yes? → Wrap in
struct. struct UserId { int val; };preventsprocess(OrderId).
- Does valid usage depend on order?
- Yes? → Encode state in type.
Builder::port()returnsBuilderWithPort.
- Are units compatible?
- No? → Template tag.
Dist<Meters>+Dist<Feet>.
Trace Up / Down
- Trace Up:
- Issue: "Rocket crashed because of Metric vs Imperial confusion."
- Cause:
double calculate_trajectory(double dist)accepted any number. - Fix:
Dist<Meters> calculate(Dist<Meters> d). Compilation fails if you pass Feet.
- Trace Down:
- Intent: "Ensure file is open before reading."
- Code:
File<Open> f = File<Closed>().open(); f.read();
Quick Reference
| Pattern | Cost | Use When | |
|---|---|---|---|
| Struct Wrapper | Zero | Distinct IDs, coordinates. | |
| Enum Class | Zero | Type-safe flags (no implicit int conv). | |
| Phantom Type | Zero | Tracking state without storage. | |
| User Literal | Zero | 10_m, 50_s. |
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingm05-type-driven/SKILL.md
Popularity
- Repository stars
- 14
- Repository forks
- 2
- 7-day trend score
- 19
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/13eholder/modern-cpp-skills/m05-type-driven)