dotnet-hosted-service-review

Reviews .NET BackgroundService and IHostedService pull requests for robustness, cancellation, and idempotency defects.

2|Updated Jul 18, 2026
One-click install
npx skills add https://github.com/Arasz/ai-badger --skill dotnet-hosted-service-review-arasz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-hosted-service-review
Source: https://github.com/Arasz/ai-badger/tree/main/features/dotnet/skills/dotnet-workload/references/dotnet-hosted-service-review
Command: npx skills add https://github.com/Arasz/ai-badger --skill dotnet-hosted-service-review-arasz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Reviewing pull requests that add or modify .NET background services is error-prone: a single unhandled exception in ExecuteAsync can stop the entire host, cancellation tokens get swallowed by per-item catches, and idempotency claims often hide TOCTOU races at the store layer. This Skill provides a systematic checklist so reviewers catch these defects with file:line evidence instead of gut feel. ## Core Features & Use Cases - Nine-point review checklist: Covers ExecuteAsync try/catch coverage, cancellation filtering, PeriodicTimer semantics, store-level idempotency vs TOCTOU, settings-channel parsing, LoggerMessage EventId invariants, and test fidelity for loops. - Claims-vs-code verdict table: Converts every PR-body safety claim (off-by-default, never-mutates, idempotent, no-delete-path) into a HOLDS / HOLDS-with-caveat / FAILS verdict backed by grep evidence. - Severity calibration: Distinguishes MUST-FIX from SHOULD-FIX and NIT findings by comparing against same-repo precedent and pre-existing synchronous-path exposure. - Use Case: When a teammate opens a PR adding a background sync loop over a SQLite store, run this review to verify the interval re-read sits inside the try block, per-item catches filter OperationCanceledException, and the dedup claim survives a multi-process topology check. ## Quick Start Ask the agent to review the open pull request that adds a BackgroundService using the dotnet-hosted-service-review checklist and produce numbered findings with severity and file:line evidence.

Frequently Asked Questions about dotnet-hosted-service-review

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I review a .NET BackgroundService pull request?

Review a BackgroundService PR by checking ExecuteAsync try/catch coverage, cancellation filtering in per-item catches, PeriodicTimer semantics, and store-level idempotency. This Skill walks a nine-point checklist and outputs numbered findings with severity and file:line evidence.

What happens when ExecuteAsync throws an unhandled exception?

An unhandled non-OperationCanceledException faults ExecuteAsync, and the default BackgroundServiceExceptionBehavior.StopHost stops the entire host. On .NET 11+, RunAsync and StopAsync also fault, turning a zero exit code into a non-zero one.

Why does catch (Exception) break cancellation in background services?

A per-item catch (Exception) swallows OperationCanceledException, so shutdown logs spurious warnings and the top-level cancellation check never fires from the run body. Inner catches should filter with when (!cancellationToken.IsCancellationRequested) or rethrow.

How do I verify idempotency claims in a background sync loop?

Verify idempotency at the store layer, not the PR description: SELECT-then-INSERT dedup without a unique constraint is a TOCTOU race across processes. Grep for forbidden operations like Delete calls to prove claims such as no-delete-path.

Does PeriodicTimer run immediately when a hosted service starts?

No, PeriodicTimer's first tick fires after one full interval, so enabling a feature produces no work until then. Check for a run-now verb or a doc note, and confirm interval re-reads happen inside the try block.