Skip to content

Frontmatter Guard

Validate and safely repair YAML frontmatter on gbrain brain pages, with user-approved fixes.

Repository
garrytan/gbrain
Stars
31,447
Licence
MIT
Files
1 file

What it does

This skill teaches an agent to check the metadata header (the YAML block between --- lines) at the top of Markdown pages in a gbrain knowledge store. It flags common breakages such as missing closing markers, nested quotes, slug mismatches, null bytes and parse failures, and explains why sync held a file back from importing. It can preview fixes with gbrain's repair command and only apply them after the user approves the exact changes, keeping .bak backups.

Great for

  • Developers maintaining a gbrain knowledge base who see sync reporting held files
  • Teams where agents or scripts write Markdown pages with YAML frontmatter and need validation before import

Skip it if

  • Users who do not run gbrain: the commands assume its CLI and source registry are installed, so the skill gives little value elsewhere
  • Unattended bulk repair: applying repairs rewrites the user's files and the skill requires explicit approval for each apply, so it is risky to automate without review

Try asking

  • “Check frontmatter on my brain pages and tell me what is broken”
  • “Why was this file held by sync, and how do I fix it?”
  • “Preview a frontmatter repair for source notes and show me the diff before applying”
  • “Validate this generated page's frontmatter before I write it to the brain”
Step-by-step guide: how to use Frontmatter GuardInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 1 original files, the MIT licence and an attribution note.

    frontmatter-guard.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip frontmatter-guard.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip frontmatter-guard.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Run the read-only audit or the first repair pass before any apply, and review the diff yourself
  • For agent-written pages, validate generated content with the stdin check before writing to disk, and build frontmatter with a YAML serializer rather than string interpolation

What's inside

  • SKILL.md

Redistributed unmodified from garrytan/gbrain under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.