Implements 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.
76
96%
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
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.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.