Skip to content
ML2
Research & AutomationWorkflowcontextFirecrawlMarkItDown

Turn a docs site into agent context

Added Updated Copyable prompt below

Published Last verified

Our verdict

Agents invent APIs they don't know, and current docs saved as local Markdown are a cheap fix. Check whether the site already publishes llms.txt or .md pages before crawling, crawl only the section you need, and refresh when the library version changes. For popular libraries, an MCP docs server like Context7 can save you the upkeep.

Who it's for
Builders integrating new or fast-moving APIs
Leverage
Fewer hallucinated API calls
Effort
Low
Date added

What Docs-as-context does

Pull the docs for the library you're integrating into Markdown files inside your repo (for example docs/vendor/<library>/), then tell your agent to read them before writing code. You can crawl the section with Firecrawl or Crawl4AI, download a site's own llms.txt or Markdown pages where it publishes them, or convert PDFs and Office files with MarkItDown. The agent instruction file (AGENTS.md or CLAUDE.md) points at the folder, and the agent lists which files it used.

How builders use Docs-as-context

  • Look for /llms.txt or a .md version of the pages first; some docs sites publish them, so you may not need a crawler.
  • Crawl one section with a path filter and a page cap, such as Firecrawl's includePaths with limit: 100 or Crawl4AI's crwl --deep-crawl bfs --max-pages 10.
  • Convert vendor PDFs with markitdown file.pdf -o file.md and keep them next to the crawled pages.
  • Reference the folder in AGENTS.md or CLAUDE.md and ask the agent to name the doc files it relied on.
  • Note the library version in the folder name and re-crawl when you upgrade.

Four ways to get the docs

Checked on each project's official docs or GitHub, 16 Nov 2026.

RouteGood forWatch for
The site's own llms.txt or .md pagesDocs that already publish Markdown for LLMsNot every site has them; coverage varies
Firecrawl crawlLarge or JavaScript-heavy docs sites, via API1 credit per page; default limit is 10,000 pages, so set a lower one
Crawl4AIFree, self-hosted crawling with Python or the crwl CLIYou run and maintain it yourself
MarkItDownPDF, Word and PowerPoint docs you already haveOutput is meant for tools, not always pretty to read

Crawl settings that keep it small

  • Firecrawl's includePaths and excludePaths are regex patterns matched against the URL path, and the start URL must match includePaths or you can get 0 pages.
  • maxDiscoveryDepth caps how many link hops are followed; limit caps the total pages.
  • Firecrawl checks your credits against limit before starting and returns a 402 error if they won't cover it.
  • For Crawl4AI, crwl <url> -o markdown grabs one page and --deep-crawl bfs --max-pages N follows links breadth first.

Docs-as-context: limits and gotchas

  • Saved docs go stale. If you don't refresh them after an upgrade, the agent will confidently follow the old API.
  • Large folders eat context; the agent may skim or skip files, so crawl only the section the task needs.
  • Crawled pages can include navigation, cookie banners and repeated sidebars; check a few files before committing them.
  • Respect the site's terms and robots rules, and don't commit docs you aren't allowed to redistribute in a public repo.
  • This doesn't help with private or undocumented APIs; for those, write the reference yourself.

Docs-as-context compared with other tools here

  • Context7: fetches up-to-date, version-specific docs for popular libraries on demand through MCP or a CLI, with nothing stored in your repo.
  • Firecrawl: the hosted crawler for this job, with path filters and Markdown output.
  • Crawl4AI: the open-source, self-hosted crawler if you'd rather not pay per page.
  • MarkItDown: converts PDFs and Office files into Markdown when the docs aren't a website.
  • Jina Reader: turns a single URL into clean Markdown, handy for one or two pages.

When to pick Docs-as-context

  • Use this workflow if the library is new, niche or changes fast, and your agent keeps guessing its API.
  • Pick Context7 if the library is popular and you'd rather fetch docs on demand than keep a folder up to date.
  • Pick Jina Reader if you only need one or two pages.
  • Pick MarkItDown if the vendor ships PDFs or slides instead of a docs site.

Copy this: Agent instruction

Before writing any code that calls <library>, read the relevant files in docs/vendor/<library>/.
Only use functions and parameters that appear there.
In your summary, list which doc files you used.

Docs-as-context questions

What is llms.txt?

A proposed Markdown file at a site's root (or under a path such as /docs) that gives LLMs a short overview and links to Markdown versions of the pages. If a docs site has one, start there.

How many pages should I crawl?

Only the section your task needs, often a few dozen pages. Set a page cap so a crawl can't run into thousands of pages or credits.

Where should the files live?

In a folder inside the repo, such as docs/vendor/<library>/, referenced from AGENTS.md or CLAUDE.md so every session can find it.

Is this better than an MCP docs server?

It's more work but works for any site, including niche or internal docs, and pins the exact version you use. An MCP server like Context7 is easier for popular libraries.

Related discoveries

See the newest picks →
  • ToolSmall Tools, Repos & Plugins

    Graphify: turn a codebase into a queryable knowledge graph

    Apache-2.0 CLI and assistant skill that maps code, docs, PDFs, images and video into a knowledge graph your coding agent can query instead of grepping files.

    NewEffort: MediumPrompt#Plugin / extension#MCP

  • ToolResearch & Automation

    Firecrawl

    An API that turns web pages and whole sites into clean Markdown or JSON for agents, with search, crawl and an MCP server.

    Effort: Low#Open source#Self-hostable

Get the best new A.I. picks in your inbox

The best new agent workflows and tools we’ve vetted, with a clear verdict on each. Short, occasional, useful.

More in Research & Automation →

Free. No spam. Unsubscribe anytime.