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-driven

SKILL.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 int for IDs, double for Money. Bad.
  • Strong Types: struct UserId, struct Money. Good.
  • Type State: Connection<OFF> vs Connection<ON>.

Error → Design Question

IssueDesign Question
Swapped argumentsDid you pass width to height? (Use Strong Types).
Invalid StateDid you call read() on closed file? (Use Type State).
Unit confusionDid you mix Meters and Feet? (Use std::chrono style units).

Thinking Prompt

  1. Is this `int` unique?
  • Yes? → Wrap in struct.
  • struct UserId { int val; }; prevents process(OrderId).
  1. Does valid usage depend on order?
  • Yes? → Encode state in type.
  • Builder::port() returns BuilderWithPort.
  1. 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

PatternCostUse When
Struct WrapperZeroDistinct IDs, coordinates.
Enum ClassZeroType-safe flags (no implicit int conv).
Phantom TypeZeroTracking state without storage.
User LiteralZero10_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

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/13eholder/modern-cpp-skills/m05-type-driven/badge)](https://verified-skill.com/skills/13eholder/modern-cpp-skills/m05-type-driven)

Something wrong with this skill or its page? Tell us.