Agent Skillsfirecrawl/web-agent › structured-extraction

structured-extraction

GitHub

从网站提取符合特定 JSON Schema 的结构化数据,支持复杂嵌套、分页及验证。通过搜索、定向抓取和并行处理获取数据,严格校验类型与完整性后调用 formatOutput 输出标准格式结果。

agent-core/src/skills/definitions/structured-extraction/SKILL.md firecrawl/web-agent

Trigger Scenarios

需要从网页提取结构化信息 要求输出严格匹配 JSON Schema 涉及多页或列表数据的批量采集

Install

npx skills add firecrawl/web-agent --skill structured-extraction -g -y
More Options

Non-standard path

npx skills add https://github.com/firecrawl/web-agent/tree/main/agent-core/src/skills/definitions/structured-extraction -g -y

Use without installing

npx skills use firecrawl/web-agent@structured-extraction

指定 Agent (Claude Code)

npx skills add firecrawl/web-agent --skill structured-extraction -a claude-code -g -y

安装 repo 全部 skill

npx skills add firecrawl/web-agent --all -g -y

预览 repo 内 skill

npx skills add firecrawl/web-agent --list

SKILL.md

Frontmatter
{
    "name": "structured-extraction",
    "category": "Research",
    "description": "Extract structured data matching a JSON schema from websites. Handles complex nested schemas, arrays, pagination, and validation. Always outputs via formatOutput."
}

Structured Extraction

Use this skill when extracting data that must match a specific JSON schema.

Strategy by task type

Simple query (single fact or small object)

  1. Search for relevant results.
  2. Scrape promising results with a targeted query.
  3. Build the result object and call formatOutput immediately.

Single target research (one entity, multiple fields)

  1. Search for relevant URLs.
  2. Scrape to extract data — stay in the orchestrator unless you have many independent sources (roughly 5+) where parallel workers clearly help.
  3. Compile findings and call formatOutput.

List of items (array in schema)

  1. Search/scrape to get the list of items.
  2. Are all requested details included in the list?
    • Yes: Build the result and call formatOutput.
    • No: If there are many items (roughly 5+), use spawnAgents so each worker gets the item and fields; otherwise fetch details sequentially in the orchestrator.
  3. Aggregate all results and call formatOutput.

All items from a website

  1. Check sitemaps (sitemap.xml, robots.txt) for an easy route to all pages.
  2. Scrape the entry page. Determine: pagination? Categories? Subcategories?
  3. For pagination, use interact to click through every page.
  4. For categories, scrape each category — use spawnAgents only when many independent categories warrant parallel fan-out.
  5. Aggregate and call formatOutput.

Scraping for structured data

  • PREFER scrape with a targeted query over raw page dumps. It keeps context lean.
  • When scraping lists, ALWAYS ask about pagination in your query: "How many total results? Is there a next page?"
  • For many independent URLs (roughly 5+), spawnAgents can help — each worker gets specific URLs and fields. Fewer URLs: handle in the orchestrator.
  • If a scrape returns a 404 or bot-check, do NOT retry. Move on to alternative sources.

Building the output

  • Match the schema EXACTLY. Every required field must be present.
  • Use null for missing fields — never omit keys.
  • Arrays must be arrays even for single items.
  • Numbers must be actual numbers, not strings (10.99 not "$10.99").
  • Use bashExec with jq to merge data from multiple sources:
    jq -s '.[0] * .[1]' /data/part1.json /data/part2.json > /data/merged.json
    

Validation before output

Before calling formatOutput, verify:

  1. All required fields from the schema are present.
  2. Types match (numbers are numbers, arrays are arrays).
  3. No duplicate entries in arrays.
  4. Source URLs are included where the schema has citation fields.

CRITICAL: Always call formatOutput

When you have gathered ALL data, call formatOutput with format "json" and the structured data. Do NOT stream data inline as markdown tables or JSON code blocks. Do NOT skip formatOutput — downstream systems depend on the structured output.

Version History

  • f023adf Current 2026-07-24 21:56

Same Skill Collection

agent-core/src/skills/definitions/competitor-analysis/SKILL.md
agent-core/src/skills/definitions/deep-research/SKILL.md
agent-core/src/skills/definitions/e-commerce/SKILL.md
agent-core/src/skills/definitions/financial-research/SKILL.md
agent-core/src/skills/definitions/pricing-tracker/SKILL.md

Metadata

Files
0
Version
f023adf
Hash
faf83e9f
Indexed
2026-07-24 21:56

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-21 20:33
浙ICP备14020137号-1 $mapa de visitantes$