Skip to main content
prompt GP ChatGPT

web_evaluate_js — Claude Code prompt: what it does, how to install

web_evaluate_js — a prompt for Claude Code runs JavaScript code on the current web page and returns the collected data as JSON.

Apache-2.0 ★ 9,488 updated 2026-11-16

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/commands/web_evaluate_js.md
Open on GitHub

What web_evaluate_js does

The script executes inside the live page context to read DOM elements using queries like querySelectorAll and textContent. Network access, form submissions, DOM mutations, cookies, and local storage access remain blocked during execution. Fields resembling credentials, tokens, and payment cards are automatically masked.

The execution time is bounded, and the output string length has a strict character limit. A dedicated state object preserves data across calls on the same page and resets when the page changes. Since network requests fail, data loaded via page APIs requires the web_capture tool instead.

Installation in Claude Code is done by placing the file at .claude/commands/web_evaluate_js.md in the project directory.

What it helps with

  • execute JavaScript inside the current web page DOM
  • mask sensitive credentials and tokens automatically
  • persist state variables across script calls on the same page
  • limit execution time and result string length

Example prompts for the agent

  • Run web_evaluate_js to extract text contents from the current DOM
  • Execute web_evaluate_js to read page data as JSON

How to install web_evaluate_js

Manually: put the files in place

.claude/commands/web_evaluate_js.md

Questions about web_evaluate_js

How to install web_evaluate_js in Claude Code?

Place the prompt file at .claude/commands/web_evaluate_js.md in your project repository.

What does web_evaluate_js do?

It executes JavaScript against the live page DOM, returning masked data as JSON while blocking network requests.

What limitations apply to the script?

The script cannot use the network, modify elements, access cookies, or read password and card input fields.

Source text

web_evaluate_js.md · Apache-2.0
Read data from the current web page with JavaScript, and get the result back as JSON (default time limit {{default_seconds}} s, result at most {{result_max}} characters; values that look like credentials or tokens are masked). The script runs inside the real page and sees the live DOM, but it can only read: document, window, location and getComputedStyle are read-only views of the page (querySelectorAll, getAttribute, textContent, getBoundingClientRect and the like work; setting a property, adding or removing elements, click(), focus(), submit(), opening windows or navigating fail with read_only). Password, hidden, one-time-code and card fields read as ***, and cookies and local storage cannot be read. It cannot use the network: fetch, XMLHttpRequest, sendBeacon, WebSocket and loading images or scripts fail with blocked_network; it only reads what the page already has (to read data the page loaded from its APIs, use web_capture). Also available: sleep(ms), URL, URLSearchParams, plain JavaScript (JSON, Math, Array…), and state, an object that keeps what you put in it across calls on the same page (state="new" in the result means it was just created, e.g. after the page changed). script is one expression or the body of an async function that uses return; return plain data (strings, numbers, arrays, objects), not elements. To act on the page use the action tools.

© wangzan101 · Apache-2.0 · wangzan101/Mika

Similar prompts

All prompts for Browser and scraping →

From the same set132

The whole set →
device_files device_files — a prompt for Claude Code and ChatGPT coordinates how the model locates and copies local files through a device bridge. Runs when an agent needs to retrieve a file from the user machine. GP ChatGPT ★ 9,488repo stars root This Claude Code prompt sets rules for running Android shell commands as root. It applies to tasks involving system files or another app’s private data. GP ChatGPT ★ 9,488repo stars tap This prompt for Claude Code and ChatGPT taps interface elements by reference, name, or coordinates. GP ChatGPT ★ 9,488repo stars web_interact The web_interact prompt for Claude Code and ChatGPT adds mouse and keyboard actions beyond web_tap and web_type_text. Use it to open hover menus, drag items, choose native dropdown options, or handle page dialogs. GP ChatGPT ★ 9,488repo stars outcome_judge The outcome_judge Claude Code prompt checks whether an assistant’s final reply fulfils the user’s request. It labels the result done, partial, or not_possible. GP ChatGPT ★ 9,488repo stars describe Prompt for Claude Code and ChatGPT that describes phone screenshots for an assistant without visual input. Converts mobile UI layouts into structured text with normalised tap coordinates. GP ChatGPT ★ 9,488repo stars do_steps The do_steps Claude Code prompt batches known actions on one screen into a single call. It stops when a step fails or the next result needs visual inspection. GP ChatGPT ★ 9,488repo stars notice_triage notice_triage — a prompt for Claude Code and ChatGPT categorizes phone notifications from a single app. It isolates incoming alert text to prevent prompt injection inside assistant workflows. GP ChatGPT ★ 9,488repo stars

Project sponsors

Companies that keep this analytics open