preflight-check-skill
Defensive toolkit for Claude Code: stop secrets, API keys, and personal data
from leaving your machine — and clean transcripts before you publish.

Usage in a nutshell: run ./install.sh once. From then on the hooks run
automatically — every prompt and tool call is scanned, and secrets/PII are
redacted or blocked before they leave your machine. To scrub text by hand
before publishing, invoke the skill (/preflight-check) or pipe through the CLI:
pbpaste | preflight-check scan | pbcopy # clean whatever's on your clipboard
What this does
Two layers, one detection engine:
- Hook layer (prevention) — runs inside Claude Code as a
UserPromptSubmit
and PreToolUse hook. For prompts: warns or blocks when secrets are detected.
For tool inputs (Bash, Edit, Write): redacts secrets in place before execution.
- Skill layer (cleanup) — a Claude skill you invoke manually when you
want to scrub a transcript, code snippet, or document before publishing
to a blog, LinkedIn post, or workshop material.
Both layers share the same detection core: gitleaks for cloud secrets +
custom validated patterns for PII (Polish, EU, US).
How it works
One detection core, three entry points. A prompt or tool call hits the hook;
text you want to publish goes through the skill/CLI — both call the same
detection core (validated regex + gitleaks in parallel), map findings to
stable [REDACTED_X_NNN] placeholders, and log offsets only (never the values).
The mode decides the final action: redact, block, or warn.

The diagram is interactive — open docs/architecture.html
in a browser to click through each flow step by step and toggle the
default / strict / warn-only modes. Full walkthrough in
docs/architecture.md.
What it detects
| Category | Examples | Validation |
|---|
| Cloud keys | AWS, GCP, Azure, OpenAI, Anthropic, GitHub, Slack, JWT | prefix + format |
| Polish PII | PESEL, NIP, REGON, IBAN PL, dowod osobisty | mod-11, mod-97 checksums |
| EU PII | Email, phone (E.164 + PL), generic IBAN | mod-97 for IBAN |
| US PII | SSN, credit cards | Luhn algorithm |
| Unknown secrets | High-entropy strings (>=4.5 bits, >=32 chars) | planned, not yet implemented |
Checksum validation is the difference between useful detection and noise.
A random 11-digit order number won't be flagged as a PESEL.
Installation
Option 1: Full installation (recommended)
git clone https://github.com/konraddzbik/preflight-check-skill.git
cd preflight-check-skill
./install.sh
The installer will:
- Install Python dependencies (
pyyaml)
- Check for
gitleaks (and offer to install it)
- Register the hook in
~/.claude/settings.json
- Copy the skill to
~/.claude/skills/preflight-check/
Option 2: Claude Code plugin (if preflight-check is on PATH)
# Requires the preflight-check CLI to be installed on PATH first
# (run ./install.sh, or `pip install preflight-check-skill`)
claude plugin marketplace add https://github.com/konraddzbik/preflight-check-skill
claude plugin install preflight-check@preflight-check
This uses the Claude Code plugin system to auto-register the hooks. The plugin
bundles the skill and the hook definitions; the redaction engine itself is the
preflight-check CLI (pip install preflight-check-skill ships that CLI only —
the skill and plugin manifest come from the marketplace/repo).
Test it:
echo "My AWS key is [REDACTED:AWS Access Key]" | preflight-check
# Output: My AWS key is [REDACTED_AWS_ACCESS_KEY_001]
Demo
$ echo "PESEL 99123175313, email [email protected], key [REDACTED:AWS Access Key]" | preflight-check scan
PESEL [REDACTED_PESEL_001], email [REDACTED_EMAIL_001], key [REDACTED_AWS_ACCESS_KEY_001]
$ # Hook on PreToolUse — redacts tool input in place:
$ echo '{"hook_event_name":"PreToolUse","tool_name":"Bash","tool_input":{"command":"echo [REDACTED:AWS Access Key]"}}' \
| preflight-check hook
{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"allow","updatedInput":{"command":"echo [REDACTED_AWS_ACCESS_KEY_001]"}}}