File Watcher Setup
March 1, 2026 ยท View on GitHub
Set up a chokidar-based file watcher for: $ARGUMENTS
Instructions
-
Ask the user the following questions interactively (use AskUserQuestion):
- Prompt: "What Claude prompt should run when files change?" (remind them they can use
{{file}}as a placeholder for the changed file path) - Glob filter (optional): "Do you want to filter by file type?" with options like
*.tsx,*.ts,*.css, or no filter - Debounce delay (optional): "How long to wait after the last change before triggering?" with options 200ms, 500ms (default), 1000ms
- Prompt: "What Claude prompt should run when files change?" (remind them they can use
-
Verify the watch path
$ARGUMENTSexists. If it doesn't, warn the user and ask if they want to proceed anyway. -
Ensure
scripts/watch-files.mjsexists. If not, inform the user it needs to be created (it should already exist as part of the file-watcher skill). -
Ensure
chokidaris in devDependencies. If not, runbun add -d chokidar. -
Ensure
package.jsonhas thewatch:filesscript. If not, add it:"watch:files": "node scripts/watch-files.mjs" -
Run a smoke test:
- Start the watcher in the background with the user's chosen options
- Touch a file in the watched path
- Verify the watcher detects the change (check its stdout for the log line)
- Kill the background watcher
-
Print the final command the user can run:
node scripts/watch-files.mjs <path> '<prompt>' [--glob '<pattern>'] [--debounce <ms>]
Skill Reference
See .claude/skills/file-watcher/SKILL.md for full documentation, examples, and troubleshooting.