skills/design-patterns/structurals/pattern-proxy/SKILL.md
Teaches and applies the Proxy structural design pattern — providing a substitute for another object to control access, add lazy loading, logging, or caching. Trigger: When controlling access to objects, adding cross-cutting concerns, or lazy loading.
npx skillsauth add johnnystefan/test-saas-business pattern-proxyInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Provides a substitute or placeholder for another object to control access to it (e.g., lazy loading, logging, access control).
interface Subject {
request(): void;
}
class RealSubject implements Subject {
request() {
console.log('RealSubject handling request');
}
}
class ProxySubject implements Subject {
private realSubject: RealSubject | null = null;
request() {
if (this.checkAccess()) {
if (!this.realSubject) this.realSubject = new RealSubject(); // Lazy Init
this.realSubject.request();
this.logAccess();
}
}
private checkAccess(): boolean {
return true;
}
private logAccess() {
console.log('Proxy: Logging request');
}
}
tools
Zustand 5 state management patterns. Trigger: When implementing client-side state with Zustand (stores, selectors, persist middleware, slices).
databases
Zod 4 schema validation patterns. Trigger: When creating or updating Zod v4 schemas for validation/parsing (forms, request payloads, adapters), including v3 -> v4 migration patterns.
development
Vitest unit testing patterns with React Testing Library. Trigger: When writing unit tests for React components, hooks, or utilities.
tools
Vite 8 (Rolldown-powered) build tool configuration, plugin API, SSR, and migration guide. Trigger: When working with vite.config.ts, Vite plugins, building libraries, or SSR apps with Vite.