Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

public-export-sanitization

БесплатноЗапускает вложенные скриптыНе проверен

Sanitize internal content before it goes public (repo, blog, talk). Use when publishing, to catch leaked project ids, service-account emails, hostnames…

laurigatesот laurigates★ 61 звезда на GitHub

Об этом скилле

Sanitizing Internal Content Before It Goes Public

When moving content from a private or internal source into a public destination (a public repo, a blog post, a conference talk, a shareable draft), the expensive failure is a silent context leak: an internal cloud project id, a service-account email, an internal hostname, a personal name, or a Markdown link that points back into a private repo. A human reviewer reliably misses one class of these every time, and the miss becomes visible only after it is public.

The judgment (what to keep, how to reword) is yours. The detection is a script: run it, don't re-derive it.

When to Use This Skill

Use this skill when... Use instead when...
Moving internal docs, code, or notes into a public repo, post, or talk Scanning for tokens and keys: git-plugin:git-security-checks (gitleaks)
Checking that an exported doc set has no links back into private sources Checking a doc is readable by a zero-context reader: agent-patterns-plugin:cold-read-gate
Genericizing infrastructure identifiers for a public write-up Verifying a machine-read value is correct: documentation-plugin:docs-verify-machine-facts

The tripwire: run it on every export

bash "${CLAUDE_SKILL_DIR}/scripts/check-public-export.sh" --patterns <org.patterns> <export-tree>

It scans for internal identifiers and for Markdown links that escape the export or are broken. Exit 1 means findings to review; exit 2 is a usage error. Patterns ignore <placeholder> tokens, so a genericized tree comes back clean. Dot-directories such as .claude/ and .github/ are scanned too; only .git/ is skipped.

Built-in patterns are org-neutral only: GCP service-account emails (*.iam.gserviceaccount.com), 12-digit GCP project numbers, and absolute home paths. Your organisation's identifier shapes go in a --patterns file, one label::regex per line (extended regex, # comments allowed), kept wherever your private config lives rather than in the public tree:

# org.patterns
GCP project id (acme-*)::\bacme-[a-z][a-z0-9-]{2,}\b
Internal hostname (corp.example)::\b[a-z0-9-]+\.corp\.example\b
Staff email::\b[a-z0-9._%+-]+@example\.com\b

Without a --patterns file the scan checks only the built-in shapes, so a clean result then says nothing about org-specific identifiers.

Two modes:

  • Pre-export gate (default, strict): scan the export set on its own; any link leaving it is flagged. This is the self-containment gate below.
  • Post-placement verify: once the content sits inside a larger public repo, pass --repo-root <repo> so links to public siblings (../LICENSE, ../other-doc) are allowed and only repo-escaping or broken links flag.

Other options: --names <file> (personal names, which can't be regex'd; seed the list from the source's git authors and access grants; one literal entry per line; only a bare # or # followed by whitespace is a comment line, and a trailing whitespace-#-whitespace tail such as Alice Smith # author is a trailing comment, so #1234 still flags that PR or issue number), --allow <regex> (dismiss a known-benign hit, such as a CSS class that shares a project-id prefix; check the regex does not also hide real ids), --no-links, -q.

It takes one tree per run. Given several paths it scans only the last, and the summary line then reads like a clean sweep of all of them. Loop over the trees instead, and check that each summary names the tree you meant.

No pattern catches private repository names, and they are often the leak that matters most: a repo name is not shaped like an identifier, so no regex can recognise it. Grep for them separately, with the list taken from GitHub rather than from memory:

gh repo list <owner> --visibility private --limit 1000 --json name --jq '.[].name' > /tmp/private-repos.txt
grep -rnoFf /tmp/private-repos.txt <export-tree>

Short repo names match as substrings (a repo named dot matches "two-dot diff"), so read each hit rather than counting them.

It is not a secret scanner. Run gitleaks for tokens and keys; this catches context leakage, a different axis.

The automatic gate on public writes

This plugin's public-repo-leak-gate.sh PreToolUse hook runs the same scanner on its own, at the moment of publication: on git commit, gh pr/gh issue writes, and GitHub MCP writes whose destination repo is public (or whose visibility could not be read). A hit asks before the write runs; private repos and clean text get no output. Two files beside your --patterns file tune it:

  • .claude/public-export.patterns — found by walking up from the destination checkout (or set CLAUDE_PUBLIC_EXPORT_PATTERNS).
  • .claude/public-export.exempt-owners — one GitHub owner per line whose own public repos may carry the org identifiers; they skip the org patterns but keep the built-in shapes (or set `CLAUDE_PUBLIC_EXPORT_
Полный SKILL.md на GitHub

Установить public-export-sanitization в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Bash(bash *)
Read
Grep
Glob
Edit
TodoWrite

Вложенные файлы

scripts/check-public-export.sh

FAQ

Что делает скилл public-export-sanitization?

Sanitize internal content before it goes public (repo, blog, talk). Use when publishing, to catch leaked project ids, service-account emails, hostnames, names, and repo-escaping links.

Как установить скилл public-export-sanitization?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл public-export-sanitization запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить public-export-sanitization с