Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By laurigatesv2.23.1MITIn 1 marketplace
Blocks Bash commands that bypass built-in tools such as cat or sed -i on repo files, and stops risky ones like reset --hard. Hooks fire automatically on Bash calls and at session end.
Trending plugins
7-day copy clicks
Claude loads one when your task matches it, or you run it by name.
1 critical · 2 cautions to review before installing
A hook runs before every tool call and can block or approve it
A hook runs when Claude uses the Bash tool
A hook runs when Claude writes or edits files
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
1 marketplace, most starred first
Public GitHub repos that commit this plugin as enabled in their Claude Code settings
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Claude Code hooks for enforcing best practices and workflow automation.
This plugin provides pre-built hooks that can be installed in any project to enforce consistent behavior and remind Claude to use the correct tools.
Toggling behavior: every env var that turns a hook on/off or tunes it — across hooks-plugin, git-plugin, and taskwarrior-plugin — is indexed in
docs/feature-flags.md(opt-in / opt-out / tunable, with source pointers). The per-hookToggle:lines below are the deep detail.
A PreToolUse hook that intercepts Bash commands and blocks those that should use built-in tools instead.
Detected Anti-patterns:
| Pattern | Reminder |
|---|---|
cat file | Use Read tool instead |
head/tail file | Use Read tool with offset/limit |
sed -i (repo files; /tmp/scratch targets exempt, #2052 — reachable via a literal path, a cd target, or a variable value, W34 §Signal C) | Use Edit tool instead |
echo/printf > file (repo files; absolute /tmp/scratch destinations exempt, W38) | Use Write tool instead |
cat > file | Use Write tool instead |
timeout cmd | Remove timeout (human approval time exceeds it); append # allow-timeout for genuinely-unbounded processes (#2041) |
| Multi-grep test parsing | Use --reporter=json instead |
The safety blocks (git add -A, git chains, reset --hard, curl | sh, fork
bombs, chmod 777, block-device writes) are in bash-safety.sh, below.
The three write rows share one scratch context: a cd into /tmp, a variable
holding a /tmp path, or a mktemp -d dir (T=$(mktemp -d),
cd "$(mktemp -d)") exempts the write (#2892). The context is decided for the
whole command, so such an assignment exempts every write in it, including a
write to a repo path that never uses the variable; sed -i has carried the
same trade-off since W34. echo/printf > file and sed -i also pass when
every destination is a literal tmp/ or ./tmp/ path (no glob) that
git -C <cwd> check-ignore reports ignored, and the command contains no
cd/pushd/popd. A tracked tmp/ still blocks (#2837). The Claude Code
harness scratchpad under $HOME/tmp/claude-<uid>/…/scratchpad/ counts as
scratch too, as a literal sed -i operand, a cd target, or a variable value;
a plain $HOME/tmp/ path does not (#3525).
echo/printf > file no longer blocks. The command runs and the hook returns
a PreToolUse additionalContext note preferring Write, because a Bash-only edit
is not restored by /rewind. sed -i still blocks, except when every file it
edits was copied with cp earlier in the same command (the mutation-probe
shape cp f tmp/snap && sed -i … f && test; cp tmp/snap f).
The read/write detectors (cat/head/tail, echo/printf/cat writes,
sed -i, task-output reads) are classified structurally via
ast-grep --lang bash — a real parse distinguishes a command from a
string/heredoc-body/pipeline/argument, retiring the regex false-positive
treadmill (#1701/#1721/#1722/#1848/#2052/#2058) and the remote-exec guard
(#1900). They are style nudges that fail open when ast-grep is absent
(no regex twin, #2008); the safety blocks in bash-safety.sh stay pure-regex
and fire in every context. The three read rules additionally require the read to be the
whole command (#2148) — cat f.md blocks, cd repo && cat f.md and
ls d/; head -20 f do not; the write rules are unscoped by that narrowing.
find (#1871), grep/rg (#1909), ls <glob> (#2036), and long pipelines
(5+ pipes from a cat/echo/printf or grep|grep head, #1873) are not
blocked — those redirects were demoted to non-blocking hints in the opt-in
teach hook (bash-antipatterns-teach.sh). See
.claude/rules/hook-block-vs-nudge.md for the block-vs-nudge litigation.
A PreToolUse hook holding the Bash safety blocks, split out of
bash-antipatterns.sh so they can be exported to other harnesses without that
hook's Claude-Code-specific tool advice (#2788). Every detector is pure regex,
fires in every context (sandboxes and subagents included, with or without
ast-grep), and sources no library.
| Pattern | Reminder |
|---|---|
git add -A / git add --all / git add . | Stage specific files by name instead |
Two index-modifying git commands chained with && (git add a && git commit) | One git add -- A B C, then git commit as a separate call (index.lock races) |
git reset --hard | Use git pull, git restore, or git reset --soft instead |
git push -u origin main:feat/x from main | Push without -u |
curl | sh / wget | bash | Download first, review, then execute |
| Fork bombs | Blocked unconditionally |
chmod 777 | Use restrictive permissions (755, 644, 600) |
| Write to block device | Blocked unconditionally |
7-day copy clicks
Plugins from other owners that cover similar ground
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub laurigates/claude-plugins --plugin hooks-plugin