一键导入
fix-scraper
Diagnose and fix a broken scraper mapping. Use when extraction tests fail, a scraper returns wrong data, or a website has changed its HTML structure.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Diagnose and fix a broken scraper mapping. Use when extraction tests fail, a scraper returns wrong data, or a website has changed its HTML structure.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Add support for scraping property listings from a new website. Use when the user wants to add a new scraper, create a new mapping, or support a new property listing site.
Deep-dive diagnostics on a low-quality or failed extraction. Analyzes field traces, content provenance, fallback usage, and suggests mapping improvements.
Run a quick extraction test against a URL or HTML file. Shows extracted fields, quality grade, and diagnostics.
Quick overview of all scrapers — quality grades, extraction rates, and coverage gaps.
| name | fix-scraper |
| description | Diagnose and fix a broken scraper mapping. Use when extraction tests fail, a scraper returns wrong data, or a website has changed its HTML structure. |
| argument-hint | ["scraper-name"] |
You are helping the user diagnose and fix a broken scraper mapping. This follows the workflow in astro-app/docs/scraper-maintenance-guide.md.
$ARGUMENTS should be a scraper name (e.g. rightmove, idealista). If not provided, ask the user which scraper is broken, or run the full test suite to find failures.
Run the scraper's validation tests to see which fields are failing:
cd astro-app && npx vitest run test/lib/scraper-validation.test.ts -t "<scraper_name>"
If no scraper name was given, run the full validation suite and identify which scrapers have failures:
cd astro-app && npx vitest run test/lib/scraper-validation.test.ts
Read the test output and identify the specific fields that are failing. Note the expected vs actual values.
Read the scraper mapping at config/scraper_mappings/<name>.json. For each failing field, identify the extraction strategy (cssLocator, scriptRegEx, urlPathPart, scriptJsonPath, jsonLdPath).
Read the HTML fixture at astro-app/test/fixtures/<name>.html. Search for the DOM elements the mapping targets.
Check the manifest at astro-app/test/fixtures/manifest.ts to understand expected values.
Identify the root cause using this checklist:
| Symptom | Likely cause |
|---|---|
Field returns 0 or empty string | CSS selector doesn't match any element |
| Field returns concatenated garbage | Selector matches multiple elements, missing cssCountId |
| Field is wrong type (string vs int) | Field defined in two sections, last one wins |
splitTextCharacter produces wrong result | Cheerio normalizes <br> to \n, not \r |
scriptRegEx returns empty | Pattern doesn't match any script tag content |
stripString doesn't strip enough | Only removes one exact substring occurrence |
| JSON-LD / scriptJsonPath returns empty | Structure changed or variable name changed |
Edit the mapping JSON at config/scraper_mappings/<name>.json. Only change the specific fields that are broken. Common fixes:
cssCountId when selector matches multiple elementssplitTextCharacter (use \n not \r)scriptRegEx patternfallbacks arrayUpdate expected values in astro-app/test/fixtures/manifest.ts if the site content has legitimately changed.
If the fixture HTML is outdated, offer to recapture it:
cd astro-app
npm run capture-fixture -- --file <new_html_file> --url <source_url> --name <scraper_name> --force
Run the specific scraper's tests:
cd astro-app && npx vitest run test/lib/scraper-validation.test.ts -t "<scraper_name>"
Run the full test suite to check for regressions:
cd astro-app && npx vitest run
Present a summary of changes made and offer to commit.
DESIGN.md (Scraper Mapping Schema section)astro-app/docs/scraper-maintenance-guide.mdfallbacks array on any field mapping