proxy-pattern
Installation
SKILL.md
Proxy Pattern
With a Proxy object, we get more control over the interactions with certain objects. A proxy object can determine the behavior whenever we're interacting with the object, for example when we're getting a value, or setting a value.
When to Use
- Use this when you need to add validation, formatting, notifications, or debugging to object access
- This is helpful for controlling and intercepting property gets and sets on objects
When NOT to Use
- In performance-critical hot paths where Proxy overhead on every property access matters
- When simple getter/setter methods or Object.defineProperty achieve the same validation with less indirection
- When the target objects are rarely accessed and the interception logic isn't needed