prompt-api

Wrap browser Prompt API availability, session creation, and prompt flows for web apps.

46|4|Updated Mar 14, 2026
One-click install
npx skills add https://github.com/webmaxru/agent-skills --skill prompt-api-webmaxru
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prompt-api
Source: https://github.com/webmaxru/agent-skills/tree/main/skills/prompt-api
Command: npx skills add https://github.com/webmaxru/agent-skills --skill prompt-api-webmaxru

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve?

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.

Core Features & Use Cases

  • Availability checks with LanguageModel.availability() to determine support for given modalities and languages.
  • Session creation via LanguageModel.create(), including initialPrompts and optional tools, with progress monitoring support.
  • Prompt and promptStreaming flows, including structured output via responseConstraint and safe fallbacks for unsupported environments.
  • Iframe and permissions-policy handling for cross-origin contexts, plus non-AI fallbacks when native APIs are unavailable.

Quick Start

Install or ensure the native Prompt API is available, then create a session and run a simple text prompt to validate integration.

Frequently Asked Questions about prompt-api

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I check LanguageModel availability before creating a session in a web app?

Use LanguageModel.availability() to check browser support for specific modalities and languages before session creation. This availability check enables progressive enhancement and safe fallbacks when native Prompt API features are unsupported.

What is the best way to handle structured output with responseConstraint in the Prompt API?

Structured output with the Prompt API is handled by applying the responseConstraint parameter during prompt or promptStreaming flows. This allows you to enforce specific response formats while maintaining safe fallbacks for unsupported browser environments.

Can I use the browser Prompt API inside cross-origin iframes?

Yes, browser Prompt API integration works in cross-origin iframes by configuring proper allow attributes and permissions-policy handling. This setup ensures LanguageModel sessions function correctly within restricted embedding contexts.

How do I monitor download progress when creating a LanguageModel session?

Track download progress during LanguageModel.create() by implementing progress monitoring support within your session creation flow. This provides user feedback during initial model download and initialPrompts setup.

Does the Prompt API support streaming responses for JavaScript and TypeScript apps?

Yes, the Prompt API supports streaming responses in JavaScript and TypeScript web apps via the promptStreaming flow. This enables real-time text generation alongside availability checks and structured output constraints.

When should I not use the browser Prompt API for AI integrations?

Avoid the browser Prompt API for server-side LLM SDKs, REST AI APIs, or non-browser providers. It is designed exclusively for front-end projects requiring native LanguageModel integration with progressive enhancement and safe fallbacks.