file-watcher

Configure Claude Code hooks to watch files and react to config and dependency changes.

1|Updated May 6, 2026
One-click install
npx skills add https://github.com/surfingalien/FinSurfing --skill file-watcher-surfingalien
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: file-watcher
Source: https://github.com/surfingalien/FinSurfing/tree/main/.claude/skills/file-watcher
Command: npx skills add https://github.com/surfingalien/FinSurfing --skill file-watcher-surfingalien

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers often miss config, env, or dependency changes during a session, leading to stale environments and confusing errors. This Skill sets up reactive workflows that automatically detect file changes and respond to them. ## Core Features & Use Cases - Watch Registration: Register watchPaths via SessionStart and CwdChanged hooks so Claude Code monitors files like .env, package.json, and tsconfig.json. - FileChanged Reactions: Trigger handler scripts when watched files change, such as reminding to run npm install after dependency updates. - Environment Injection: Write variables to CLAUDE_ENV_FILE from CwdChanged or FileChanged hooks to inject env vars into subsequent Bash commands. - Use Case: Watch package.json so that whenever a teammate's pull changes dependencies, the session immediately reminds you to run npm install before continuing. ## Quick Start Set up a file watcher that monitors my .env and package.json files and reminds me to reinstall dependencies when package.json changes.

Frequently Asked Questions about file-watcher

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I watch files for changes in Claude Code?

Register watchPaths in the hookSpecificOutput of a SessionStart or CwdChanged hook using absolute file paths. When a watched file changes, Claude Code fires the FileChanged hook with the file path and event type.

How to auto-run npm install when package.json changes?

Add package.json to your hook's watchPaths, then configure a FileChanged hook with a matcher like ".env|package.json|tsconfig.json" that runs a handler script. The handler can remind you to run npm install or inject environment variables.

Can Claude Code hooks inject environment variables into Bash commands?

Yes, CwdChanged and FileChanged hooks can append export statements to the CLAUDE_ENV_FILE, and those variables become available in subsequent Bash commands. Use this instead of direct exports, which do not persist across commands.

Why is my FileChanged hook not firing?

Watch paths must be absolute paths, and the file must be registered via watchPaths in a SessionStart or CwdChanged hook output. Also verify your matcher pattern uses pipe-separated filenames matching the changed file.

What are the performance limits of file watching hooks?

The watcher uses a 500ms stability threshold and 200ms poll interval. Keep FileChanged handler scripts under 5 seconds to avoid blocking the session workflow.