env-patch

env-patch is a skill for Claude Code from zhizhuodemao/ai-reverse-toolkit. It costs 141 tokens per session (2,280 once invoked), scanned A, original, MIT.

A process for running browser-dependent encrypted JavaScript in Node.js, a JavaScript runtime outside a web browser, by supplying the browser objects and functions the code expects.

In plain words
What is it for?
Use it after finding an encryption entry point to extract or run a browser-based module independently in Node.js, including some Webpack modules and virtual-machine code.
Why use it?
Code copied from a browser may fail in Node.js because objects such as document, navigator, or location do not exist there. This process helps identify those missing pieces and add them in a separate runner file.

Skill for Claude Code

Written for Claude Code: argument-hint in frontmatter.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/zhizhuodemao/ai-reverse-toolkit/env-patch
Any agent
npx skills add zhizhuodemao/ai-reverse-toolkit --skill env-patch
Clone the repo
git clone --depth 1 https://github.com/zhizhuodemao/ai-reverse-toolkit

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for env-patch

README.md
[![agentmods](https://agentmods.dev/badge/skills/zhizhuodemao/ai-reverse-toolkit/env-patch.svg)](https://agentmods.dev/skills/zhizhuodemao/ai-reverse-toolkit/env-patch)
Your own site
<a href="https://agentmods.dev/skills/zhizhuodemao/ai-reverse-toolkit/env-patch"><img src="https://agentmods.dev/badge/skills/zhizhuodemao/ai-reverse-toolkit/env-patch.svg" alt="Measured on agentmods" height="20"></a>
Per session 141 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,280 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00141 $0.02280
Opus 5 $0.00071 $0.01140
Sonnet 5 $0.00028 $0.00456
Haiku 4.5 $0.00014 $0.00228

Measured 6d ago against content hash d98bf5f1f0f5, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

env-patch scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/env_core.js, scripts/webpack_runtime.js), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

| 运行时动态加载 | curl 下载到 `source/`,复制到 `env/` | `references/dynamic-loading.md` |
skills/env-patch/SKILL.md · 185 lines

How it starts

The opening of the file, as written. The whole thing — 185 lines — stays where its author put it; the contents beside it link to each section on GitHub.

env-patch

$ARGUMENTS 执行补环境方案。

前置条件:已知加密入口(模块 ID、函数名、所在脚本)。如未定位,先用 /find-crypto-entry

核心概念

  • env_core.js 是引擎:提供工具函数(setFuncNative / setObjNative / getNativeProto / wrapFunc / monitor / createProxy)和诊断报告。引擎不含任何环境存根,复制后不再修改。
  • run.js 是策略:所有环境存根、补丁、加载逻辑都写在 run.js 中。每轮诊断后只改 run.js。
  • browser-stubs.md 是参考目录:按诊断报告中出现的 UNDEFINED/ERRORS 按需取用存根代码。

铁律

  1. 禁止修改原始 JSsource/ 下文件只读。env/ 下的 JS 副本(main.js / sdk.js / bytecode.js)一旦生成即为定稿,不再修改。所有补丁写在 run.js / sign.js 中。
  2. 必须 require env_core.js — 禁止在 run.js 中重写 setFuncNative / setObjNative / createProxy 等工具函数。所有工具通过 const env = require('./env_core') 引入,然后调用 env.setFuncNative() / env.createProxy() 等。env_core.js 复制后不再修改。如果需要额外 helper,写在 run.js 顶部,但不得重复实现 env_core 已有的功能。
  3. 先分析 VMP 入口参数 — VMP 入口的依赖数组决定补环境边界。typeof chrome !== "undefined" ? chrome : undefined 检查的是 globalThis,不是 window。必须用 Object.defineProperty(global, name, ...) 同步。
  4. 加载顺序是致命的 — VMP 在 require()瞬间初始化并读取环境,之后不可更改。run.js 中的代码必须严格按以下顺序:
    1. const env = require('./env_core') — 获取工具(第一行)
    2. 构建存根对象(document / navigator / location 等)
    3. env.init({ window, document, navigator, location }) — 阻断 Node 泄露 + 挂载全局
    4. 额外环境补齐 — performance、chrome 等全局同步
    5. require('./main.js') — 加载目标 JS
    6. 测试签名
  5. 格式验证优先于请求验证 — 签名长度/前缀与浏览器不一致 = 降级,即使 HTTP 200 也是假阳性。

模板

文件 用途
${CLAUDE_SKILL_DIR}/scripts/env_core.js 工具集 + Proxy 引擎 + 诊断报告
${CLAUDE_SKILL_DIR}/scripts/webpack_runtime.js 最小 webpack runtime

复制到项目 env/ 后,env_core.js 不再修改

执行流程

Step 1: 搭建项目结构

<project>/
├── source/     # 原始 JS(下载,不修改)
├── env/        # 运行环境
│   ├── env_core.js      # 从模板复制,不改
│   ├── main.js          # 目标 JS 副本(或 sdk.js + bytecode.js)
│   ├── run.js           # 加载器 + 环境存根 + 测试
│   └── sign.js          # 签名接口(最后封装)
├── python/     # 验证脚本
└── docs/progress.md

判断场景(按需读取 reference):

场景 JS 文件 参考文档
单文件 SDK 复制到 env/main.js
SDK + 字节码分离 env/sdk.js + env/bytecode.js references/multi-file.md
webpack bundle 提取模块到 env/main.js references/webpack.md
运行时动态加载 curl 下载到 source/,复制到 env/ references/dynamic-loading.md

Read the full file on GitHub · 185 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 185 lines · 141 tokens per session scan A d98bf5f1f0f5

Subscribe to this mod's changes

env-patch is a skill published in the GitHub repository zhizhuodemao/ai-reverse-toolkit (434 stars, last pushed 5mo ago), licensed MIT. It adds 141 tokens to every session and 2,280 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

v8-jit

V8 JIT optimization patterns for writing high-performance JavaScript in Next.js server internals. Use when writing or reviewing hot-path code in app-render, stream-utils, routing, caching, or any per-request code path. Covers hidden classes / shapes, monomorphic call sites, inline caches, megamorphic deopt, closure…

vercel/next.js · 88 tokens

use-agent-browser-for-airi

Test AIRI display-model imports with agent-browser across stage-tamagotchi Electron, stage-web, and stage-pocket mobile web layouts. Use when uploading and verifying contributor-supplied Live2D ZIP, VRM, or MMD ZIP/PMX/PMD files through AIRI's model selector, including onboarding bypass, format-specific import…

moeru-ai/airi · 87 tokens

opencli-sitemap-author

Use when creating or maintaining OpenCLI site sitemaps: agent-facing navigation, page-state, action, workflow, API-reference, pitfall, and fallback knowledge for a website. Use after browser exploration discovers durable site context, when a sitemap is stale, or when promoting local site knowledge into the repo.

jackwener/OpenCLI · 67 tokens

debug-optimize-lcp

Guides debugging and optimizing Largest Contentful Paint (LCP) using Chrome DevTools MCP tools. Use this skill whenever the user asks about LCP performance, slow page loads, Core Web Vitals optimization, or wants to understand why their page's main content takes too long to appear. Also use when the user mentions…

ChromeDevTools/chrome-devtools-mcp · 99 tokens

webapp-testing

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

every-app/open-seo · 35 tokens

interactive-login

How to complete browser/interactive logins (aws / gh / glab / gcloud). The platform backgrounds the login poller so it survives the human's browser round-trip — and when that does NOT work.

yc-software/qm · 46 tokens