/web-ai-skills:webmcpfrom web-ai-skills
Implements and debugs browser WebMCP integrations in JS/TS web apps, covering imperative tools via document.modelContext, declarative HTML form annotations, and agent-invoked form flows.
Ships in web-ai-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Step 1: Identify the browser integration surface
node scripts/find-webmcp-targets.mjs . to inventory likely frontend files and existing WebMCP markers when a Node runtime is available.package.json, HTML entry point, and framework bootstrap files manually to identify the browser app boundary.Step 2: Choose the WebMCP shape
references/webmcp-reference.md before writing code.references/declarative-api.md when the feature can be expressed as an HTML form flow or needs agent-invoked submit handling.references/compatibility.md when native availability, Chrome preview setup, or draft-versus-preview behavior matters.references/troubleshooting.md when registration, schema serialization, or agent-driven form execution fails.Step 3: Implement tool registration
assets/model-context-registry.template.ts and adapt it to the framework, state model, and file layout in the workspace when using the imperative API.const modelContext = document.modelContext || navigator.modelContext; and guard subsequent registration on its presence. Prefer document.modelContext (the current surface) and keep navigator.modelContext only as a fallback for older Chrome 146–149 builds.modelContext.registerTool() inside a try/catch, using a stable name (1–128 ASCII alphanumeric/_/-/. characters), a positive description, an object inputSchema, and an execute callback. On Chrome 151+ the call returns a Promise<void> that resolves when the tool is available across the frame tree; await keeps the same code working on older builds that registered synchronously.annotations.readOnlyHint to true only for tools that do not modify state.154.0.8017.0+, set annotations.consequentialHint to true for tools that perform high-stakes, irreversible, or real-world actions such as booking travel, transferring funds, making purchases, or deleting data. This signals the agent to obtain explicit user confirmation before execution.156.0.8067.0+, set annotations.debugging to true only for tools intended specifically for inspection, diagnostics, testing frameworks, or developer tooling such as Chrome DevTools AI assistance. This lets general-purpose and end-user agents identify and filter out developer-focused tools.annotations.untrustedContentHint to true when the tool's output may contain data from untrusted sources.{ signal } as the second execute argument and pass it to cancellable work such as fetch(). Treat this execution signal separately from the registration signal.AbortController whose signal was passed to registerTool(); during the Chrome 148 transition window, also call modelContext.unregisterTool?.() with optional chaining before aborting.<form> with toolname and tooldescription, and let form controls define the parameter surface.toolparamdescription to produce clear parameter descriptions for declarative fields.toolautosubmit only when the page should submit automatically after the agent populates the form.Step 4: Wire agent-driven UX safely
execute(input, { signal }) contract does not provide a client callback.preventDefault() before respondWith() and return structured validation errors for agent-invoked submits.toolactivated, toolcancel, agentInvoked, and WebMCP form pseudo-classes only behind compatibility-aware UI logic. For toolactivated and toolcancel, read references/declarative-api.md and feature-detect their on* properties on document.modelContext before falling back to window for older builds.annotations.consequentialHint is true; the annotation informs the agent but does not enforce application security.Step 5: Validate behavior
respondWith() handling.references/compatibility.md before treating runtime failures as application bugs.executeTool() and verify that long-running work stops without relying on tool unregistration.annotations.consequentialHint: true and still enforces the application's confirmation and authorization flow.annotations.debugging: true, and that user-facing tools leave it unset or false.document.modelContext and navigator.modelContext are missing, confirm the code is running in a secure browser window context and then check the preview requirements in references/compatibility.md.navigator.modelContext is present, the page is running on an older Chrome 146–149 preview build; keep the document.modelContext || navigator.modelContext fallback in place but plan to drop navigator.modelContext once the deprecation window closes.registerTool() inside a try/catch. On Chrome 151.0.7922.0+ it returns a Promise<void> that rejects on failure; older builds returned synchronously and threw. The same await + try/catch catches both, so the error checks below apply whether the failure surfaces as a synchronous throw or a Promise rejection.registerTool() throws InvalidStateError, check for duplicate names, empty name or description values, or tool names that exceed 128 characters or contain disallowed characters (only ASCII alphanumeric, _, -, . are allowed).registerTool() throws NotAllowedError, check whether the tools Permissions Policy feature is denied; cross-origin iframes need allow="tools" from the embedding document.registerTool() throws TypeError or JSON serialization errors, replace non-serializable or circular inputSchema values with plain JSON-compatible objects.provideContext, clearContext, or toolparamtitle, treat those surfaces as obsolete for current implementations.references/declarative-api.md and references/troubleshooting.md before changing the tool contract.assets/model-context-registry.template.ts (opens in a new tab)references/compatibility.md (opens in a new tab)references/declarative-api.md (opens in a new tab)references/troubleshooting.md (opens in a new tab)references/webmcp-reference.md (opens in a new tab)scripts/find-webmcp-targets.mjs (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
web-ai-skills@webmaxru-ai-native-dev is listed by webmaxru/ai-native-dev — review the source before installing
npx claudepluginhub webmaxru/ai-native-dev --plugin web-ai-skills7 skills in this plugin
/language-detector-apiImplements and debugs browser Language Detector API integrations in JavaScript or TypeScript web apps. Use when adding LanguageDetector support checks, availability and model download flows, session creation, detect() calls, input-usage measurement, permissions-policy handling, or compatibility fallbacks for built-in language detection. Don't use for server-side language detection SDKs, cloud translation services, or generic NLP pipelines./prompt-apiImplements and debugs browser Prompt API integrations in JavaScript or TypeScript web apps. Use when adding LanguageModel availability checks, session creation, prompt or promptStreaming flows, structured output, download progress UX, or iframe permission-policy handling. Don't use for server-side LLM SDKs, REST AI APIs, or non-browser providers./proofreader-apiImplements and debugs browser Proofreader API integrations in JavaScript or TypeScript web apps. Use when adding Proofreader availability checks, monitored model downloads, proofread flows, correction metadata handling, or permissions-policy checks for built-in proofreading. Don't use for generic prompt engineering, server-side LLM SDKs, or cloud AI services./translator-apiImplements and debugs browser Translator API integrations in JavaScript or TypeScript web apps. Use when adding Translator support checks, language-pair availability flows, model download UX, session creation, translate() or translateStreaming() calls, input-usage measurement, or permissions-policy handling for on-device translation. Don't use for server-side translation SDKs, cloud translation services, or generic multilingual content pipelines./webnnImplements and debugs browser Web Neural Network API integrations in JavaScript or TypeScript web apps. Use when adding navigator.ml checks, MLContext creation, MLGraphBuilder flows, device selection, tensor dispatch and readback, or explicit fallback paths to ONNX Runtime Web or other local runtimes. Don't use for model training, server-side ML inference, or cloud AI APIs./writing-assistance-apisImplements and debugs browser Summarizer, Writer, and Rewriter integrations in JavaScript or TypeScript web apps. Use when adding availability checks, model download UX, session creation, summarize or write or rewrite flows, streaming output, abort handling, or permissions-policy constraints for built-in writing assistance APIs. Don't use for generic prompt engineering, server-side LLM SDKs, or cloud AI services.Other plugins' skills for the same job