record-types-sync
Installation
SKILL.md
Use Record Types to Keep Values in Sync
Overview
When you have parallel data structures that need to stay synchronized - like a type and a configuration object for that type's properties - use Record<keyof T, V> to enforce that every property is accounted for. This technique ensures that when you add a new property to a type, you get a compile error reminding you to update related code.
This pattern is invaluable for optimization checks, property validators, and any code that needs to enumerate or configure all properties of a type.
When to Use This Skill
- Properties need synchronized configuration
- Adding new properties requires updates elsewhere
- Implementing shouldComponentUpdate-style optimizations
- Building property validators or transformers
- Maintaining parallel data structures
The Iron Rule
Use Record<keyof T, V> to enforce that all properties of T are accounted for in related configuration objects.