# File Watcher Setup

> File Watcher Setup is an Agent Skill for development published in the a5c-ai/babysitter repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Set up cross-platform file system watching with debouncing and efficient change detection

- Skill name: `file-watcher-setup`
- Category: [Development](https://www.openparable.com/skill/development/1)
- Source: https://github.com/a5c-ai/babysitter/blob/HEAD/library/specializations/desktop-development/skills/file-watcher-setup/SKILL.md
- Repository: a5c-ai/babysitter (1,548 GitHub stars when collected)

## SKILL.md

# file-watcher-setup

Set up cross-platform file system watching with debouncing, efficient change detection, and proper resource management.

## Capabilities

- Watch files and directories
- Configure debouncing
- Handle recursive watching
- Filter file types
- Detect add/change/delete events
- Handle watcher errors
- Resource cleanup

## Input Schema

```json
{
  "type": "object",
  "properties": {
    "projectPath": { "type": "string" },
    "watchLibrary": { "enum": ["chokidar", "native", "nsfw"] },
    "debounceMs": { "type": "number", "default": 300 }
  },
  "required": ["projectPath"]
}
```

## Chokidar Example

```javascript
const chokidar = require('chokidar');

const watcher = chokidar.watch('/path/to/watch', {
    ignored: /(^|[\/\\])\../,
    persistent: true,
    ignoreInitial: true,
    awaitWriteFinish: {
        stabilityThreshold: 300,
        pollInterval: 100
    }
});

watcher
    .on('add', path => console.log(`Added: ${path}`))
    .on('change', path => console.log(`Changed: ${path}`))
    .on('unlink', path => console.log(`Removed: ${path}`));
```

## Related Skills

- `file-dialog-abstraction`
- `file-system-integration` process

---

Source: https://www.openparable.com/skill/development/file-watcher-setup (OpenParable). Cite the canonical URL above.
