Skills2026年4月7日·1 分钟阅读

Claude Code Hooks — Automate Your AI Workflow

Built-in automation system for Claude Code. Run shell commands on events like file edits, tool calls, and notifications. Lint on save, auto-test, and more.

What are Claude Code Hooks?

Claude Code Hooks are built-in automation triggers that run shell commands on events like file edits and tool calls. Automatically execute code linting, tests, and validation.

In one sentence: Claude Code's built-in automation system runs lint, tests, and custom validation automatically on file edits and tool calls.

For: Developers who want to automate quality checks in their Claude Code workflow.

Core Features

1. Event Types

PreToolUse, PostToolUse, Notification, Stop, SubagentStop.

2. Tool Matchers

Match specific tools with regex (Edit, Write, Bash, etc.).

3. Common Patterns

Auto-lint, run tests, type-check, block commits without tests.

4. Output Feedback

Hook output is fed back as context to guide Claude's next steps.

FAQ

Q: Will it slow down Claude Code? A: Runs synchronously — keep commands under 2 seconds.

Q: Where does the config file go? A: Project-level .claude/settings.json or global ~/.claude/settings.json.

🙏

来源与感谢

Built into Claude Code by Anthropic

讨论

登录后参与讨论。
还没有评论,来写第一条吧。