home / skills / aidotnet / moyucode / file-watcher
This skill watches files and directories for changes, with event callbacks, pattern filtering, and optional actions on update.
npx playbooks add skill aidotnet/moyucode --skill file-watcherReview the files below or copy the command above to add this skill to your agents.
---
name: file-watcher
description: 监视文件和目录变化,支持事件回调和过滤。
metadata:
short-description: 监视文件变化
source:
repository: https://github.com/gorakhargosh/watchdog
license: Apache-2.0
---
# File Watcher Tool
## Description
Watch files and directories for changes with event callbacks, pattern filtering, and action triggers.
## Trigger
- `/watch` command
- User needs to monitor files
- User wants change notifications
## Usage
```bash
# 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.json
```
## Tags
`watch`, `files`, `monitor`, `events`, `automation`
## Compatibility
- Codex: ✅
- Claude Code: ✅
This skill watches files and directories for changes and delivers event callbacks, pattern filtering, and optional action triggers. It provides a lightweight, scriptable watcher that can notify on create/modify/delete events and run commands when changes occur. It is built in TypeScript and designed for integration into development workflows and automation pipelines.
The watcher scans specified files or directories and listens for filesystem events. You can supply glob-style patterns to filter which files trigger callbacks. When a matching event occurs, the skill invokes configured callbacks or executes a shell command. It supports single-file targets, whole directories, and recursive watching with debouncing to avoid duplicate triggers.
Can I watch multiple paths at once?
Yes. Provide multiple file or directory paths and the watcher will monitor each target concurrently.
How do I avoid repeated triggers during large saves?
Use debounce or cooldown options to group rapid filesystem events into a single callback or command run.