Install
$ agentstack add skill-tonysina-claude-skills-markdown-fetch ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ● Network access Used
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
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.text
TypeScript / 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)
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: tonysina
- Source: tonysina/claude-skills
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.