
Claude Code Mods: Build a Fail-Closed Bash Guard in JS
Summary
Write a Claude Code mod that blocks, asks, and logs risky shell commands, then test it.
On October 1, Anthropic shipped mods for Claude Code, and the developer side of the internet has talked about little else since. A mod is a plugin whose JavaScript or TypeScript functions run inside Claude Code. They can draw panes, rewrite prompts, add commands, and, the part this guide cares about, step into a tool call before it runs and refuse it.
Until now, guarding an agent's shell meant a settings hook: a separate script, fed JSON on stdin, that you hoped exited with the right code. A mod is a function with the event in hand. It can wait for a human to answer a question, write to a store that survives the session, and be unit tested from your terminal without logging in or touching the network.
Keep reading — it's free
Enter your email to keep reading — plus the best of AI & tech, daily. Free, forever.
Already a member? Sign in
Comments
Be the first to comment