Skills Agentes

Brain Pdf

Genera un PDF de calidad de publicación desde cualquier brain page usando el binario make-pdf de gstack; la brain page siempre es la fuente de verdad, el PDF es solo una renderización.

Estrellas
28.9k

en todo el repo

Actividad
42

0–100, la ruta de este skill

Actualizado
hace 3 meses

último commit aquí

Commits
0

últimos 90 días

Contexto
1.7k tok

58 tok en reposo

Paquete
2 archivos

7 KB

Instalar

Funciona con cualquier agente que lea SKILL.md

npx -y skills add garrytan/gbrain --skill brain-pdf --agent claude-code

Se instala solo en este repositorio.

Este skill reads environment config.

Qué hace

  • Renderiza una brain page en PDF de calidad de publicación usando el binario gstack make-pdf
  • Elimina el frontmatter YAML antes de renderizar para evitar que se vuelque como texto crudo
  • Sanitiza emojis y aplica encabezados de página y numeración
  • Entrega el PDF por Telegram, email o como ruta de archivo directa

Úsalo cuando

  • Compartir un book mirror personalizado por email o Telegram
  • Entregar un playbook de lectura estratégica como lectura limpia
  • Producir un briefing o reporte con encabezados y numeración de página
  • Archivar un ensayo largo en formato portátil

No lo uses cuando

  • El binario gstack make-pdf no está instalado en $HOME/.claude/skills/gstack/make-pdf/dist/pdf

Qué lo activa

Di cualquiera de estas frases y el agente debería cargar este skill.

  • Haz un pdf de esta brain page
  • Convierte esta página de brain a pdf
  • Publica esta página como pdf
  • Exporta esta brain page

SKILL.md

En inglés

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 message tool with filePath="/tmp/<slug>.pdf" attachment. NEVER use raw MEDIA: 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 --cover or --toc by default. Off unless asked.
  • ❌ Using raw MEDIA: tags for Telegram delivery. Use the message tool with filePath.

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).

Reproducido de garrytan/gbrain bajo licencia MIT. Leer esta página en markdown.

Archivos

2 archivos en el paquete. Solo se lee SKILL.md al activarse — las referencias se cargan si el skill decide que las necesita.

Antes de instalar

Requiere el binario gstack make-pdf instalado, junto con las fuentes fonts-liberation y fonts-noto-cjk.

Necesita en el PATH:sed

Variables de entorno:BRAIN_DIRCLEANSLUG

Detalles

Creador
garrytan
Categoría
Documentos
Licencia
MIT
Recursos incluidos
Incluye scripts o referencias
Repositorio
garrytan/gbrain
Código fuente
Ver SKILL.md

Etiquetas

Más de garrytan/gbrain

Este repo incluye 75 skills. Si instalas uno, normalmente ya tienes los demás.

Setup

28.9k

Configura GBrain con auto-aprovisionamiento de Supabase o PGLite, inyección en AGENTS.md y primera importación.

Costo de contexto al activarse
7.4k tok
Tamaño del paquete
1 archivo
Última actualización
hace 4 días
bases de datos

Chequeos de salud del brain: aplicación de back-links, auditoría de citas, validación de filing, detección de info obsoleta, páginas huérfanas y benchmarks.

Costo de contexto al activarse
5k tok
Tamaño del paquete
1 archivo
Última actualización
hace 4 días
productividad

Migra un brain de gbrain-base a la taxonomía de 14 tipos canónicos de gbrain-base-v2 usando gbrain onboard --check y el handler Minion unify-types.

Costo de contexto al activarse
3.2k tok
Tamaño del paquete
1 archivo
Última actualización
hace 5 días
bases de datos

Cuándo y qué recuperar: abre la página del brain de una entidad relevante antes de responder desde memoria.

Costo de contexto al activarse
740 tok
Tamaño del paquete
1 archivo
Última actualización
hace 1 hora
productividad

Operaciones del brain: búsqueda primero, ciclo leer-enriquecer-escribir, atribución de fuentes, enriquecimiento ambiental y back-linking. Leer antes de cualquier interacción con el brain.

Costo de contexto al activarse
2.6k tok
Tamaño del paquete
1 archivo
Última actualización
hace 3 días
productividad

Importa exports de ChatGPT, Claude y Perplexity y transcripciones de sesiones como páginas fechadas en conversations/, valida y extrae hechos, y mantiene el archivo sin huecos con detección y backfill.

Costo de contexto al activarse
5k tok
Tamaño del paquete
2 archivos
Última actualización
hace 4 días
productividad

Skills relacionados

Toma un libro (EPUB/PDF) y genera un análisis personalizado capítulo a capítulo: cada capítulo se conserva en detalle y se refleja en la vida real del lector usando el contexto de su brain.

Costo de contexto al activarse
6.5k tok
Tamaño del paquete
2 archivos
Última actualización
hace 9 días
documentos

Audita y corrige el formato de citas en las páginas del brain, asegurando que cada hecho tenga [Source: ...]; resuelve referencias a tweets sin URL vía la API de X.”

Costo de contexto al activarse
1.5k tok
Tamaño del paquete
2 archivos
Última actualización
hace 3 meses
documentos

Reglas de decisión para archivar páginas nuevas del brain según el tema principal, no el formato ni la fuente. Referencia para todas las skills de escritura.

Costo de contexto al activarse
407 tok
Tamaño del paquete
1 archivo
Última actualización
hace 4 meses
documentos