Mastering C++ Type-Driven Design. Triggers: strong types, phantom types, type state pattern, builder pattern, invalid state unrepresentable.
Can I make this bug a compile error?
int for IDs, double for Money. Bad.struct UserId, struct Money. Good.Connection<OFF> vs Connection<ON>.| 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). |
Is this int unique?
struct.struct UserId { int val; }; prevents process(OrderId).Does valid usage depend on order?
Builder::port() returns BuilderWithPort.Are units compatible?
Dist<Meters> + Dist<Feet>.Trace Up:
double calculate_trajectory(double dist) accepted any number.Dist<Meters> calculate(Dist<Meters> d). Compilation fails if you pass Feet.Trace Down:
File<Open> f = File<Closed>().open(); f.read();| 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. |
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer