From safety-hooks-base
Universal Claude Code safety hooks for the Orryx Group. Triggers when setting up a new repo's .claude/settings.json, when reviewing existing hook configurations, or when secret leakage / dangerous bash patterns need to be blocked at the tool-call boundary. Installs PreToolUse bash blocklist, PostToolUse file blocklist (.env / .pem / terraform.tfstate / *-accessKeys.csv), and UserPromptSubmit safety-policy check.
How this skill is triggered — by the user, by Claude, or both
Slash command
/safety-hooks-base:safety-hooks-baseThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Every Orryx repo installs this hook bundle. Three hooks fire at three boundaries: **PreToolUse** blocks dangerous bash patterns; **PostToolUse** blocks writes to secret-bearing files (`.env`, `.pem`, `terraform.tfstate`, `*-accessKeys.csv`); **UserPromptSubmit** scans for risky patterns in the user's prompt before the session begins. Merged from Triora's `.claude/settings.json` and Pillarworks'...
Every Orryx repo installs this hook bundle. Three hooks fire at three boundaries: PreToolUse blocks dangerous bash patterns; PostToolUse blocks writes to secret-bearing files (.env, .pem, terraform.tfstate, *-accessKeys.csv); UserPromptSubmit scans for risky patterns in the user's prompt before the session begins. Merged from Triora's .claude/settings.json and Pillarworks's bash-safety-check.sh + post-edit-lint.sh + safety-policy.md patterns (Wave 0 audit).
# From the repo root:
claude /plugin install foundation/safety-hooks-base@orryx-group
This adds the hooks to .claude/settings.json (creates the file if absent).
PreToolUse (bash blocklist):
rm -rf /, rm -rf ~, rm -rf $HOME, sudo rmchmod 777 /, blanket chmod on system dirscurl ... | sh, wget ... | sh (untrusted execution)git push --force to main or masterdd if=/dev/... (disk wipes)> /dev/sda*, > /dev/nvme* (direct disk writes)PostToolUse (Edit/Write file blocklist):
**/.env* (except .env.example, .env.template)**/*.pem, **/*.key, **/*.pfx, **/*.p12**/terraform.tfstate*, **/*.tfstate.backup**/*-accessKeys.csv, **/*-credentials.csv**/secrets-*.json, **/pilot_users.json.gitignore if you got here on purposeUserPromptSubmit (safety policy check):
AKIA[A-Z0-9]{16} (AWS access keys), mp_live_* (Magic Patterns), sk_live_* (Stripe), xoxb-* (Slack), eyJ[A-Za-z0-9_-]+\.eyJ (JWT)If a specific hook conflicts with your workflow:
// .claude/settings.json
{
"hooks": {
"safety-hooks-base": {
"preToolUse": "enabled",
"postToolUse": "enabled",
"userPromptSubmit": "disabled"
}
}
}
Document the opt-out reason in .claude/HOOKS-DECISIONS.md (audit trail).
Need an additional pattern blocked? Add to .claude/hooks/post-edit-lint.sh locally — the base hooks check existence of repo-local overrides and call them after the base checks.
| Source | Pattern |
|---|---|
Triora .claude/settings.json | PreToolUse bash blocklist + PostToolUse .env/.pem/terraform.tfstate blocklist + auto-test-suggest |
Pillarworks bash-safety-check.sh | More extensive bash pattern list + colourised error output |
Pillarworks post-edit-lint.sh | Lint-after-edit suggestion |
Pillarworks safety-policy.md | The policy doc reference (now lives in references/safety-policy.md here) |
| Wave 0 audit | New patterns: *-accessKeys.csv, *-credentials.csv, secrets-*.json, pilot_users.json |
chmod 777 ./scripts/install.sh is legitimate, the PreToolUse hook will block it. Override per-hook or add an exception comment..claude/settings.json not be empty — if absent, the plugin creates it with sensible defaults. If present but no hooks block, the plugin appends.D:\orryx-standards\gitignore-snippets\secrets.gitignore — the file patterns this hook reinforcesD:\orryx-audit\WAVE-0-HUMAN-RUNBOOK.md — context: the 3 P0 secret incidents that motivated this hook bundlereferences/safety-policy.md — Pillarworks's safety policy doc (canonical reference)references/triora-hook-bundle.md — Triora's .claude/settings.json hook block (the original)Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub alexmclaren/orryx-knowledge --plugin safety-hooks-base