nighthawk-pdf-export

nighthawk-pdf-export is a skill for Claude Code, Codex from microsoftgbb/project-nighthawk. It costs 43 tokens per session (1,335 once invoked), scanned A, original, MIT.

A macOS export tool for turning Nighthawk Markdown reports into styled PDF files. It can handle Mermaid diagrams, which are text descriptions of diagrams.

In plain words
What is it for?
Use it to create PDFs from Nighthawk notes files, including reports with Mermaid diagrams.
Why use it?
It removes the need to format reports manually or choose and configure a PDF conversion method yourself.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/microsoftgbb/project-nighthawk/nighthawk-pdfexport
Any agent
npx skills add microsoftgbb/project-nighthawk --skill nighthawk-pdfexport
Clone the repo
git clone --depth 1 https://github.com/microsoftgbb/project-nighthawk

Made for: Claude Code, Codex.

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 nighthawk-pdf-export

README.md
[![agentmods](https://agentmods.dev/badge/skills/microsoftgbb/project-nighthawk/nighthawk-pdfexport.svg)](https://agentmods.dev/skills/microsoftgbb/project-nighthawk/nighthawk-pdfexport)
Your own site
<a href="https://agentmods.dev/skills/microsoftgbb/project-nighthawk/nighthawk-pdfexport"><img src="https://agentmods.dev/badge/skills/microsoftgbb/project-nighthawk/nighthawk-pdfexport.svg" alt="Measured on agentmods" height="20"></a>
Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,335 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00043 $0.01335
Opus 5 $0.00022 $0.00668
Sonnet 5 $0.00009 $0.00267
Haiku 4.5 $0.00004 $0.00134

Measured 3d ago against content hash e2b893bd4bb8, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

nighthawk-pdf-export scanned grade A with 0 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 3d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.github/skills/Nighthawk-PDFExport/SKILL.md · 112 lines

How it starts

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

Nighthawk PDF Export

Converts a Nighthawk markdown report (notes/Nighthawk-*.md) to a styled PDF.

Tool Detection Order

Always probe before choosing an approach:

which pandoc wkhtmltopdf md-to-pdf 2>/dev/null
python3 -c "import weasyprint" 2>/dev/null && echo "weasyprint: ok" || echo "weasyprint: not installed"

Option A — pandoc (preferred, if installed)

pandoc "notes/Nighthawk-YYYY-MM-DD-topic.md" \
  -o "notes/Nighthawk-YYYY-MM-DD-topic.pdf" \
  --pdf-engine=wkhtmltopdf \
  -V geometry:margin=1in -V fontsize=11pt
# fallback engines in order: xelatex, pdflatex

Option B — Python + weasyprint (macOS fallback, supports Mermaid)

This is the verified working approach on macOS. It handles Mermaid diagrams by pre-rendering them to hi-res PNG via Puppeteer, then embedding them inline before weasyprint processes the document.

Do NOT use SVG — weasyprint renders SVG shapes but drops all text (missing font resolution). Always use PNG.

Step 1 — Install dependencies

python3 -m venv /tmp/pdf-venv
/tmp/pdf-venv/bin/pip install --quiet markdown weasyprint

Step 2 — Pre-render Mermaid diagrams to PNG

Run this for each report that contains a ```mermaid block:

# Extract the mermaid source
awk '/^```mermaid$/,/^```$/' notes/Nighthawk-YYYY-MM-DD-topic.md | sed '1d;$d' > /tmp/diagram.mmd

# Render to hi-res PNG (--width 3000 --scale 3 ensures readable text in PDF)
npx @mermaid-js/mermaid-cli -i /tmp/diagram.mmd -o /tmp/diagram.png --width 3000 --scale 3

Step 3 — Generate PDF with embedded diagram

Write the following to /tmp/build_pdf.py and run with the venv:

import pathlib, re, base64, markdown
from weasyprint import HTML

MD_IN  = "/Volumes/Extreme SSD/src/project-nighthawk/notes/Nighthawk-YYYY-MM-DD-topic.md"
PNG_IN = "/tmp/diagram.png"   # omit if no Mermaid diagram
PDF_OUT = "/Volumes/Extreme SSD/src/project-nighthawk/notes/Nighthawk-YYYY-MM-DD-topic.pdf"

CSS = """
body { font-family: Georgia, serif; font-size: 11pt; line-height: 1.6; padding: 40px; max-width: 900px; margin: auto; }
h1 { font-size: 20pt; border-bottom: 2px solid #333; padding-bottom: 8px; margin-top: 24px; }
h2 { font-size: 15pt; border-bottom: 1px solid #666; margin-top: 20px; }
h3 { font-size: 13pt; margin-top: 16px; }
code { font-family: 'Courier New', monospace; background: #f4f4f4; padding: 2px 4px; border-radius: 3px; font-size: 9pt; }
pre { background: #f4f4f4; padding: 12px; border-radius: 4px; border-left: 3px solid #666; page-break-inside: avoid; }
pre code { background: none; padding: 0; }
table { border-collapse: collapse; width: 100%; margin: 12px 0; page-break-inside: avoid; }
th { background: #333; color: white; padding: 8px; text-align: left; }
td { padding: 6px 8px; border: 1px solid #ccc; }
tr:nth-child(even) { background: #f9f9f9; }
blockquote { border-left: 4px solid #999; padding-left: 16px; color: #555; margin: 12px 0; }
a { color: #0066cc; }
img { max-width: 100%; height: auto; margin: 16px 0; }
"""

md_text = pathlib.Path(MD_IN).read_text(encoding="utf-8")

# Replace mermaid fenced block with embedded hi-res PNG
png_path = pathlib.Path(PNG_IN)
if png_path.exists():
    png_b64 = base64.b64encode(png_path.read_bytes()).decode()
    png_tag = f'<img src="data:image/png;base64,{png_b64}" alt="Diagram" />'
    md_text = re.sub(r'```mermaid\n.*?```', png_tag, md_text, flags=re.DOTALL)

body = markdown.markdown(md_text, extensions=["tables", "fenced_code", "toc"])
html = f"<!DOCTYPE html><html><head><meta charset='utf-8'><style>{CSS}</style></head><body>{body}</body></html>"
HTML(string=html).write_pdf(PDF_OUT)

size = pathlib.Path(PDF_OUT).stat().st_size
print(f"PDF written: {PDF_OUT} ({size:,} bytes / {size//1024} KB)")

Read the full file on GitHub · 112 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. 3d ago First seen · 112 lines · 43 tokens per session scan A e2b893bd4bb8

Subscribe to this mod's changes

nighthawk-pdf-export is a skill published in the GitHub repository microsoftgbb/project-nighthawk (31 stars, last pushed 3mo ago), licensed MIT. It adds 43 tokens to every session and 1,335 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

foundry-hosted-agent-validation

Step-by-step process for validating a Python Foundry hosted agent sample (under python/samples/04-hosting/foundry-hosted-agents/) end to end — running it locally (native runtime and azd ai agent run) and after deploying it to an Azure AI Foundry project with azd. Use this when asked to validate a hosted agent sample.

microsoft/agent-framework · 82 tokens

n8n-binary-and-data

Handle files and binary data in n8n correctly. Use when working with files, images, PDFs, attachments, uploads or downloads, base64, vision/multimodal input, or when an AI agent needs a file as tool input or output — and whenever the user mentions $binary, binaryPropertyName, "read the PDF", "attach the file", "send…

czlonkowski/n8n-mcp · 135 tokens

format-specific-extraction

Format-specific document extraction workflows.

xberg-io/xberg · 10 tokens

parse-document

Convert a PDF, scan, image of a page, or office file to clean markdown through the connected Superlinked MCP edge, so the source document is not read into model context directly. Use when the user asks to read, parse, OCR, extract from, summarize, or answer questions about a document.

superlinked/sie · 64 tokens

make-resume

中文可编辑简历制作技能:根据用户经历选择或复刻模板,生成可编辑 HTML 简历并提供 PDF 导出;当用户输入“/make-resume”或要求制作、修改、复刻简历文件时使用。.

Hisn00w/ASu-skills · 56 tokens

pandic-office

Convert Markdown to PDF (or DOCX/EPUB/HTML) using the pandoc CLI. Use when asked to produce a PDF report, brief, summary, or any document where the input is Markdown and the output should be a polished, paginated file.

Team-Commonly/commonly · 59 tokens