An open source agent skill that fetches web content as clean markdown using Cloudflare's Markdown for Agents standard. Wraps content negotiation, Workers AI, and Browser Rendering into a single tool with automatic cascading fallback. Saves ~80-99% of tokens compared to raw HTML.
Works with Claude Code, OpenClaw, Cursor, and any tool that supports the Agent Skills standard.
Markdown has become the lingua franca for AI agents. Its explicit structure is ideal for LLM processing -- better results, fewer tokens. A typical web page can shrink from hundreds of thousands of HTML tokens to a few thousand markdown tokens, an 80-99% reduction.
Cloudflare built Markdown for Agents directly into their CDN. When an agent sends Accept: text/markdown to any Cloudflare-enabled site with the feature turned on, the network converts HTML to markdown on the fly at the edge. The response includes an x-markdown-tokens header with the estimated token count and a Content-Signal header with machine-readable usage permissions. No API key needed for this path.
For sites where content negotiation is not available, Cloudflare provides two additional APIs. Workers AI toMarkdown handles arbitrary document conversion -- not just HTML, but PDFs, Word documents, Excel spreadsheets, images, CSV, XML, and more. Browser Rendering opens a real Chromium browser to render JavaScript-heavy pages before converting the result to markdown.
This skill wraps all three methods into a single tool with automatic cascading fallback. Requires Python 3.6+ (standard library only, no pip packages).
Three Cloudflare methods in a cascading chain, stopping at the first success:
Request --> [1] Content Negotiation --> [2] Workers AI --> [3] Browser Rendering
(no credentials) (credentials) (credentials)
Sends an HTTP request with Accept: text/markdown. If the site is behind Cloudflare and has the "Markdown for Agents" feature enabled, Cloudflare converts the HTML to markdown at the CDN edge and returns it directly. No API calls, no credentials, no processing on your side. The response includes token counts (X-Markdown-Tokens) and a usage policy signal (Content-Signal).
Downloads the file from the URL, then uploads it to Cloudflare's Workers AI toMarkdown REST API for server-side conversion. This is the most versatile method -- it handles 15+ file formats including PDFs, Word documents, Excel spreadsheets, images, and more. Text document conversion is free; image conversion uses AI vision models and may consume Neurons.
Sends the URL to Cloudflare's headless Chromium service, which opens a real browser, loads the page, executes all JavaScript, waits for content to render, then converts the fully-rendered DOM to markdown. This is the only method that captures content generated by client-side JavaScript. Does not work on PDFs.
| Content Negotiation | Workers AI | Browser Rendering | |
|---|---|---|---|
| Credentials | None | Required | Required |
| Cost | Free | Free (images may cost Neurons) | Free tier: 10 min/day |
| File Types | HTML only | HTML, PDF, images, Office docs, CSV, XML (15+ formats) | HTML only |
| JavaScript | No | No | Yes |
| Speed | Fast (single request) | Medium (fetch + API call) | Slow (browser render) |
| Best For | Cloudflare sites with feature enabled | PDFs, documents, any site | JS-heavy SPAs, dynamic pages |
See the SKILL.md for full CLI usage, options, and examples.
# Using npx (works across 37+ AI coding agents)
npx skills add arsolutioner/markdown-for-agents
# Using curl
curl -fsSL https://raw.githubusercontent.com/arsolutioner/markdown-for-agents/main/install.sh | bash/plugin marketplace add arsolutioner/markdown-for-agents
/plugin install markdown-for-agents
Tell your agent:
Install the skill from https://github.com/arsolutioner/markdown-for-agents
Or via ClawHub:
clawhub install markdown-for-agentsnpx skills add arsolutioner/markdown-for-agentsThe npx skills add command from Vercel Labs auto-detects your installed agents and places the skill in the correct location.
No setup needed for Method 1. For Methods 2 and 3, set Cloudflare credentials:
export CLOUDFLARE_ACCOUNT_ID=your_account_id
export CLOUDFLARE_API_TOKEN=your_api_tokenOr add to ~/.claude/.env when using with Claude Code.
To create an API token: dash.cloudflare.com > My Profile > API Tokens > Create Token with Workers AI: Read and Browser Rendering: Edit permissions.
Workers AI (Method 2) converts these formats to markdown:
| Format | Extensions |
|---|---|
| HTML | .html, .htm |
.pdf |
|
| Images | .jpeg, .jpg, .png, .webp, .svg |
| Microsoft Word | .docx |
| Microsoft Excel | .xlsx, .xlsm, .xlsb, .xls |
| Open Document | .ods, .odt |
| CSV / XML | .csv, .xml |
| Apple Numbers | .numbers |
Methods 1 and 3 handle HTML web pages only.
All three methods can be used for free within Cloudflare's included tiers.
| Method | Free? | What's Included | When You Pay |
|---|---|---|---|
| Content Negotiation | Yes | Unlimited requests, no metered billing | Free for the agent. Works on any site that has the feature enabled. |
| Workers AI | Yes | 10,000 Neurons/day. Text docs cost 0 Neurons. | Images consume Neurons. Beyond 10k/day: $0.011/1k Neurons (Workers Paid $5/mo) |
| Browser Rendering | Yes | Free plan: 10 min/day, 3 concurrent browsers. No payment needed. | Beyond free tier: Workers Paid ($5/mo) gives 10 hrs/month, then $0.09/hr |
In practice: Text-based conversion (web pages, PDFs, documents) is free. Content Negotiation is free to use on any site that supports it. Browser Rendering is free under 10 min/day.
| Method | Limitation |
|---|---|
| Content Negotiation | Only works on sites that have the feature enabled. Max 2 MB response. |
| Workers AI | Large files may timeout -- use -t 120. Images consume Neurons. |
| Browser Rendering | Does NOT work on PDFs. Free plan: 10 min/day. |
JavaScript-rendered content is only captured by Browser Rendering (Method 3).
This skill follows the Agent Skills open standard:
| Platform | Install |
|---|---|
| Claude Code | /plugin install or copy to ~/.claude/skills/ |
| OpenClaw | clawhub install or copy to ~/.openclaw/skills/ |
| Cursor | npx skills add |
| Augment Code | npx skills add |
| Codex | npx skills add |
| OpenCode | npx skills add |
markdown-for-agents/
.claude-plugin/
plugin.json # Claude Code plugin manifest
marketplace.json # Claude Code marketplace descriptor
skills/
markdown-for-agents/
SKILL.md # Agent Skills manifest (full docs, CLI usage, examples)
scripts/
fetch_markdown.py # Main CLI tool (all 3 methods)
install.sh # One-line installer script
Contributions are welcome. Please open an issue first to discuss what you would like to change.