env-patcher

Generate mock browser environment scripts for Node.js VMs.

3|2|Updated Apr 12, 2026
One-click install
npx skills add https://github.com/woxiangyangzhimao/skills --skill env-patcher
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: env-patcher
Source: https://github.com/woxiangyangzhimao/skills/tree/main/env-patcher
Command: npx skills add https://github.com/woxiangyangzhimao/skills --skill env-patcher

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires vm2, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill addresses the issue of running JavaScript SDKs that require browser environments within Node.js VMs by providing mock scripts to mimic the necessary browser APIs.

Core Features & Use Cases

  • Browser API Mocking: Generates browser.js files to simulate browser APIs like window, document, navigator, etc., for Node.js VMs.
  • Template Selection: Offers templates for different levels of environment coverage, from basic to full SDK support.
  • SDK Validation: Verifies that the generated environment is compatible with the target SDK.
  • Use Case: When a JavaScript SDK developed for browser environments needs to be used in a Node.js environment, this Skill can be used to generate the necessary environment patches.

Quick Start

Run the env-patcher skill with the target SDK file to generate the required browser environment patches.

Frequently Asked Questions about env-patcher

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

FAQPage Schema
How do I run a browser JavaScript SDK in a Node.js VM?

Mocking browser APIs in Node.js requires generating scripts that simulate window, document, and navigator objects. This Skill creates those patch files for Node.js VMs to enable browser SDK functionality within server-side environments.

How do I mock the window and document objects for Node.js?

Mocking window and document objects for Node.js involves generating a browser.js file that defines these global APIs. This Skill provides templates for different coverage levels to simulate the necessary browser environment within your VM sandbox.

Can I validate if a mock browser environment supports my target SDK?

Yes, you can validate if a mock browser environment supports your target SDK. This Skill includes validation steps that verify the generated mock scripts are compatible with the specific JavaScript SDK you intend to run.

Does vm2 support sandboxing browser API patches for Node.js?

Yes, vm2 supports sandboxing browser API patches for Node.js by providing an isolated execution environment. This Skill leverages vm2 to safely execute the generated mock scripts and run browser-dependent SDKs without affecting the host system.

What are the limitations of mocking browser APIs in a Node.js VM?

Limitations of mocking browser APIs in a Node.js VM include incomplete environment coverage for complex SDKs requiring full DOM rendering or specific browser engines. This Skill offers selectable templates to mitigate gaps, but full SDK support may vary.