agentleFS
wangmhaowangmhao/claude-skill-pdf/SKILL.md

pdf

Skill1 starsChanged 8 months agoMITView on GitHub

Convert Markdown files to professionally styled PDFs. Use when the user wants to export a .md file as PDF for sharing with clients or external stakeholders. Supports tables, code blocks, CJK (Chinese) characters, multiple templates, and batch conversion.

  • Installs packages

197 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use context7-efficient, file-reading and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • hfzarslanSkill

    context7-efficient

    Token-efficient library documentation fetcher using Context7 MCP with 86.8% token savings through intelligent shell pipeline filtering. Fetches code examples, API references, and best practices for JavaScript, Python, Go, Rust, and other libraries. Use when users ask about library documentation, need code examples, want API usage patterns, are learning a new framework, need syntax reference, or troubleshooting with library-specific information. Triggers include questions like "Show me React hooks", "How do I use Prisma", "What's the Next.js routing syntax", or any request for library/framework documentation.

    Also in 5 projects that use this

  • SeifBenayedSkill

    file-reading

    Use this skill when a file has been uploaded but its content is NOT in your context — only its path at /mnt/user-data/uploads/ is listed in an uploaded_files block. This skill is a router: it tells you which tool to use for each file type (pdf, docx, xlsx, csv, json, images, archives, ebooks) so you read the right amount the right way instead of blindly running cat on a binary. Triggers: any mention of /mnt/user-data/uploads/, an uploaded_files section, a file_path tag, or a user asking about an uploaded file you have not yet read. Do NOT use this skill if the file content is already visible in your context inside a documents block — you already have it.

    Also in 6 projects that use this

  • SeifBenayedSkill

    pdf-reading

    Use this skill when you need to read, inspect, or extract content from PDF files — especially when file content is NOT in your context and you need to read it from disk. Covers content inventory, text extraction, page rasterization for visual inspection, embedded image/attachment/table/form-field extraction, and choosing the right reading strategy for different document types (text-heavy, scanned, slide-decks, forms, data-heavy). Do NOT use this skill for PDF creation, form filling, merging, splitting, watermarking, or encryption — use the pdf skill instead.

    Also in 6 projects that use this

  • yf8578Skill

    market-research-reports

    Generate comprehensive market research reports (50+ pages) in the style of top consulting firms (McKinsey, BCG, Gartner). Features professional LaTeX formatting, extensive visual generation with scientific-schematics and generate-image, deep integration with research-lookup for data gathering, and multi-framework strategic analysis including Porter Five Forces, PESTLE, SWOT, TAM/SAM/SOM, and BCG Matrix.

    Also in 7 projects that use this

  • OpenAISkill

    migrate-to-codex

    Migrate supported instruction files, skills, agents, and MCP config into Codex project and global files.

    Also in 4 projects that use this

  • jjyaoaoSkill

    gift-evaluator

    The PRIMARY tool for Spring Festival gift analysis and social interaction generation. Use this skill when users upload photos of gifts (alcohol, tea, supplements, etc.) to inquire about their value, authenticity, or how to respond socially. Integrates visual perception, market valuation, and HTML card generation.

    Also in 4 projects that use this

The file

We split this skill into the rules it gives an agent

9 rules. 0 are common, 2 are distinctive, and 7 are very specific to this project.

  • 0

    Common

    Most of the 186 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If no path is provided, ask the user which .md file to convert.

    line 15
  2. Distinctive:

    If either tool is not found, print install instructions.

    line 23
  3. Very specific:

    If value ends in .css and file exists → use directly

    line 46
  4. Distinctive:

    Verify input file(s) exist.

    line 54
  5. Very specific:

    If the user provides multiple files or a glob pattern (e.g., *.md):

    line 107
  6. Very specific:

    weasyprint not found: Run pip3 install --user weasyprint (on macOS with managed Python, add --break-system-packages)

    line 141
  7. Very specific:

    pandoc not found: Run brew install pandoc

    line 142
  8. Very specific:

    Chinese characters garbled: Ensure CSS has CJK font fallback (PingFang SC, Microsoft YaHei)

    line 143
  9. Very specific:

    Template not found: Check ls ~/.claude/skills/pdf/templates/ for available templates

    line 145

“Common” is measured: kept by at least 6 in 10 of the 186 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Markdown to PDF Converter

Convert Markdown documents to professionally styled PDFs using pandoc + weasyprint with customizable CSS templates.

Input

The user provides a Markdown file path (or multiple paths / glob): $ARGUMENTS

If no path is provided, ask the user which .md file to convert.

Dependencies

  • pandoc — brew install pandoc
  • weasyprint — pip3 install --user weasyprint
  • CSS templates — bundled in ${CLAUDE_SKILL_DIR}/templates/

If either tool is not found, print install instructions.

Arguments

Parse $ARGUMENTS for:

  • Input file(s) — one or more .md file paths, or a glob pattern like *.md (required)
  • --output or -o — custom output path (optional, defaults to ~/Desktop/<filename>.pdf; single file only)
  • --title or -t — document title for HTML metadata (optional, defaults to filename)
  • --template — template name (optional, defaults to report)

Templates

Available templates (CSS files in ${CLAUDE_SKILL_DIR}/templates/):

TemplateDescription
reportProfessional report with dark table headers, zebra striping, page numbers (default)
minimalClean, lightweight — GitHub-style tables, no border accents
branded-exampleBranded example with "visiAI — Confidential" footer

Users can also pass a path to any .css file as the template value.

Template resolution order:

  1. If value ends in .css and file exists → use directly
  2. comms/templates/<name>.css (project-local override)
  3. ${CLAUDE_SKILL_DIR}/templates/<name>.css (bundled)

Conversion Steps

Step 1: Locate files and parse arguments

Verify input file(s) exist. If a file is not found, use Glob to search for likely matches.

Step 2: Find CSS template

SKILL_DIR="${CLAUDE_SKILL_DIR}"

# Resolve template
find_css() {
  local name="$1"
  # Direct .css path
  if [[ "$name" == *.css ]] && [[ -f "$name" ]]; then echo "$name"; return; fi
  # Project-local
  if [[ -f "comms/templates/${name}.css" ]]; then echo "comms/templates/${name}.css"; return; fi
  # Skill-bundled
  if [[ -f "${SKILL_DIR}/templates/${name}.css" ]]; then echo "${SKILL_DIR}/templates/${name}.css"; return; fi
}
CSS=$(find_css "${TEMPLATE:-report}")

Step 3: Convert MD to HTML

pandoc "<input.md>" \
  -o "/tmp/md2pdf_temp.html" \
  --standalone \
  --metadata "title=<title>" \
  --css "<css-path>" \
  --embed-resources

Step 4: Convert HTML to PDF

weasyprint \
  "/tmp/md2pdf_temp.html" \
  "<output.pdf>" \
  2>/dev/null

Step 5: Cleanup and report

rm -f /tmp/md2pdf_temp.html

Report:

  • Output file path
  • File size
  • Remind user to open and verify formatting

Batch Mode

If the user provides multiple files or a glob pattern (e.g., *.md):

  1. Expand the glob to a list of files
  2. Convert each file individually (output to ~/Desktop/<filename>.pdf)
  3. Report results in a summary table:
Status  File                                               Size
------  --------------------------------------------------  ----
OK      ~/Desktop/report1.pdf                              245K
OK      ~/Desktop/report2.pdf                              180K
FAIL    broken.md                                          conversion error

Alternatively, use the bundled shell script directly:

bash "${CLAUDE_SKILL_DIR}/scripts/md2pdf.sh" --template report *.md

Shell Script

A standalone scripts/md2pdf.sh is included for use outside Claude Code:

# Single file
bash ~/.claude/skills/pdf/scripts/md2pdf.sh report.md

# With template
bash ~/.claude/skills/pdf/scripts/md2pdf.sh --template minimal report.md

# Batch
bash ~/.claude/skills/pdf/scripts/md2pdf.sh --template report *.md

Troubleshooting

  • weasyprint not found: Run pip3 install --user weasyprint (on macOS with managed Python, add --break-system-packages)
  • pandoc not found: Run brew install pandoc
  • Chinese characters garbled: Ensure CSS has CJK font fallback (PingFang SC, Microsoft YaHei)
  • Tables overflowing: CSS should have table { width: 100%; font-size: 10pt; }
  • Template not found: Check ls ~/.claude/skills/pdf/templates/ for available templates

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.