본문으로 건너뛰기
Skillpedia
문서화31k · #9302

frontmatter-guard

하는 일

이 스킬은 각 브레인 페이지의 숨겨진 머리말 부분에 실수가 있는지 확인합니다. 미리 보기를 승인하면 흔한 오류는 자동으로 고칠 수 있습니다.

사용하는 경우

  • ✓브레인 페이지가 동기화되지 않거나 검색 결과가 깨져 보일 때.
  • ✓큰 가져오기 전에 모든 페이지의 머리말 오류를 확인하고 싶을 때.
  • ✓페이지에 닫는 줄이 없거나, 따옴표가 중첩되었거나, 제목이 파일 이름과 맞지 않을 때.

스킬 링크

https://github.com/garrytan/gbrain/blob/master/plugin/skills/frontmatter-guard/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/garrytan/gbrain/blob/master/plugin/skills/frontmatter-guard/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“내 브레인 페이지에서 깨진 머리말 정보를 모두 확인하고, 적용하기 전에 고침 사항을 미리 보여 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 각 페이지를 표준 점검 항목과 비교합니다. 각 문제를 설명한 뒤, 백업을 만들고 내가 미리 보기를 승인한 경우에만 수정을 적용합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Frontmatter Guard Skill

Convention: see skills/conventions/quality.md for citation rules; this skill is structural validation, not citation auditing.

Contract

This skill guarantees:

  • Every brain page is scanned against the eight canonical frontmatter validation classes
  • Mechanical errors (nested quotes, missing closing ---, null bytes, slug mismatch) are auto-repairable on demand with .bak backups
  • Validation logic is shared with gbrain doctor's frontmatter_integrity subcheck — single source of truth
  • Reports per source (gbrain is multi-source since v0.18.0); never silently audits the wrong root
  • Files sync holds are explained from their hold record (code, reason, key, line, fix) and fixed only through a previewed, hash-bound repair the user approved

Why This Exists

Brain pages pile up over months. Agents write them with malformed frontmatter:

  • Missing closing --- (entity detector bugs)
  • Unstructured YAML in meeting pages (ingestion bugs)
  • Slug mismatches (path renames not propagated)
  • Null bytes (binary corruption from copy-paste accidents)
  • Nested double quotes in titles (title: "Alice "Ace" Example")

Without a guard, these accumulate silently until gbrain sync chokes or search returns garbage. The guard makes the failure visible at audit time and trivially fixable.

Write brain files safely (do this first)

  • Write pages through put_page / capture (MCP or gbrain put). gbrain serializes frontmatter itself, so the file on disk is always valid YAML.

  • A script or agent that writes Markdown files directly must build frontmatter with a YAML serializer (yaml.dump, js-yaml dump), never by string interpolation. title: ${title} breaks as soon as a title contains : , #, quotes or a newline.

  • Check generated content before writing it, without touching disk:

    printf '%s' "$content" | gbrain frontmatter validate --stdin --path notes/2026-10-04-digest.md
    

    Exit 1 means fix it first. The default is the strict producer rule: YAML gbrain could still import by quoting a value fails too, because other tools reject it. --importable answers the narrower question "would sync hold it?".

  • Never write a key gbrain reads for access or identity (visibility, derived_from, slug, type, id, source_id) from untrusted text.

Held files: read them, then fix them

A file sync cannot import without guessing is held: the rest of the source still syncs, a new file has no page yet, and an existing page keeps its last good revision and refuses put_page until the file is repaired (do not retry the write). Where holds show up: sync output (Held <path>: <code> … Next: <command>), gbrain sources status <id> (--json: git_holds.items[]), doctor git_held_files, get_page file_held, and search hits marked stale.

Each hold record carries code, reason, key, line, message (location only, never the value), fix (exact argv) and docs. Act on reason:

Hold What to do
invalid_frontmatter / yaml_parse Preview gbrain repair frontmatter --source <id>; usually needs_review with the exact line to fix by hand.
invalid_frontmatter / needs_interpretation Preview with --include-ambiguous, show the user each per-file diff, apply only what they approve.
invalid_frontmatter / ambiguous_identity_key or ambiguous_protected_key; visibility_noncanonical Never guess. Show the user the line; they decide the one value (visibility decides who can read the page; page privacy reads only visibility: private, lowercase on its own line).
frontmatter_slug_conflict Remove the slug: line or move the file; the repair proposes removing it under --include-ambiguous.
file_too_large The file is over the fixed page limit (24 MiB for Markdown, 5 MB for code); every page under it is searchable, so never split one that fits. Ask the user to add it to sync.exclude, or to split it into files under the limit. A smaller page an MCP transport refused goes by file instead (docs/guides/memory-boundaries.md#large-page-limits).
content_rejected The user chose content_sanity.junk_disposition=reject; ask before changing it.

The fix flow (walkthrough with real output: docs/guides/repair.md#held-files):

gbrain sources status <id>                                  # what is held and why
gbrain repair frontmatter --source <id>                     # pass 1: safe quotin
자주 묻는 질문

묻지 않고 페이지를 바꾸나요?

아닙니다. 수정 사항은 먼저 미리 보기로 보여 주며, 백업도 보관합니다.

어떤 종류의 오류를 잡아내나요?

닫는 줄 누락, 중첩된 따옴표, 이름 불일치, 빈 머리말, 손상된 문자를 잡아냅니다.

동기화가 일부 파일을 건너뛰는 이유는 무엇인가요?

스킬은 기록에 따라 각 보류 사유를 설명하고, 승인된 수정으로만 고칩니다.

상세 정보

작성자의 원본 설명

Validate and auto-repair YAML frontmatter on brain pages. Catches malformed pages before they enter the brain (missing closing ---, nested quotes, slug mismatches, null bytes, empty frontmatter, YAML parse failures), explains files sync holds instead of importing, and drives the previewed `gbrain repair frontmatter` fix. Wraps the `gbrain frontmatter` CLI for agent-driven workflows.

repo: garrytan/gbrain

인기도

GitHub 스타
31k
순위
#9302
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬