FileChanged Hook - Claude Code
Fires when watched files change on disk.
FileChanged hooks react to external changes in the project - another editor saved a file, git pulled new commits, a build wrote an artifact.
What it does
You declare paths or patterns to watch. When Claude Code detects a change, the hook fires with the path and the kind of change. It can update the model's context, invalidate caches, or trigger a follow-up action. It's how Claude stays aware of what's happening outside its own edits.
When to use it
- Reacting to lockfile changes to suggest a reinstall.
- Reloading config when
.envor settings files shift. - Notifying Claude when a teammate pushed a fresh branch state.
- Building IDE-like responsiveness in CLI sessions.
Gotchas
- Watching too many paths causes noise. Start narrow.
- FileChanged events can fire during Claude's own edits - be careful not to loop.
- Debounce rapid-fire events (package managers that touch many files at once).
Official docs: https://code.claude.com/docs/en/hooks.md#filechanged
Technical content at the intersection of AI and development. Building with AI agents, Claude Code, and modern dev tools - then showing you exactly how it works.
Get the weekly deep dive
Tutorials on Claude Code, AI agents, and dev tools - delivered free every week.
Was this helpful?




