export-pdf

export-pdf is a skill for Claude Code from martineserios/thebrana. It costs 29 tokens per session (1,588 once invoked), scanned C, original, MIT.

A converter that turns a Markdown file into a PDF document. It can prepare Mermaid diagrams—text-based diagrams—for rendering when the required renderer is installed.

In plain words
What is it for?
Use it to export proposals, standard operating procedures, and other Markdown documents as PDFs.
Why use it?
It avoids manually reformatting Markdown when you need a shareable or printable document. It also warns when diagrams may remain as raw text.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: model in frontmatter; names the AskUserQuestion tool.

Part of the brana plugin — 56 skills, 4 commands, 14 agents, 13 hooks shipped together

Good fit Use it to export proposals, standard operating procedures, and other Markdown documents as PDFs.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/martineserios/thebrana/export-pdf
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add martineserios/thebrana --skill export-pdf
Clone the repo
git clone --depth 1 https://github.com/martineserios/thebrana

Made for: Claude Code.

Or install brana, the plugin that ships this one along with the rest of its 56 skills, 4 commands, 14 agents, 13 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for export-pdf

README.md
[![agentmods](https://agentmods.dev/badge/skills/martineserios/thebrana/export-pdf.svg)](https://agentmods.dev/skills/martineserios/thebrana/export-pdf)
Your own site
<a href="https://agentmods.dev/skills/martineserios/thebrana/export-pdf"><img src="https://agentmods.dev/badge/skills/martineserios/thebrana/export-pdf.svg" alt="Measured on agentmods" height="20"></a>
Per session 29 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,588 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 2 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00029 $0.01588
Opus 5 $0.00015 $0.00794
Sonnet 5 $0.00006 $0.00318
Haiku 4.5 $0.00003 $0.00159

Measured 4d ago against content hash 4de820fc1131, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade C, and why

export-pdf scanned grade C with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

6. After the PDF is generated (step 5), clean up: `rm -rf "$tmp_dir"`.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

r = subprocess.run(
system/skills/export-pdf/SKILL.md · 168 lines

How it starts

The opening of the file, as written. The whole thing — 168 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Export PDF — Markdown to PDF Converter

Convert a markdown file to a styled PDF using mdpdf.

Process

1. Parse arguments

If $ARGUMENTS is empty, ask the user for the markdown file path. If provided, use it directly (e.g., /brana:export-pdf propuesta-integracion-payway.md).

2. Resolve path

Resolve the file path:

  • If relative, resolve against $PWD
  • Validate the file exists and has .md extension
  • If the file doesn't exist, suggest matches using Glob with **/*{slug}*.md

3. Pre-render Mermaid blocks

Check if the source file contains any Mermaid code blocks:

grep -c '```mermaid' "{source_file}"

If count is 0: skip this step — no Mermaid blocks found. render_source = {source_file}.

If count > 0:

  1. Resolve mmdc:

    mmdc_bin=$(which mmdc 2>/dev/null)
    

    If empty, warn the user: "Mermaid blocks found but mmdc is not installed — they will render as raw code. Install with: npm install -g @mermaid-js/mermaid-cli then ln -sf $(which mmdc) ~/.local/bin/mmdc". Set render_source = {source_file} and skip to step 4.

  2. Create a temp workspace and copy the source:

    tmp_dir=$(mktemp -d)
    tmp_md="${tmp_dir}/$(basename '{source_file}')"
    cp "{source_file}" "$tmp_md"
    
  3. Write Puppeteer config — required on Ubuntu 23.10+ due to AppArmor namespace restrictions:

    cat > "${tmp_dir}/puppeteer.json" <<'EOF'
    {"args":["--no-sandbox","--disable-setuid-sandbox"]}
    EOF
    
  4. Extract and render each block, replacing it with an image reference. Pass $mmdc_bin as a third argument so the Python subprocess uses the resolved path:

    uv run python3 - "$tmp_md" "$tmp_dir" "$mmdc_bin" <<'PYEOF'
    import re, subprocess, sys
    from pathlib import Path
    
    src = Path(sys.argv[1])
    tmp = Path(sys.argv[2])
    mmdc_cmd = sys.argv[3]  # resolved from PATH
    content = src.read_text()
    puppeteer_cfg = tmp / "puppeteer.json"
    pattern = re.compile(r'```mermaid\n(.*?)```', re.DOTALL)
    
    def render_block(match, idx):
        diagram = match.group(1).strip()
        mmd = tmp / f"diagram_{idx}.mmd"
        png = tmp / f"diagram_{idx}.png"
        mmd.write_text(diagram)
        r = subprocess.run(
            [mmdc_cmd, "-i", str(mmd), "-o", str(png), "-p", str(puppeteer_cfg)],
            capture_output=True, text=True
        )
        if r.returncode != 0:
            print(f"[warn] mmdc failed for block {idx}: {r.stderr.strip()}", file=sys.stderr)
            return match.group(0)  # keep original block on failure
        return f"![]({png})"
    
    counter = [0]
    def repl(m):
        counter[0] += 1
        return render_block(m, counter[0])
    
    new_content = pattern.sub(repl, content)
    src.write_text(new_content)
    print(f"Rendered {counter[0]} Mermaid block(s)")
    PYEOF
    

Read the full file on GitHub · 168 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 168 lines · 29 tokens per session scan C 4de820fc1131

Subscribe to this mod's changes

export-pdf is a skill published in the GitHub repository martineserios/thebrana (3 stars, last pushed today), licensed MIT. It adds 29 tokens to every session and 1,588 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it C with 2 findings (recursive force delete, runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.