proxy-pattern

Intercept and standardize JavaScript object interactions with Proxy traps and Reflect.

235|25|Updated Mar 24, 2026
One-click install
npx skills add https://github.com/PatternsDev/skills --skill proxy-pattern-patternsdev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: proxy-pattern
Source: https://github.com/PatternsDev/skills/tree/main/javascript/proxy-pattern
Command: npx skills add https://github.com/PatternsDev/skills --skill proxy-pattern-patternsdev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The Proxy pattern lets you intercept and customize interactions with objects, enabling validation, auditing, and controlled access when properties are read, written, or functions are invoked.

Core Features & Use Cases

  • Define a handler with get and set traps to observe and modify property interactions.
  • Use Reflect to perform safe reads and writes within traps for data integrity.
  • Apply to scenarios requiring validation, logging, or access control across model objects.

Quick Start

Apply a Proxy to a sample object and observe how reads, writes, and calls are intercepted.

Frequently Asked Questions about proxy-pattern

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I intercept object property reads and writes in JavaScript for validation?

You intercept object property reads and writes in JavaScript for validation by defining a handler with get and set traps. This Proxy pattern observes and modifies interactions to ensure data integrity before properties are accessed or changed.

What is the JavaScript Proxy pattern used for in data objects?

The JavaScript Proxy pattern is used for intercepting and standardizing interactions with data objects. It enables validation, auditing, logging, and controlled access when properties are read, written, or functions are invoked.

How do I use Reflect to ensure safe reads and writes inside proxy traps?

Use Reflect inside proxy traps to perform safe reads and writes by forwarding the default object behavior. Applying Reflect methods within get and set traps maintains standard data integrity while allowing custom interception logic.

Can I apply the proxy pattern to log function invocations on UI models?

Yes, you can apply the Proxy pattern to log function invocations on UI models. Defining a handler with traps allows you to observe and audit function calls and property interactions across model objects.

Does JavaScript proxy pattern require external dependencies for access control?

No, the JavaScript Proxy pattern requires no external dependencies for access control. It uses built-in language features like handler traps and Reflect to intercept and manage object interactions natively.