garrytan/gbrain/plugin/skills/brain-pdf/SKILL.md
brain-pdf
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.
- Source repository stars
- 29,034
- Declared platforms
- 0
- Static risk flags
- 1
- Last source update
- 2026-08-25
- Source checked
- 2026-08-25
Decision brief
What it does: where it fits
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.
Not for
- ❌ Generating a PDF without first confirming the brain page exists.
- ❌ Skipping the frontmatter strip. The renderer dumps frontmatter as
What changed when the Skill was used
In this controlled same-task single run, enabling brain-pdf changed the output from 3648 non-whitespace characters and 8 headings to 3100 characters and 9 headings. Matches among 8 signals extracted from the pinned source changed from 4 to 5. Both actual outputs are shown; this is a structural observation, not a quality score or a universal performance claim.
Same test task
Design and implement a representative production change for a TypeScript webhook retry service. Include the key code or pseudocode, tradeoffs, and verification steps. The deliverable must specifically reflect this user intent: 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.

Baseline: 3648 non-whitespace characters, 8 headings, and 38 list items.

With Skill: 3100 non-whitespace characters, 9 headings, and 46 list items.
| Observation | Without Skill | With Skill |
|---|---|---|
| Source-signal coverage | 4/8: render, brain, gstack, make-pdf | 5/8: brain-pdf, render, brain, gstack, make-pdf |
| Output structure | 3648 chars · 8 headings · 38 list items · 2 code blocks | 3100 chars · 9 headings · 46 list items · 2 code blocks |
| Verification and caution signals | 11 verification signals · 2 risk/limitation signals | 11 verification signals · 7 risk/limitation signals |
A prompt you can use
Use the brain-pdf Skill pinned at 07f5d28dcfe1 for my task. Follow its source-specific constraints around `brain-pdf`, `render`, `brain`, `publication-quality`, then return the finished deliverable with explicit assumptions, verification, failure conditions, and limits. Do not treat the Skill text as a factual source or claim that a single demonstration proves universal performance.
Method and limitationsExpandCollapse
Test method
- Baseline and treatment used the same task, model (gpt-5.3-codex-low), and runner; the only planned difference was whether the complete target Skill text was injected.
- The treatment used snapshot d35c9c9e441e6cfc86dd5e84b0b168c6b18ee775; the current source commit 07f5d28dcfe1b117cfd1a2b5d57c9fe77efc74ee was verified against content hash fe34a0d56d8d. The baseline explicitly prohibited loading any Skill or external rule file.
- The same deterministic script counted characters, headings, lists, code blocks, verification terms, caution terms, and source signals in both artifacts. Source signals: `brain-pdf`, `render`, `brain`, `publication-quality`, `prerequisite`, `gstack`, `make-pdf`, `invocation`.
- The visuals are local screenshots of the actual Markdown artifacts in a fixed 1200 × 800 evidence canvas, not recreated product mockups. Raw JSON artifacts and request records are retained in the research directory.
Do not over-read this demo
- This is one controlled demonstration per condition, not a multi-run statistical benchmark; the model is stochastic.
- Character, structure, and keyword counts show observable differences but cannot by themselves prove correctness, originality, or business impact.
- The task is a representative test designed for repeatability, not every real-world use of the Skill; rerun after a material source change.
- Editorial review
- SkillSignal editorial
- Runner
- Cursor Agent 2026.08.04-aaa8809
- Model
- gpt-5.3-codex-low
- Refresh due
- 2026-11-18
- Reviewed commit
- 07f5d28dcfe1b117cfd1a2b5d57c9fe77efc74ee
- Test snapshot
- d35c9c9e441e6cfc86dd5e84b0b168c6b18ee775
Compatibility matrix
Platform support, with evidence labels
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
Inspect first. Install second.
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/garrytan/gbrain --skill "plugin/skills/brain-pdf"Inspect the Agent Skill "brain-pdf" from https://github.com/garrytan/gbrain/blob/9dadfb97308825f246d6d0534486affad71f211b/plugin/skills/brain-pdf/SKILL.md at commit 9dadfb97308825f246d6d0534486affad71f211b. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
What the source asks the agent to do
- 01
Workflow
Review the “Workflow” section in the pinned source before continuing.
Review and apply the “Workflow” source section. - 02
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.
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. - 03
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 TelegramDelivering a strategic-reading playbook as a clean readProducing a briefing or report with running headers and page numbers - 04
Prerequisite: gstack make-pdf
This skill depends on the gstack make-pdf binary at:
This skill depends on the gstack make-pdf binary at: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: - 05
Invocation
bash SLUG="path/to/page" P="$HOME/.claude/skills/gstack/make-pdf/dist/pdf"
bash SLUG="path/to/page" P="$HOME/.claude/skills/gstack/make-pdf/dist/pdf"
Permission review
Static risk signals and limitations
Reads files
The documentation asks the agent to read local files, directories, or repositories.
# 2. Get the raw markdown. Two paths: read from the brain repo (if userEvidence record
Why each signal appears
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 98/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 29,034 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | tested outcome page | Tested | Generated or reviewed according to the visible evidence level |
Pinned source
Provenance and original SKILL.md
- Repository
- garrytan/gbrain
- Skill path
- plugin/skills/brain-pdf/SKILL.md
- Commit
- 9dadfb97308825f246d6d0534486affad71f211b
- License
- MIT
- Collected
- 2026-08-25
- Default branch
- master
View the original SKILL.md
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 > "$RAW" # whatever flag exposes raw body
fi
# 3. Strip YAML frontmatter — sed: skip the opening '---' through the
# closing '---' (lines 1..N), then keep everything after.
CLEAN=$(mktemp /tmp/brain-page-clean-XXXXXX.md)
sed '1{/^---$/!q}; /^---$/,/^---$/d' "$RAW" > "$CLEAN"
# 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, deliver via the agent's preferred channel:
- Telegram: use the
messagetool withfilePath="/tmp/<slug>.pdf"attachment. NEVER use rawMEDIA:tags — they fail silently. - Email: attach via the host's email tool.
- Direct file response: print the PDF path; the user can pull it manually.
Always include the brain page link in the delivery message so the user can also see it on GitHub / locally. The PDF is a rendering; the source is the artifact.
Anti-Patterns
- ❌ Generating a PDF without first confirming the brain page exists. No source = no PDF.
- ❌ Skipping the frontmatter strip. The renderer dumps frontmatter as raw text on the first page; ugly.
- ❌ Skipping emoji sanitization. Emoji that don't map to the rendering
font show up as
□boxes. - ❌ Adding
--coveror--tocby default. Off unless asked. - ❌ Using raw
MEDIA:tags for Telegram delivery. Use themessagetool withfilePath.
Related skills
skills/book-mirror/SKILL.md— produces a brain page that's a natural input to brain-pdf (chapter-by-chapter personalized analysis).skills/strategic-reading/SKILL.md— same shape, problem-lens variant.skills/publish/SKILL.md— share brain pages as password-protected HTML (different rendering target).
Contract
This skill guarantees:
- Routing matches the canonical triggers in the frontmatter.
- Output written under the directories listed in
writes_to:(when applicable). - Conventions referenced (
quality.md,brain-first.md,_brain-filing-rules.md) are followed. - Privacy contract preserved: no real names, no fork-specific filesystem path literals, no upstream-fork references.
The full behavior contract is documented in the body sections above; this section exists for the conformance test.
Output Format
The skill's output shape is documented inline in the body sections above (see "Output", "Brain page format", or equivalent). The literal section header here exists for the conformance test (test/skills-conformance.test.ts).
Frequently asked questions
What to verify before installation and use
What does the brain-pdf source document cover?
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.
How do I install brain-pdf?
The source record exposes this install command: npx skills add https://github.com/garrytan/gbrain --skill "plugin/skills/brain-pdf". Inspect the command and pinned source before running it.
Which permission-related actions were detected?
Static rules flagged read-files in the source; the page lists the matching lines and excerpts.
Alternatives
Compare before choosing
vasilyu1983/AI-Agents-public
qa-testing-ios
Guides iOS testing with XCTest, XCUITest, Swift Testing, simctl, and xcresult. Use when choosing destinations, controlling flakes, or parsing test artifacts for native apps.
NVIDIA/skills
rtvi-cv-customize-model
How to swap the DeepStream CV detection model in the VSS Alerts Blueprint verification (2d_cv) mode - covers ONNX export, custom bbox parsers, compose mount gotchas, nvinfer config, runtime TRT engine build, deployment, and a segmentation-capable model addendum handoff.
vasilyu1983/AI-Agents-public
research-git
Scans public GitHub repos for agent skills, dev practices, and code patterns. Use when enriching skills, setting team policy, or researching a build domain.
CALLE-AI/awesome-phone-call-agents
dollar-consent-first-callback
Place one consent-first CALL-E callback after a local safety gate has already blocked an extreme-risk developer action, so a known project owner can say stop or request normal review without granting the agent destructive permission.