agent-instructions
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what does not, structure, and…
Use when converting between document formats. Covers HTML to Markdown, document to Markdown, PDF generation from HTML, and preserving structure through a conversion rather than losing it.
$ npx -y skills add nimadorostkar/Claude-Skills-collection --skill document-conversion --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/document-conversionContext preview
The summary Claude sees to decide when to auto-load this skill.
Use when converting between document formats. Covers HTML to Markdown, document to Markdown, PDF generation from HTML, and preserving structure through a conversion rather than losing it.
name: document-conversion description: Use when converting between document formats. Covers HTML to Markdown, document to Markdown, PDF generation from HTML, and preserving structure through a conversion rather than losing it. metadata: category: documents version: 1.0.0 tags: [conversion, markdown, html, pandoc, scraping]
Convert documents between formats while preserving the structure that matters. Most conversion tools preserve the text and destroy the structure, which is usually the part you needed.
1. **Decide what must survive** — Headings and tables usually must. Fonts and exact spacing usually must not. Naming this first prevents a great deal of wasted effort on preserving things nobody needs. 2. **Extract the content, not the page** — A web page is 80% navigation, cookie banners, and related-articles rails. Convert the article, not the chrome. 3. **Use a converter that understands the structure** — A regex that strips HTML tags produces a wall of text with no headings and no tables. Use a real parser. 4. **Handle the tables specially** — They are the most commonly destroyed structure. Verify them after conversion. 5. **Verify a sample** — Open the output next to the input and compare. Conversion failures are usually silent.
**Web page to Markdown, keeping the content and discarding the page:**
import trafilatura
from markdownify import markdownify
def url_to_markdown(url: str) -> Document:
downloaded = trafilatura.fetch_url(url)
if downloaded is None:
raise ConversionError(f"could not fetch {url}")
# trafilatura identifies the main content and discards navigation, footers,
# cookie banners, and related-article rails. A hand-written CSS selector
# does this badly and breaks on every site redesign.
content_html = trafilatura.extract(
downloaded,
output_format="html",
include_tables=True, # tables are usually the point
include_links=True,
include_images=False,
favor_precision=True,
)
if content_html is None:
raise ConversionError(f"no main content identified in {url}")
metadata = trafilatura.extract_metadata(downloaded)
markdown = markdownify(
content_html,
heading_style="ATX", # ## rather than underlines
code_language_callback=lambda el: el.get("class", [""])[0].replace("language-", ""),
)
return Document(
title=metadata.title,
source_url=url, # provenance: without it, the output is unverifiable
retrieved_at=utcnow(),
markdown=markdown.strip(),
)**HTML to PDF that respects modern CSS:**
from playwright.sync_api import sync_playwright
def html_to_pdf(html: str, output: str) -> None:
"""A real browser engine. Older HTML-to-PDF libraries silently ignore
flexbox and grid, and the resulting PDF bears no resemblance to the page."""
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.set_content(html, wait_until="networkidle")
page.emulate_media(media="print") # apply @media print rules
page.pdf(
path=output,
format="A4",
margin={"top": "20mm", "bottom": "20mm", "left": "18mm", "right": "18mm"},
print_background=True,
display_header_footer=True,
footer_template=(
'<div style="font-size:9px;width:100%;text-align:center;color:#666">'
'<span class="pageNumber"></span> / <span class="totalPages"></span></div>'
),
)
browser.close()A curated library of 137 production-grade skills for Claude and other AI coding agents. Every skill follows one structure, speaks with one voice, and earns its place by changing what the agent does.
Repo: nimadorostkar/Claude-Skills-collection
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what does not, structure, and…
Use when an agent needs state that survives a session or a context compaction. Covers what to persist, file-based memory, structuring notes for retrieval, and…
Use when automating agent behavior with lifecycle hooks. Covers hook events, deterministic enforcement of rules the model should not be trusted to remember,…
Use when packaging skills, commands, hooks, and MCP servers into a distributable plugin. Covers manifest structure, bundling, versioning, testing, and…
Use when writing a new skill for an AI agent. Covers scoping, description writing for reliable triggering, progressive disclosure, and the difference between a…
Use when reviewing or improving an existing agent skill. Covers triggering accuracy, content quality, redundancy with the base model, and measuring whether the…