/web-ai-skills:prompt-apifrom web-ai-skills
Implements and debugs browser Prompt API integrations in JavaScript/TypeScript web apps, covering availability checks, session creation, prompt streaming, structured output, and iframe permission-policy handling.
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 integration surface
node scripts/find-frontend-targets.mjs . to inventory likely frontend files and existing Prompt API usage when a Node runtime is available.package.json, HTML entry point, and framework entry files manually to identify the browser app boundary.Step 2: Confirm Prompt API viability
references/prompt-api-reference.md before writing code.references/examples.md when the feature needs a spec-valid message shape for text, multimodal, prefix, or tool-enabled sessions.references/compatibility.md when the feature must support multiple browser generations or decide between native support and polyfills.references/polyfills.md when the feature needs concrete package installation or backend configuration examples for Prompt API or Task API polyfills.language-model permissions-policy allows access from the current frame.prompt(), promptStreaming(), initialPrompts, append(), measureContextUsage(), or responseConstraint. If the feature needs tool-calling, note that tools is EXPERIMENTAL (experimental contexts only) in the spec and must be gated with feature detection or limited to origin-trial or extension contexts.Step 3: Implement a guarded session wrapper
assets/language-model-service.template.ts and adapt it to the framework, state model, and file layout in the workspace.LanguageModel.availability() using the same creation options that the feature will use at runtime, including expected modalities. Do not pass tools to availability() in portable page code since tools is EXPERIMENTAL.AbortController for cancelable prompts and call destroy() when the session is no longer needed.allow="language-model" on the embedding iframe.params(), topK, or temperature; the spec now marks topK and temperature as DEPRECATED (extension contexts only), so portable web page integrations must not require them.availability() as a passive capability check: if it reports downloading before user activation, do not assume the current page initiated that download or lock the UI into an app-started busy state.Step 4: Wire UX and fallback behavior
monitor listener during LanguageModel.create() and render progress in the UI.responseConstraint, use omitResponseConstraintInput only when the prompt already carries the required format instructions, and parse the returned string before using it.system messages belong in initialPrompts, prefix: true applies only to the final assistant message, and assistant message content must remain text-only.availability() reports downloading before the app has called create(), present that as informational browser state rather than a page-owned active download, and keep controls usable unless the app itself is busy.Step 5: Validate behavior
prompt() and long responses with promptStreaming() when applicable.references/troubleshooting.md if the integration throws NotSupportedError or behaves differently across frames or execution contexts.LanguageModel is missing, prefer progressive enhancement with a maintained Prompt API polyfill or a non-AI fallback instead of inventing a custom compatibility layer.availability() returns downloading before the app has called create(), treat it as passive browser state. Only surface live progress and block prompt submission when the app itself has started LanguageModel.create().availability() or prompt() throws NotSupportedError, align the creation and prompt options with the actual modalities, languages, and message roles used by the feature. If tools was passed to availability() or create(), note that tools is EXPERIMENTAL and may not be supported in the current browser context.allow="language-model" from the embedding page before continuing.node scripts/find-frontend-targets.mjs . cannot run, identify the browser app boundary manually and continue only after a single target app is clear.assets/language-model-service.template.ts (opens in a new tab)references/compatibility.md (opens in a new tab)references/examples.md (opens in a new tab)references/polyfills.md (opens in a new tab)references/prompt-api-reference.md (opens in a new tab)references/troubleshooting.md (opens in a new tab)scripts/find-frontend-targets.mjs (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
browser-ai, prompt-api, language-model, llm-integration, client-side-ai
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./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./Other plugins' skills for the same job