RTK Rust Design Patterns Patterns that apply to RTK's filter module architecture. Focused on CLI tool patterns, not web/service patterns. Pattern 1: Newtype (Type Safety) Use when: wrapping primitive types to prevent misuse (command names, paths, token counts). Pattern 2: Builder (Complex Configuration) Use when: a struct has 4+ optional fields, many with defaults. When NOT to use Builder: if the struct has 1-3 fields with obvious meaning. Over-engineering for simple cases. Pattern 3: State Machine (Parser/Filter Flows) Use when: parsing multi-section output (test results, build output) where…