Research routing

From markus41/claude · View interactive version

Research routing is an AI agent skill from the GitHub repository markus41/claude. Optimal routing of research tasks across Perplexity MCP, Firecrawl MCP, and Context7 MCP.

How to use this skill

Skill file

Research Tool Routing

Optimal routing of research tasks across Perplexity MCP, Firecrawl MCP, and Context7 MCP.

Each tool has distinct strengths — use the right one for each job.

Tool Strengths at a Glance

| Tool | Best For | Cost | Speed |

|------|----------|------|-------|

| Context7 | Library/framework docs, API reference | Free | Fast (cached <5ms) |

| Perplexity Ask | Knowledge Q&A, current events, fact-checking | ~$0.02/query | Fast |

| Perplexity Research | Deep investigations, comprehensive reports | ~$0.10/query | Slow |

| Firecrawl Scrape | Extract content from specific URL | 1 credit | Fast |

| Firecrawl Map | Discover all URLs on a site | 1 credit | Fast |

| Firecrawl Extract | Structured JSON from pages | 5-20 credits | Medium |

| Firecrawl Agent | Autonomous multi-page research | 100-1500+ credits | Slow |

Decision Tree

What do you need to find out?

├─ LIBRARY DOCS?
│  "How does React useEffect work?"
│  "What's the Prisma findMany API?"
│  "Next.js App Router conventions?"
│  └─→ Context7 (resolve-library-id → query-docs)
│      Free, current, version-specific, no hallucination
│
├─ GENERAL KNOWLEDGE?
│  "What is the latest in AI?"
│  "Explain event sourcing"
│  "Compare Redis vs Memcached"
│  └─→ Perplexity Ask (perplexity_ask)
│      Fast, cheap, citations included
│
├─ CURRENT EVENTS?
│  "What happened at AWS re:Invent?"
│  "Latest security vulnerability in Log4j?"
│  └─→ Perplexity Search (perplexity_search)
│      Real-time web search with ranked results
│
├─ DEEP RESEARCH?
│  "Comprehensive comparison of 5 auth solutions"
│  "Full analysis of microservice vs monolith tradeoffs"
│  └─→ Perplexity Research (perplexity_research)
│      Deep-Research model, thorough, multiple sources
│
├─ EXTRACT FROM KNOWN URL?
│  "Get the pricing from https://example.com/pricing"
│  "Extract the API reference from this page"
│  └─→ Firecrawl Scrape (firecrawl_scrape)
│      1 credit, clean markdown or JSON output
│
├─ FIND PAGES ON A SITE?
│  "What docs pages exist on docs.example.com?"
│  "Find the webhook documentation page"
│  └─→ Firecrawl Map (firecrawl_map)
│      Discover URLs, then scrape the relevant ones
│
├─ STRUCTURED DATA EXTRACTION?
│  "Get all product prices as JSON from this catalog"
│  "Extract API endpoints with parameters"
│  └─→ Firecrawl Extract (firecrawl_extract)
│      Custom JSON schema extraction
│
└─ COMPLEX MULTI-SOURCE?
   "Research X across official docs, blogs, and forums"
   └─→ Chain: Context7 → Perplexity → Firecrawl
       1. Context7: Official library docs (free)
       2. Perplexity: Broader knowledge synthesis ($0.02)
       3. Firecrawl: Extract from specific URLs found (1 credit each)

Perplexity MCP Tools

perplexity_search

perplexity_ask

perplexity_research

perplexity_reason

Firecrawl MCP Tools

firecrawl_scrape

firecrawl_map

firecrawl_search

firecrawl_extract

firecrawl_crawl

firecrawl_agent

firecrawl_browser_*

Context7 MCP Tools

resolve-library-id

query-docs

Chaining Strategies

Strategy 1: Knowledge → Extraction

  1. Perplexity Ask: "What's the best library for X? Give me the official URL"
  2. Firecrawl Scrape: Extract clean content from the official page
  3. Benefit: Perplexity finds the best source; Firecrawl gets clean content

Strategy 2: Docs → Knowledge → Validation

  1. Context7: Get official library docs for the framework
  2. Perplexity Ask: "Common patterns for using X with Y"
  3. Context7: Verify patterns against official docs
  4. Benefit: Official docs + community knowledge, validated

Strategy 3: Map → Scrape → Synthesize

  1. Firecrawl Map: Discover all pages on a documentation site
  2. Firecrawl Scrape: Extract content from relevant pages
  3. Perplexity Ask: Synthesize findings into actionable answer
  4. Benefit: Comprehensive coverage + clean synthesis

Strategy 4: Avoid Agent Costs

  1. Perplexity Research: Get comprehensive answer with sources
  2. Only use Firecrawl Agent if structured JSON from 5+ sources is required
  3. Benefit: Cut 90% of autonomous browsing costs

Mandatory Context7 Usage

Quality audits and planners MUST use Context7.

For Quality Audits

Before auditing code:
  1. Identify libraries used in the code under review
  2. Context7: resolve-library-id for each library
  3. Context7: query-docs for current best practices
  4. Compare code against official patterns
  5. Flag deviations as audit findings with doc links

For Planning Agents

Before designing architecture:
  1. List all proposed libraries/frameworks
  2. Context7: verify API compatibility for each
  3. Context7: check for breaking changes between versions
  4. Context7: find recommended integration patterns
  5. Include doc-backed justifications in plan

For Code Review

During review:
  1. Identify library API calls in changed code
  2. Context7: verify correct API usage
  3. Context7: check for deprecated methods
  4. Flag incorrect usage with links to official docs

Cost Budget Guidelines

For a typical research task:

| Approach | Cost | When to Use |

|----------|------|-------------|

| Context7 only | Free | Library docs, API reference |

| Perplexity only | ~$0.02 | Knowledge Q&A, current events |

| Context7 + Perplexity | ~$0.02 | Library + broader context |

| Perplexity + Firecrawl Scrape | ~$0.03 | Knowledge + extraction |

| Full chain (all 3) | ~$0.05 | Comprehensive research |

| Firecrawl Agent | $0.08-$1.20 | AVOID — use chain instead |

Rule: Start cheap (Context7 → Perplexity → Firecrawl Scrape). Only escalate if cheaper tools don't have the answer.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.