brain-pdf
What it does
This skill creates a polished PDF from a page in your brain. It is useful for sharing or archiving a finished document.
When to use it
- βWhen you want to share a brain page as a PDF by email or chat.
- βWhen you want a report or briefing in a clean, printable format.
- βWhen you want to keep a long-form page in a portable file.
Skill link
https://github.com/garrytan/gbrain/blob/master/plugin/skills/brain-pdf/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βTurn my strategy page from my brain into a clean PDF with page numbers, so I can email it.β
5 new skills a week. 1 minute to read.
How it works
The agent removes the hidden details at the top of the page and cleans up special symbols. It then uses a separate PDF tool to render the page with headers and page numbers.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
brain-pdf β Render a Brain Page to Publication-Quality PDF
Convention: see conventions/quality.md for output rules. The PDF is a rendering β never the primary artifact. If a PDF exists, the source brain page exists behind it.
The rule
The brain page is ALWAYS the source of truth. The PDF is a rendering of it, never a standalone artifact. If a PDF exists somewhere, the brain page must exist behind it.
What this does
Renders a brain page (markdown with frontmatter) into a
publication-quality PDF using the gstack make-pdf binary. Output is
suitable for:
- Sharing a personalized book mirror via email or Telegram
- Delivering a strategic-reading playbook as a clean read
- Producing a briefing or report with running headers and page numbers
- Archiving a long-form essay in a portable format
Prerequisite: gstack make-pdf
This skill depends on the gstack make-pdf binary at:
$HOME/.claude/skills/gstack/make-pdf/dist/pdf
The user must have gstack co-installed. If absent, the skill cannot run. A future v0.26+ may bundle a fallback PDF renderer; for v0.25.1 gstack is a soft prereq.
Verify it exists before invoking:
P="$HOME/.claude/skills/gstack/make-pdf/dist/pdf"
[ -x "$P" ] || { echo "make-pdf not installed; install gstack" >&2; exit 1; }
Workflow
1. RESOLVE β Confirm the brain page exists (gbrain get <slug>).
2. STRIP β Remove YAML frontmatter β the renderer would otherwise
dump it as a full page of raw metadata text.
3. RENDER β Invoke make-pdf with sane defaults (no --cover, no --toc).
4. DELIVER β Hand the PDF to the requester via the agent's preferred
channel (do not use raw `MEDIA:` tags on Telegram β
they fail silently).
Invocation
SLUG="path/to/page"
P="$HOME/.claude/skills/gstack/make-pdf/dist/pdf"
# 1. Confirm the page exists.
gbrain get "$SLUG" > /dev/null || { echo "Page $SLUG not found" >&2; exit 1; }
# 2. Get the raw markdown. Two paths: read from the brain repo (if user
# syncs locally) OR ask gbrain for the body via the API.
BRAIN_DIR=$(gbrain config get sync.repo_path 2>/dev/null || echo)
if [ -n "$BRAIN_DIR" ] && [ -f "$BRAIN_DIR/$SLUG.md" ]; then
RAW="$BRAIN_DIR/$SLUG.md"
else
RAW=$(mktemp /tmp/brain-page-XXXXXX.md)
gbrain get "$SLUG" > "$RAW" # prints the page as markdown with frontmatter
fi
# 3. Strip the leading YAML frontmatter block only: line 1 '---' through
# the next '---'. A later '---' (a horizontal rule) and a page without
# frontmatter are kept as written. Plain awk, so it behaves the same with
# BSD (macOS) and GNU tools. Stop if nothing is left to render.
CLEAN=$(mktemp /tmp/brain-page-clean-XXXXXX.md)
awk 'NR==1 && /^---[[:space:]]*$/ {f=1; next} f==1 && /^---[[:space:]]*$/ {f=2; next} f!=1' "$RAW" > "$CLEAN"
[ -s "$CLEAN" ] || { echo "brain-pdf: nothing to render for $SLUG after removing frontmatter" >&2; exit 1; }
# 4. Render. NO --cover, NO --toc by default β they look corporate
# and waste space. Add them only if explicitly requested.
OUT="/tmp/$(basename "$SLUG").pdf"
CONTAINER=1 "$P" generate "$CLEAN" "$OUT"
echo "Rendered: $OUT"
CONTAINER=1 is mandatory in containerized environments β it tells
Playwright to skip Chromium sandboxing. Harmless on bare-metal.
Common patterns
# Default β clean PDF, no cover, no TOC
brain-pdf <slug>
# Draft watermark for in-progress work
CONTAINER=1 "$P" generate --watermark DRAFT "$CLEAN" "$OUT"
# Optional cover + TOC if the user explicitly asks
CONTAINER=1 "$P" generate --cover --toc "$CLEAN" "$OUT"
# Custom title + author override (otherwise pulled from frontmatter)
CONTAINER=1 "$P" generate --title "Custom Title" --author "Custom Author" "$CLEAN" "$OUT"
Defaults: NO cover, NO TOC
These flags are off by default because they look corporate and waste space on most personal-knowledge content. Only add them when the user explicitly asks for "formal" output (e.g., something they're sending to a board or printing as a deliverable).
Font requirements
The renderer needs:
fonts-liberation(Helvetica/Arial substitute)fonts-noto-cjk(Chinese/Japanese/Korean characters)- Minimum body font size: 10pt (page chrome 9pt)
- Body text: 11pt
If running in an environment without these fonts, install them via the
host's package manager (apt install fonts-liberation fonts-noto-cjk on
Debian/Ubuntu containers).
Delivery
After rendering,
FAQ
Does the PDF replace the page in my brain?
No. The brain page is always the original, and the PDF is only a copy of it.
Do I need any extra software?
Yes. The PDF step needs a separate tool called make-pdf to be installed.
Does the PDF show the private details?
The hidden metadata at the top of the page is removed before the PDF is made.
Details
Original description by the author
Generate a publication-quality PDF from any brain page via the gstack make-pdf binary. Strips YAML frontmatter, sanitizes emoji, applies running headers and page numbers. Brain page is always the source of truth; PDF is a rendering.
repo: garrytan/gbrain
Popularity
- GitHub stars
- 31k
- Ranking position
- #9289
- License
- MIT
- Updated
- 11/2/2026
Comments
- β¦
More skills from this repository
gbrain
31kLets your agent search a shared company knowledge brain for facts about people, projects and decisions, and save durable notes to it.
brain-ingest-gate
31kChecks new content against an existing knowledge brain before it is added, to avoid duplicates and resolve named entities first.
brain-link-discipline
31kMakes sure your agent includes a working link to each brain page it reports, in the same message, so you can open it right away.
brain-ops
31kGives your agent the core routine for a knowledge brain: check existing context first, save explicit notes with their source, and link related pages.
Similar skills
feishu-doc
394kHelps your agent read, create, and edit Feishu cloud documents, including text, images, and tables, using the document tool.
feishu-drive
394kLets your agent browse, organize, and comment on files in a Feishu cloud folder that has been shared with the bot.
feishu-perm
394kHelps your agent check and change who can access a Feishu file, choosing the smallest permission that meets your request.