markdown-fetch
Skill2 starsChanged 6 months agoMITView on GitHub
Fetches web content as markdown instead of HTML when available, reducing token usage by up to 80%. Use when fetching web pages for AI processing, content ingestion, summarization, RAG pipelines, or any workflow that reads web content into a context window. Triggers on "fetch this page", "get the content from", "read this URL", "scrape", "ingest this site", web_fetch calls for AI consumption, or any task that pulls web content for LLM processing. Do NOT use for fetching APIs that return JSON, downloading binary files, or accessing pages where exact HTML structure matters (e.g., scraping specific DOM elements).
2 other projects use a version of this.
Adopted by
Most recently taken up by
- ckorhonen/claude-skillstheir own version, first seen Jul 5, 2026
- dnh33/markdown-fetchtheir own version, first seen Feb 23, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- ckorhonen/claude-skills★ 17same name
- dnh33/markdown-fetch★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository13 other files it gives its agents.
- and-or-plannerSkill
- beyond-obviousSkill
- beyond-the-summarySkill
- farnsworth-rhetoricSkill
- great-demoSkill
- humanizerSkill
- human-narrativeSkill
- intelligence-flow-architectureSkill
- skill-builderSkill
- source-checkSkill
- split-pdfSkill
- start-with-whySkill
- strategic-persuasion-writingSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 3 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 19
When fetching web content for AI processing, request markdown instead of HTML.
- Very specific: line 31
If the server supports it, you get back content-type: text/markdown
- Distinctive: line 32
If not, you get standard HTML as a fallback
- Distinctive: line 36
Use this to decide on chunking strategy or check context window fit.
- Very specific: line 87
Not every site supports this.
- Very specific: line 94
When a fetch returns text/markdown, save the content as a .md file and present it to the user in addition to using it for the task at hand.
- Very specific: line 99
Write the markdown to /mnt/user-data/outputs/{descriptive-name}.md
- Very specific: line 100
Call present_files to share it
- Distinctive: line 109
If markdown negotiation isn't available from the source, Cloudflare provides two other conversion options:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Markdown Fetch
When fetching web content for AI processing, request markdown instead of HTML.
Cloudflare's "Markdown for Agents" feature (and similar services) convert HTML
to clean markdown on the fly when the request includes an Accept: text/markdown
header. This dramatically cuts token usage since HTML markup, nav bars, script
tags, and wrapper divs are stripped out.
How It Works
Any Cloudflare-enabled site with "Markdown for Agents" turned on will honor content negotiation. The pattern is simple:
- Send
Accept: text/markdown, text/htmlin the request headers - If the server supports it, you get back
content-type: text/markdown - If not, you get standard HTML as a fallback
The response may also include:
x-markdown-tokensheader: estimated token count of the markdown content. Use this to decide on chunking strategy or check context window fit.Content-Signalheader: declares the publisher's AI usage permissions (training, search, agentic input).
When to Apply This Pattern
Apply this when ALL of these are true:
- You are fetching a web page (not an API endpoint or binary file)
- The content will be processed by an LLM (summarization, analysis, RAG, etc.)
- You don't need the raw HTML structure itself
Skip this when:
- The task requires specific DOM elements or CSS selectors
- You're calling a REST API that returns JSON/XML
- You need to render the page visually
Implementation
curl
curl https://example.com/page \
-H "Accept: text/markdown, text/html"Python (requests)
import requests
response = requests.get(
"https://example.com/page",
headers={"Accept": "text/markdown, text/html"}
)
is_markdown = "text/markdown" in response.headers.get("content-type", "")
token_estimate = response.headers.get("x-markdown-tokens")
content = response.textTypeScript / Workers
const response = await fetch("https://example.com/page", {
headers: { Accept: "text/markdown, text/html" },
});
const isMarkdown = response.headers.get("content-type")?.includes("text/markdown");
const tokenCount = response.headers.get("x-markdown-tokens");
const content = await response.text();Checking Whether a Site Supports It
Not every site supports this. After fetching, check the response content-type
header. If it contains text/markdown, the conversion succeeded. If it returns
text/html, the site either doesn't use Cloudflare or hasn't enabled the feature.
Your code should handle both cases gracefully.
Presenting Markdown to the User
When a fetch returns text/markdown, save the content as a .md file and
present it to the user in addition to using it for the task at hand. The
markdown is already in context from the fetch, so this adds negligible cost.
- Complete the primary task (summarize, analyze, etc.) using the markdown content
- Write the markdown to
/mnt/user-data/outputs/{descriptive-name}.md - Call
present_filesto share it
The user gets a clean, rendered, downloadable copy of the page content alongside
whatever they originally asked for. This is a side effect, not a replacement for
the primary task. If the response came back as text/html (site doesn't support
markdown negotiation), skip this step and proceed normally.
Alternative Conversion Methods
If markdown negotiation isn't available from the source, Cloudflare provides two other conversion options:
- Workers AI
AI.toMarkdown(): Converts HTML, PDFs, Office docs, and other formats to markdown server-side. Useful for document ingestion pipelines. - Browser Rendering
/markdownREST API: Renders dynamic pages (SPAs, JS-heavy sites) in a real browser first, then converts to markdown.
Example: Deciding Based on Token Count
token_estimate = response.headers.get("x-markdown-tokens")
if token_estimate and int(token_estimate) > context_window_limit:
# Content too large - chunk it
chunks = split_markdown_by_sections(content)
else:
# Fits in context - use directly
process(content)Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

