协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
page-langs【开发与工程】Detect all languages used on a webpage — both declared (html@lang, hreflang alternate links, nested lang= attributes, meta content-language) and actually present in the body text (Google CLD3 via cld3-asm WASM). Reconciles the two signal sets and flags mismatches such as undeclared languages in the body or declared languages absent from the content. …
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
npm install --prefix <skill-dir> to install cld3-asm (WASM, model bundled,
no native build). Run playwright-cli --help for the command reference.
description: >-
Detect all languages used on a webpage — both declared (html@lang, hreflang
alternate links, nested lang= attributes, meta content-language) and actually
present in the body text (Google CLD3 via cld3-asm WASM). Reconciles the two
signal sets and flags mismatches such as undeclared languages in the body or
declared languages absent from the content. Outputs langs.json with detected
languages (probability + proportion), all declared language signals, and a
reconciliation report. Use for i18n audits, EDS page migrations, hreflang
validation, and multilingual content verification.
Triggers on: detect languages, page languages, what language, language detection,
i18n audit, hreflang, hreflang validation, lang attribute, multilingual page,
page-langs, language audit, which language, content language, undeclared language.Detect all languages used on a webpage — declared and in the body text.
Node 22+ required. Uses playwright-cli for the browser pass and Google CLD3 (WASM)
for content-based detection.
Install cld3-asm into the skill directory before first use:
if [[ -n "${CLAUDE_SKILL_DIR:-}" ]]; then
SKILL_DIR="${CLAUDE_SKILL_DIR}"
else
SKILL_DIR="$(find ~/.claude -path "*/page-langs" -type d 2>/dev/null | head -1)"
fi
npm install --prefix "$SKILL_DIR"
The WASM model is bundled in the package — no network fetch at runtime.
if [[ -n "${CLAUDE_SKILL_DIR:-}" ]]; then
SKILL_DIR="${CLAUDE_SKILL_DIR}"
else
SKILL_DIR="$(find ~/.claude -path "*/page-langs" -type d 2>/dev/null | head -1)"
fi
COLLECT="$SKILL_DIR/scripts/collect.js"
DETECT="$SKILL_DIR/scripts/detect.mjs"
playwright-cli open "$URL"
If the page has cookie banners or overlays, use the page-prep skill to dismiss
them before continuing.
playwright-cli run-code --filename="$COLLECT" \
| node "$DETECT" --output ./page-langs-output
cat ./page-langs-output/langs.json
Check for common failure modes:
detected is empty → wordCount is very low (page didn't render JS content or is bot-blocked); try --headed or run page-prep firstplaywright-cli lost the session; re-run Step 2 before Step 3declared fields are all null → page has no language markup at all (valid finding, not an error)Output file: ./page-langs-output/langs.json
| Field | Description |
|---|---|
detected | CLD3 results: language, probability, is_reliable, proportion |
declared | Structural signals: htmlLang, nestedLangs, hreflang, metaContentLanguage |
reconciliation | agreement / declaredNotDetected / detectedNotDeclared |
wordCount | Words in visible body used for CLD3 |
| Field | Meaning |
|---|---|
detectedNotDeclared | Languages in the body not declared in markup — add hreflang or lang= |
declaredNotDetected | Declared in markup but absent from body — stale hreflang? |
agreement | Both declared and detected — healthy |
page-prep — invoke before Step 2 to dismiss overlays.wordCount is very low (~< 10 words).en, fr). Structural signals may
be BCP-47 (en-US, x-default). Reconciliation normalises on the primary
subtag; raw values are preserved in declared.references/output-schema.md for the vendoring fallback.