Skip to content
SprecherEast
Issue 446

process: Claude Code hooks and the official security plugin

Back to our plan
Done
processtoolingpriority: high

Summary

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.

  1. After each edit (PostToolUse on Edit and Write): Prettier and ESLint --fix on that one file; errors go back to Claude to fix. No tsc here: it takes over a minute; CI and the pre-commit hook keep it.
  2. Before a command (PreToolUse on Bash): refuse --admin, bypass_rules: true, a push to main, and committing src/payload-types.ts when it changed only because next dev rewrote it (this happened on #429).
  3. security-guidance@claude-plugins-official in enabledPlugins: 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

See it on GitHub, opens in a new tab