process: Claude Code hooks and the official security plugin
Back to our planSummary
Make Claude Code check its own work automatically: format and lint each file right after it is edited, block the few commands the rules forbid, and turn on Anthropic's official security plugin for everyone working in this repo.
Summary of the owner's request (2026-10-26, Claude Code session): if something important should be plugged in now, while the project is young, stop all current work, file a few GitHub issues or an epic, and plug in everything that suits the context and the project's aims and will pay off both soon and over time.
Details
Hooks always run; a line in CLAUDE.md can be forgotten. Everything goes in the committed .claude/settings.json, so every session (local and cloud) gets it. CI stays the real gate, so Codex and humans are covered too.
- After each edit (
PostToolUseon Edit and Write): Prettier and ESLint--fixon that one file; errors go back to Claude to fix. Notschere: it takes over a minute; CI and the pre-commit hook keep it. - Before a command (
PreToolUseon Bash): refuse--admin,bypass_rules: true, a push tomain, and committingsrc/payload-types.tswhen it changed only becausenext devrewrote it (this happened on #429). security-guidance@claude-plugins-officialinenabledPlugins: Anthropic's free plugin that checks each edit for risky calls (eval,dangerouslySetInnerHTML, workflow edits) and reviews the diff at commit time. It needs Python 3.8+ (about the plugin, opens in a new tab).
The scripts live in .claude/hooks/, short and tested. This is a policy change (.claude/): the quote above covers it.
Acceptance criteria
- Not done: Editing a badly formatted file gets formatted, and a lint error is reported back, in the same turn.
- Not done: Each forbidden command above is refused with a message saying why.
- Not done: The security plugin loads in a new session.
- Not done:
CLAUDE.md's Claude Code specifics list the hooks and the plugin.
Generated by Claude Code, opens in a new tab