
File Watcher
- 48 installs
- 84 repo stars
- Updated January 28, 2026
- aidotnet/moyucode
file-watcher is a Claude Code skill that watches files and directories for changes and can trigger a command on each change.
About
file-watcher is a Claude Code skill that watches files and directories for changes using a bundled Python script based on the watchdog library. A developer points it at a directory or file and it triggers on modifications, optionally filtering by glob pattern or running a command such as a build. It is useful for auto-running builds or tests as source files change.
- Watches directories or single files for changes
- Supports glob pattern filters like *.py
- Runs a shell command on change (e.g. npm run build)
File Watcher by the numbers
- 48 all-time installs (skills.sh)
- Ranked #1,098 of 2,715 Automation & Workflows skills by installs in the Skillselion catalog
- Data as of Jul 28, 2026 (Skillselion catalog sync)
file-watcher capabilities & compatibility
- Capabilities
- file watching · change detection · build automation
- Use cases
- devops
- Pricing
- Free
What file-watcher says it does
Watch files and directories for changes with event callbacks, pattern filtering, and action triggers.
python scripts/file_watcher.py ./src/ --exec "npm run build"
npx skills add https://github.com/aidotnet/moyucode --skill file-watcherAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 48 |
|---|---|
| repo stars | ★ 84 |
| Last updated | January 28, 2026 |
| Repository | aidotnet/moyucode ↗ |
What it does
Watch a source directory and run a build or notification command whenever files change.
When should I use this skill?
A developer needs to monitor files and react to change notifications.
What you get
Files are watched and a chosen command runs automatically on each change.
By the numbers
- 4 usage modes: watch directory, pattern filter, exec-on-change, watch single file
Files
File Watcher Tool
Description
Watch files and directories for changes with event callbacks, pattern filtering, and action triggers.
Trigger
/watchcommand- User needs to monitor files
- User wants change notifications
Usage
# Watch directory
python scripts/file_watcher.py ./src/
# Watch with pattern filter
python scripts/file_watcher.py ./src/ --pattern "*.py"
# Watch and run command on change
python scripts/file_watcher.py ./src/ --exec "npm run build"
# Watch specific file
python scripts/file_watcher.py config.jsonTags
watch, files, monitor, events, automation
Compatibility
- Codex: ✅
- Claude Code: ✅
#!/usr/bin/env python3
"""
File Watcher Tool
Based on: https://github.com/gorakhargosh/watchdog
Usage:
python file_watcher.py ./src/
python file_watcher.py ./src/ --pattern "*.py"
"""
import argparse
import fnmatch
import os
import subprocess
import sys
import time
from pathlib import Path
def get_file_info(path):
"""Get file modification time and size."""
try:
stat = os.stat(path)
return (stat.st_mtime, stat.st_size)
except:
return None
def watch_directory(path, pattern=None, exec_cmd=None, interval=1):
"""Watch directory for changes."""
path = Path(path)
file_states = {}
def scan_files():
files = {}
if path.is_file():
files[str(path)] = get_file_info(path)
else:
for root, dirs, filenames in os.walk(path):
for filename in filenames:
if pattern and not fnmatch.fnmatch(filename, pattern):
continue
filepath = os.path.join(root, filename)
files[filepath] = get_file_info(filepath)
return files
print(f"Watching: {path}")
if pattern:
print(f"Pattern: {pattern}")
print("Press Ctrl+C to stop\n")
file_states = scan_files()
try:
while True:
time.sleep(interval)
current = scan_files()
# Check for changes
for filepath, info in current.items():
if filepath not in file_states:
print(f"[CREATED] {filepath}")
if exec_cmd:
subprocess.run(exec_cmd, shell=True)
elif file_states[filepath] != info:
print(f"[MODIFIED] {filepath}")
if exec_cmd:
subprocess.run(exec_cmd, shell=True)
for filepath in file_states:
if filepath not in current:
print(f"[DELETED] {filepath}")
file_states = current
except KeyboardInterrupt:
print("\n✓ Stopped watching")
def main():
parser = argparse.ArgumentParser(description="Watch files for changes")
parser.add_argument('path', help='Path to watch')
parser.add_argument('--pattern', '-p', help='File pattern (e.g., *.py)')
parser.add_argument('--exec', '-e', dest='exec_cmd', help='Command to run')
parser.add_argument('--interval', '-i', type=float, default=1, help='Check interval')
args = parser.parse_args()
watch_directory(args.path, args.pattern, args.exec_cmd, args.interval)
if __name__ == "__main__":
main()