aiskillstore/marketplace / skills/0xbigboss/web-fetch
web-fetch
VerifiedFetches web content as clean markdown by preferring markdown-native responses and falling back to selector-based HTML extraction. Use for documentation, articles, and reference pages at http/https URLs.
| File | Kind | Size |
|---|---|---|
| .gitignore | other | 21 B |
| SKILL.md | skill md | 3.3 KB |
| fetch.ts | script | 3.4 KB |
| package.json | manifest | 218 B |
| skill-report.json | config | 45.9 KB |
fetch.ts
View on GitHubimport { parseHTML } from "linkedom";
import TurndownService from "turndown";
const url = process.argv[2];
if (!url) {
console.error("Usage: bun fetch.ts <url>");
process.exit(1);
}
// Step 1: Fetch
const response = await fetch(url, {
headers: {
"User-Agent": "Mozilla/5.0 (compatible; ClaudeCode/1.0)",
},
});
if (!response.ok) {
console.error(`Fetch failed: ${response.status} ${response.statusText}`);
process.exit(1);
}
const html = await response.text();
// Step 2: Parse DOM
const { document } = parseHTML(html);
// Step 3: Find the content-rich element
const candidates = [
...document.querySelectorAll("article"),
...document.querySelectorAll("main"),
...document.querySelectorAll('[role="main"]'),
...document.querySelectorAll(".content"),
...document.querySelectorAll("#content"),
];
let contentEl: Element | null = null;
let maxLength = 0;
for (const el of candidates) {
const len = el.textContent?.length || 0;
if (len > maxLength) {
maxLength = len;
contentEl = el;
}
}
if (!contentEl) {
contentEl = document.body;
}
// Step 4: Clean up the content element before conversion
// Remove navigation elements
const removeSelectors = [
"nav",
"header",
"footer",
"script",
"style",
"noscript",
'[role="navigation"]',
".sidebar",
".nav",
".menu",
".toc",
'[aria-label="breadcrumb"]',
];
for (const selector of removeSelectors) {
contentEl.querySelectorAll(selector).forEach((el) => el.remove());
}
// Step 5: Convert to Markdown with Turndown
const turndown = new TurndownService({
headingStyle: "atx",
codeBlockStyle: "fenced",
});
// Better code block handling
turndown.addRule("fencedCodeBlock", {
filter: (node) => {
return (
node.nodeName === "PRE" &&
node.firstChild &&
node.firstChild.nodeName === "CODE"
);
},
replacement: (content, node) => {
const el = node as Element;
const code = el.querySelector("code");
const className = code?.className || "";
const lang = className.match(/language-(\w+)/)?.[1] || "";
const text = code?.textContent || "";
return `\n\`\`\`${lang}\n${text}\n\`\`\`\n`;
},
});
// Handle pre without code child
turndown.addRule("preBlock", {
filter: (node) => {
return (
node.nodeName === "PRE" &&
(!node.firstChild || node.firstChild.nodeName !== "CODE")
);
},
replacement: (content, node) => {
const text = (node as Element).textContent || "";
return `\n\`\`\`\n${text}\n\`\`\`\n`;
},
});
// Remove "Copy page" buttons and similar UI elements
turndown.addRule("removeButtons", {
filter: (node) => {
if (node.nodeName === "BUTTON") return true;
const el = node as Element;
if (el.getAttribute?.("aria-label")?.includes("Copy")) return true;
return false;
},
replacement: () => "",
});
const markdown = turndown.turndown(contentEl.innerHTML);
// Step 6: Clean up the output
const cleaned = markdown
// Remove Loading... placeholders
.replace(/^Loading\.\.\.$/gm, "")
// Remove Copy buttons
.replace(/^Copy page$/gm, "")
.replace(/^Copy$/gm, "")
// Fix empty headings (## \n\nActual heading -> ## Actual heading)
.replace(/^(#{1,6})\s*\n\n+([A-Z])/gm, "$1 $2")
// Remove completely empty headings
.replace(/^#{1,6}\s*$/gm, "")
// Collapse multiple newlines
.replace(/\n{3,}/g, "\n\n")
.trim();
// Output with title
const title = document.title || "Untitled";
console.log(`# ${title}\n`);
console.log(cleaned);
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-changelog-updatemorluto/reaPrepare or rewrite REA release changelogs and GitHub release notes from pinned Git history, with verified contributor thanks and Release Please synchronization. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| academy-guideanthropics/skillsStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials, and use cases from Claude Academy (academy.claude.com), Anthropic's learning hub. Trigger on: "how do I", "how can I", "getting started with", "what can Claude do", "teach me", "learn to use"; questions about artifacts, projects, skills, plugins, connectors, MCP; requests about rolling Claude out to a team, class, or organization; and any ask for training materials, onboarding content, or learning resources. Use it when the user is learning how to use a feature or product — not when they are mid-task and just want the task done. This skill composes with other skills: after consulting product documentation to answer how a Claude feature works, also check here for a matching course or tutorial — a docs-grounded answer and an Academy recommendation belong together. Only recommend on a strong match; never invent Academy content. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| claude-apianthropics/skillsReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any form (Claude, Anthropic, Fable, Opus, Sonnet, Haiku, `anthropic`, `@anthropic-ai`, `claude-*`, `us.anthropic.*`, `[1m]`); the user asks about an LLM (pricing/model choice/limits/caching) — never answer from memory; OR the task is LLM-shaped with provider unstated (agent/MCP/tool-definition/multi-agent/RAG/LLM-judge/computer-use; generate/summarize/extract/classify/rewrite/converse over NL; debugging refusals/cutoffs/streaming/tool-calls/tokens). SKIP only when another provider is being worked on (overrides all triggers): OpenAI/GPT/Gemini/Llama/Mistral/Cohere/Ollama named in the query; OR `grep -rE 'openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama'` over the project hits (run this grep FIRST if no provider named — don't Read the file). | Stars: 198k | Updated | Claude CodeCodex | Unverified | Install |
| doc-coauthoringanthropics/skillsGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |