Implements 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.
64
77%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
—
The risk profile of this skill
Fix and improve this skill with Tessl
tessl review fix ./skills/prompt-api/SKILL.mdStep 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(), tools, or responseConstraint.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 and tools.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 marks them EXPERIMENTAL and extension-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, message roles, and tools used by the feature.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.f4c5a23
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.