proxy-pattern

Implement JavaScript Proxy get and set traps with Reflect delegation.

Updated Oct 26, 2025
One-click install
npx skills add https://github.com/jcsoftdev/pulzifi-back --skill proxy-pattern-jcsoftdev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: proxy-pattern
Source: https://github.com/jcsoftdev/pulzifi-back/tree/main/.claude/skills/proxy-pattern
Command: npx skills add https://github.com/jcsoftdev/pulzifi-back --skill proxy-pattern-jcsoftdev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Intercept and regulate interactions with JavaScript objects to enforce validation, auditing, and access control without altering the underlying objects directly.

Core Features & Use Cases

  • Use get and set traps to monitor and control property access and assignment.
  • Leverage Reflect for safe delegation of operations to the target object.
  • Add validation, formatting, notifications, or debugging hooks to object interactions.

Quick Start

Create a Proxy for a target object with a handler that defines get and set traps to enforce validation.

Frequently Asked Questions about proxy-pattern

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

FAQPage Schema
How do I validate object property assignments in JavaScript without modifying the original object?

You can enforce validation on object property assignments by defining a Proxy with a set trap, allowing you to intercept assignments and apply validation logic without altering the target object directly.

How does a JavaScript Proxy intercept property access and function calls?

A JavaScript Proxy intercepts property access and function calls through handler traps like get and set, regulating interactions with the target object by defining custom behavior for each operation.

What is the best way to add logging or access control to JavaScript object interactions?

The best way to add logging or access control to object interactions is using a Proxy pattern, where handler traps monitor property gets and sets to enforce auditing and control rules.

Can I use Reflect to safely delegate operations when implementing a Proxy pattern?

Yes, you can use Reflect within Proxy handler traps to safely delegate operations back to the target object, ensuring standard object behaviors are preserved while adding interception logic.

When should I not use a JavaScript Proxy for intercepting object interactions?

You should avoid using a Proxy when you need to modify the object's structure directly or when standard property descriptors suffice, as Proxy introduces interception overhead for dynamic behavior regulation.

How do I set up a Proxy handler with get and set traps for validation in JavaScript?

To set up a Proxy handler for validation, create a target object and a handler object containing get and set traps, applying optional validation logic inside the set trap before assignment.