スキル一覧に戻る
prichodko

watch-dir

by prichodko

0🍴 0📅 2026年1月19日
GitHubで見るManusで実行

SKILL.md


name: watch-dir description: Watch directories for file changes using Node.js fs.watch. Use when monitoring files, detecting changes, or building watch-based workflows.

Watch Directory

Watch directory and subdirectories for changes using fs.watch.

CLI

.claude/skills/watch-dir/watch.ts [dir]

Watches dir (default: current) recursively. Outputs event: path on changes. Ctrl-C to stop.

Code Examples

Basic (recursive)

import { watch } from "fs";

const watcher = watch("./src", { recursive: true }, (event, path) => {
  console.log(`${event}: ${path}`);
});

Async iterator

import { watch } from "fs/promises";

const watcher = watch("./src", { recursive: true });
for await (const { eventType, filename } of watcher) {
  console.log(`${eventType}: ${filename}`);
}

Cleanup on SIGINT

import { watch } from "fs";

const watcher = watch("./src", { recursive: true }, (event, path) => {
  console.log(`${event}: ${path}`);
});

process.on("SIGINT", () => {
  watcher.close();
  process.exit(0);
});

Events

  • rename: file created, deleted, or renamed
  • change: file content modified

Notes

  • recursive: true required for subdirectories
  • import.meta.dir = current file's directory (bun only)
  • call watcher.close() to stop watching

スコア

総合スコア

50/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です