watchdog-file-watcher-patterns
Skill0 starsChanged 7 months agoApache-2.0View on GitHub
Guardrail for Python watchdog adapters that turn filesystem activity into debounced, deduplicated, lifecycle-safe runtime queue events.
In this repository57 other files it gives its agents.
- ai-app-integrationSkill
- anti-llm-frontend-designSkill
- aspnet-core-web-developmentSkill
- async-python-patternsSkill
- browser-game-foundationsSkill
- browser-local-qaSkill
- build-mcp-server-sdk-v2Skill
- canva-design-opsSkill
- check-completionSkill
- cli-tool-creatorSkill
- cloudflare-agents-mcpSkill
- cloudflare-durable-objectsSkill
- cloudflare-workers-platformSkill
- deployment-preview-workflowsSkill
- docx-document-artifactsSkill
- durable-workflow-orchestrationSkill
- dynamic-og-imagesSkill
- eval-auditSkill
- evaluate-ragSkill
- figma-design-to-code-rulesSkill
- fine-tuningSkill
- frontend-product-builderSkill
- game-asset-pipeline-expansionSkill
- game-ui-playtestSkill
- generate-synthetic-dataSkill
- github-pr-ci-opsSkill
- gmail-inbox-opsSkill
- golden-datasetSkill
- huggingface-llm-trainerSkill
- javascript-monorepo-buildsSkill
- linear-issue-managementSkill
- media-generation-transcriptionSkill
- millrace-rs-contract-paritySkill
- minecraft-mod-qa-automationSkill
- notion-workspace-flowsSkill
- openai-docsSkill
- optimize-agentic-cliSkill
- pdf-artifact-workflowSkill
- phaser-2d-game-developmentSkill
- postgres-query-performanceSkill
- product-ui-polish-reviewSkill
- pydantic-v2-patternsSkill
- python-repo-refactoring-hygieneSkill
- rag-corpus-hygieneSkill
- react-next-performance-reviewSkill
- rust-best-practicesSkill
- shadcn-ui-compositionSkill
- skill-evaluation-harnessSkill
- tauri-desktopSkill
- tauri-mcp-cliSkill
- tauri-ptySkill
- tile-pixel-art-transitionsSkill
- train-sentence-transformersSkill
- typer-cli-patternsSkill
- using-dbt-for-analytics-engineeringSkill
- validate-evaluatorSkill
- visual-asset-pipelineSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 9 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 41
Treat created and modified events as "maybe changed" signals.
- Distinctive: line 42
Prefer moved-into-place as the strongest ready signal.
- Distinctive: line 43
Keep callbacks fast: normalize the event, enqueue lightweight work, and return.
- Distinctive: line 48
Do not parse heavy content, sleep, block, or mutate runtime state inside watchdog callbacks.
- Distinctive: line 49
Do not assume editor save behavior, atomic renames, or close events are identical across platforms.
- Distinctive: line 51
Ensure one logical file action produces at most one runtime enqueue inside the configured debounce window.
- Distinctive: line 53
Stop and join observer threads during shutdown without leaving orphans.
- Distinctive: line 75
Add debounce and duplicate suppression before content reads.
- Distinctive: line 90
Start with the watched path and callback in scope.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Watchdog File Watcher Patterns
Purpose
Help agents implement or repair Python watchdog adapters that convert local filesystem activity into stable runtime input events. This skill focuses on observer lifecycle, debounce, duplicate suppression, partial-write safety, queue handoff, and diagnosable shutdown.
Use When
- changing a watchdog-based intake path such as ideas folders, config watch paths, backlog files, or control markers
- debugging duplicate ingestion, partial reads, missed moves, or noisy modified events
- repairing shutdown hangs, leaked observer threads, or callbacks that do too much work
- deciding whether a watcher or simpler polling loop is safer
Do Not Use When
- a simple polling loop is clearly sufficient and lower risk
- the filesystem event should directly mutate runtime state from the callback
- the target is a distributed, remote, or cross-host event ingestion service
Quick Start
- Watch the smallest stable parent directory and filter the filenames you care about.
- Treat created and modified events as "maybe changed" signals.
- Prefer moved-into-place as the strongest ready signal.
- Keep callbacks fast: normalize the event, enqueue lightweight work, and return.
- Debounce duplicate event bursts and check file readiness before reading.
- Own observer lifecycle explicitly: schedule, start once, stop, join, and surface errors.
Operating Constraints
- Do not parse heavy content, sleep, block, or mutate runtime state inside watchdog callbacks.
- Do not assume editor save behavior, atomic renames, or close events are identical across platforms.
- Ignore temp files, swap files, partial suffixes, hidden files, and self-written artifacts where appropriate.
- Ensure one logical file action produces at most one runtime enqueue inside the configured debounce window.
- Hand off to a runtime queue or control API; keep the watcher as an adapter.
- Stop and join observer threads during shutdown without leaving orphans.
- Log enough event path, normalized action, debounce decision, and enqueue result to diagnose misses.
Inputs This Skill Expects
- Watcher adapter entrypoint and observer lifecycle code.
- Watched path config, expected filenames, and runtime event types.
- Queue or control API used for handoff.
- Producer behavior when known: direct write, temp file plus rename, editor save, or marker touch.
- Logs or tests showing duplicates, partial reads, missed events, or shutdown hangs.
Output Contract
- Provide watcher edits that filter, debounce, readiness-check, hand off, and shut down cleanly.
- State watch roots, filename filters, ignored patterns, debounce window, and readiness policy.
- Name the queue/control handoff and the runtime event emitted.
- Include tests or a smoke checklist for create, modify, move, temp-file, duplicate, and shutdown cases.
- State why watchdog remains appropriate or why polling is safer.
Procedure
- Locate watcher setup, handler callbacks, queue handoff, and shutdown path.
- Identify actual producer behavior and file readiness signals.
- Restrict watched roots and filters to the narrowest stable surface.
- Normalize events into a small internal event shape.
- Add debounce and duplicate suppression before content reads.
- Move heavy parsing and runtime mutation out of callbacks into queue processing.
- Implement explicit observer stop/join and error diagnostics.
- Validate with create, modify, move-into-place, temp-file, duplicate burst, and shutdown scenarios.
Pitfalls And Gotchas
- Treating every
modifiedcallback as a complete file. - Watching a broad tree and then debugging unrelated event noise.
- Reading files before the producer has finished writing them.
- Doing slow parsing inside callback threads.
- Enqueueing duplicate work because save operations emit multiple events.
- Depending on
on_closedas if it were a portable contract. - Forgetting to join observers and leaving tests or daemons hanging.
Progressive Disclosure
Start with the watched path and callback in scope. Expand into producer behavior, queue semantics, shutdown, or config reload only when the adapter crosses those boundaries. Keep business logic outside the watcher and use smoke scenarios to prove the adapter contract.
Verification Pattern
- Confirm observer lifecycle has start, stop, and join behavior.
- Confirm callbacks only normalize and hand off lightweight work.
- Confirm temp and partial files are ignored until ready.
- Confirm duplicate event bursts collapse to one runtime enqueue.
- Confirm create, modify, move, duplicate, and shutdown scenarios are tested or smoke-checked.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

