To your question about blocked vs please-don't: I'd add a middle tier. Claude Code permissions have an "ask" list next to "deny", and for WordPress that's where the reversible-but-visible commands fit: wp plugin deactivate, wp plugin update, wp theme activate, wp search-replace, and wp user / wp option update (your rule about admin users and where email goes). None of them destroy data, but each one changes what visitors or the client see the moment it runs.
The deactivate one matters most for your triage order. "Isolate suspect plugins" on production means turning plugins off for every visitor, including checkout, so I'd want a prompt there every time, and ideally do the halving on staging or in a way that only affects your own session.
Good point — the ask list is where the reversible-but-visible operations belong in my setup too, things like plugin activation or option updates. Keeping the deny list short matters: once it gets long, I stop trusting my own reading of it.
The distinction that stuck with me is "CLAUDE.md works by instruction, not enforcement" — the PreToolUse hook as the actual teeth. Blocking edits to wp-config.php but not reads is a good example of that: during triage Claude needs to read the config, and denying that would just push the agent to guess. The work-log section is the other keeper for me, especially recording what was deliberately not changed and why. Has a hook ever blocked something legitimate mid-session and forced you to narrow the pattern further, or has the deny list mostly stayed as written?
The deny list has mostly stayed as written — it only covers irreversible, data-destroying operations, and normal maintenance work rarely needs those, so false positives are rare.
rm -rf is the one that gets caught, since it shows up in ordinary cleanup too. When that happens I don't loosen the pattern; I check the path and run it manually. Same idea with wp-config.php: reads are constant during triage, so only edits are blocked.
Permissions alone, honestly — and only because my projects are small and solo, so reviewing the diff before anything runs has been my whole safety net. It's not a system, it's a habit, and your rm -rf example is exactly the case where a habit fails: cleanup commands show up in ordinary work, so a written rule would get waved through. The part I'd copy first is the narrow-pattern PreToolUse hook for destructive commands — the "block edits to wp-config.php, not reads" distinction is the model I'd steal for anything irreversible.
That's a fair way to put it — a habit works until the day it doesn't, and cleanup is exactly where attention is lowest. If you do add the hook, starting with just the destructive-command patterns keeps it painless. Thanks for the thoughtful comments.
Blocking edits to wp-config.php while allowing reads is the right split — during triage the agent needs to read the config, and denying reads would just push it to guess. The php -l hook is the cheap win here, since a syntax error surfaces in the session instead of on staging.
Exactly — blocking reads on wp-config just pushes Claude to guess, which is worse. The php -l hook is the cheapest win in the whole setup, it catches typos before anything deploys.
A technologist working in automation. Here I write up what I actually learn building tools, engineering AI agents, and keeping systems running, along with the workflows and habits that stick.
A useful test for this hook is to feed it variants of the same destructive operation: different capitalization, extra whitespace, or a command invoked through another script. The literal Bash substring checks won't catch all of those. I'd treat them as a tripwire and keep production credentials and write access separate from the agent's ordinary troubleshooting environment.
Good call — case and whitespace variants are exactly how a pattern gets bypassed. I'll add a few of those to the test list, plus the run-it-through-another-script case. Thanks for the concrete test ideas.
Thanks — glad the nudge vs teeth split landed. The rm -rf exit 2 case is the one I care about most, since that's the mistake that actually costs a production site.
We're a place where coders share, stay up-to-date and grow their careers.
To your question about blocked vs please-don't: I'd add a middle tier. Claude Code permissions have an "ask" list next to "deny", and for WordPress that's where the reversible-but-visible commands fit:
wp plugin deactivate,wp plugin update,wp theme activate,wp search-replace, andwp user/wp option update(your rule about admin users and where email goes). None of them destroy data, but each one changes what visitors or the client see the moment it runs.The deactivate one matters most for your triage order. "Isolate suspect plugins" on production means turning plugins off for every visitor, including checkout, so I'd want a prompt there every time, and ideally do the halving on staging or in a way that only affects your own session.
Good point — the ask list is where the reversible-but-visible operations belong in my setup too, things like plugin activation or option updates. Keeping the deny list short matters: once it gets long, I stop trusting my own reading of it.
The distinction that stuck with me is "CLAUDE.md works by instruction, not enforcement" — the PreToolUse hook as the actual teeth. Blocking edits to wp-config.php but not reads is a good example of that: during triage Claude needs to read the config, and denying that would just push the agent to guess. The work-log section is the other keeper for me, especially recording what was deliberately not changed and why. Has a hook ever blocked something legitimate mid-session and forced you to narrow the pattern further, or has the deny list mostly stayed as written?
Thanks for reading closely.
The deny list has mostly stayed as written — it only covers irreversible, data-destroying operations, and normal maintenance work rarely needs those, so false positives are rare.
rm -rfis the one that gets caught, since it shows up in ordinary cleanup too. When that happens I don't loosen the pattern; I check the path and run it manually. Same idea with wp-config.php: reads are constant during triage, so only edits are blocked.Do you use a blocked list, or permissions alone?
Permissions alone, honestly — and only because my projects are small and solo, so reviewing the diff before anything runs has been my whole safety net. It's not a system, it's a habit, and your rm -rf example is exactly the case where a habit fails: cleanup commands show up in ordinary work, so a written rule would get waved through. The part I'd copy first is the narrow-pattern PreToolUse hook for destructive commands — the "block edits to wp-config.php, not reads" distinction is the model I'd steal for anything irreversible.
That's a fair way to put it — a habit works until the day it doesn't, and cleanup is exactly where attention is lowest. If you do add the hook, starting with just the destructive-command patterns keeps it painless. Thanks for the thoughtful comments.
Blocking edits to wp-config.php while allowing reads is the right split — during triage the agent needs to read the config, and denying reads would just push it to guess. The php -l hook is the cheap win here, since a syntax error surfaces in the session instead of on staging.
Exactly — blocking reads on wp-config just pushes Claude to guess, which is worse. The php -l hook is the cheapest win in the whole setup, it catches typos before anything deploys.
A useful test for this hook is to feed it variants of the same destructive operation: different capitalization, extra whitespace, or a command invoked through another script. The literal Bash substring checks won't catch all of those. I'd treat them as a tripwire and keep production credentials and write access separate from the agent's ordinary troubleshooting environment.
Good call — case and whitespace variants are exactly how a pattern gets bypassed. I'll add a few of those to the test list, plus the run-it-through-another-script case. Thanks for the concrete test ideas.
CLAUDE.md as a nudge and the hook as the teeth is the right split. the exit-2 block on rm -rf is the part that actually protects the live site.
Thanks — glad the nudge vs teeth split landed. The rm -rf exit 2 case is the one I care about most, since that's the mistake that actually costs a production site.