Help us improve
Share bugs, ideas, or general feedback.
From web-ai-skills
Implements browser Language Detector API integrations in JS/TS web apps: support checks, model download flows, session creation, detect() calls, input-usage measurement, permissions-policy handling, and compatibility fallbacks.
npx claudepluginhub webmaxru/ai-native-dev --plugin web-ai-skillsHow this skill is triggered — by the user, by Claude, or both
Slash command
/web-ai-skills:language-detector-apiThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Step 1: Identify the browser integration surface**
Implements and debugs browser Translator API integrations in JS/TS web apps: support checks, language-pair availability, model download UX, session creation, translate()/translateStreaming() calls, input-usage measurement, and permissions-policy handling.
Extracts writing system specifications, classifies UI copy, and assesses i18n maturity using NNg tone dimensions. Useful for auditing content systems.
Master modern JavaScript with ES6+, async patterns, and Node.js APIs. Handles promises, event loops, and browser/Node compatibility.
Share bugs, ideas, or general feedback.
Step 1: Identify the browser integration surface
node scripts/find-language-detector-targets.mjs . to inventory likely frontend files and existing Language Detector API 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: Confirm API viability and choose the integration shape
references/language-detector-reference.md before writing code.references/examples.md when the feature needs a session wrapper, download-progress UI, confidence thresholding, or cleanup shape.references/compatibility.md when preview flags, browser channels, iframe rules, or environment constraints matter.references/troubleshooting.md when support checks, creation, detection, or cleanup fail.Window context.language-detector permissions-policy feature.LanguageDetector.create() for general language detectionexpectedInputLanguages when the product depends on a narrower language set or better accuracy for known languagesmonitor when the UI must surface model download progressStep 3: Implement a guarded session wrapper
assets/language-detector-session.template.ts and adapt it to the framework, state model, and file layout in the workspace.globalThis.isSecureContext, LanguageDetector, and the same expectedInputLanguages shape the feature will use at runtime.LanguageDetector.availability() using the same create options that will be passed to LanguageDetector.create().availability() as a capability check, not a guarantee that creation will succeed without download time, policy approval, or user activation.monitor option during create() when the product needs download progress.AbortController for cancelable create(), detect(), or measureInputUsage() calls, and call destroy() when the session is no longer needed.expectedInputLanguages after creation; session options are fixed per instance.allow="language-detector".Step 4: Wire UX and fallback behavior
und handling in product logic instead of truncating silently.und result as meaningful uncertainty, not as a defect to remove.measureInputUsage() when quota or input-size budgeting affects the flow.Step 5: Validate behavior
node scripts/find-language-detector-targets.mjs . to confirm that the intended app boundary and Language Detector API markers still resolve to the edited integration surface.LanguageDetector feature detection, and availability() behavior before debugging deeper runtime failures.create() plus detect() flow with representative user text.expectedInputLanguages, test both the constrained and unconstrained path or confirm why only one is valid.references/compatibility.md before treating failures as application bugs.LanguageDetector is missing, keep a non-AI fallback and confirm secure-context, browser, channel, and flag requirements before changing product logic.availability() returns downloadable or downloading, require user-driven session creation before promising that detection is ready.create() throws NotAllowedError, check permissions-policy constraints, missing user activation for downloads, browser policy restrictions, or user rejection.detect() throws InvalidStateError, confirm the document is still fully active and recreate the session after major lifecycle changes if needed.QuotaExceededError, reduce the input size or measure usage before retrying.