Build long-running .NET background services with `BackgroundService`, Generic Host, graceful shutdown, configuration, logging, and deployment patterns suited to workers and daemons. USE FOR: background services; scheduled workers; hosted services; worker extraction; graceful shutdown, health checks, and service hosting review. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit targeted files, and run relevant bui
SkillScore95Maintained
Automatic
◆Coding pack
Last verified 8/19/2026
What it changes
Passed 21 of 22 test cases with the skill, and 20 of 22 without it.
Without skill91%
With skill95%
Checks it passed that the model alone missed
Demonstrates creating an explicit async service scope using CreateAsyncScope for each iteration.
Defines methods for queuing work items taking Func<IServiceProvider, CancellationToken, ValueTask>.
2 fixed19 passed either way0 still failing1 broke
Pass-rate lift
+5 pp
Tokens
+105%
Agent turns
0%
Response time
-29%
Model gemini-3.6-flashMeasured 8/19/2026v221 of 22 cases passed with skill
Tokens, turns and time describe resource use, not a dollar price.
See it in action
One of 2 test cases the skill fixed. Same model, same prompt, with and without the skill.
1 of 2
Prompt
I'm writing a C# background worker service in .NET 8 that reads pending orders from Entity Framework Core's AppDbContext every 10 seconds. In my worker's constructor, I'm injecting `AppDbContext dbContext` directly. However, the application fails or causes memory leaks during execution. What is the correct pattern for resolving `AppDbContext` inside a worker service?
What was checked, without and with the skill
Checked
Without skill
With skill
Advises injecting IServiceScopeFactory instead of injecting DbContext directly into the constructor.
Passed
Passed
Demonstrates creating an explicit async service scope using CreateAsyncScope for each iteration.
Missed
Passed
case-02 · gemini-3.6-flash · 8/19/2026 · answers are capped and redacted
What's inside
The instructions your model reads when the skill loads.
SKILL.md392 lines3 files
.NET Worker Services
Trigger On
building long-running background services or scheduled workers
adding hosted services to an app or extracting them into a worker process
reviewing graceful shutdown, cancellation, queue processing, or health behavior
Write, run, or repair .NET tests that use xUnit with the right package, CLI, and runner guidance. USE FOR: xUnit v2 or xUnit v3 projects; adding, running, debugging, or repairing xUnit tests; choosing between VSTest and Microsoft.Testing.Platform. DO NOT USE FOR: TUnit projects; MSTest projects. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.