shinyorg/shiny/shiny-jobs

Claude Code and agent skill by shinyorg/shiny

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Background job scheduling and execution for .NET MAUI (iOS/Android native OS schedulers) and in-process jobs for plain .NET, Linux, macOS, and Blazor WASM using Shiny.Jobs

Install

npx vskill@latest install shinyorg/shiny/shiny-jobs

SKILL.md

The same SKILL.md was published earlier as shinyorg/shiny/shiny-jobs.

Shiny Jobs

Shiny.Jobs provides cross-platform background job scheduling and execution. On iOS and Android it uses the native OS schedulers (BGTaskScheduler / AndroidX WorkManager); on Windows it uses COM-activated background tasks. On plain .NET targets (Linux, macOS server, Blazor WASM, console, etc.) it runs an in-process managed JobManager driven by a recurring timer — jobs run only while the host process is alive; there is no OS-level scheduler on those targets. All platforms support the same constraints (network availability, charging, battery).

Blazor WASM caveat: background jobs only run while the tab is open and foregrounded. Service Worker / Periodic Background Sync cannot invoke C# because the SW has no access to the Blazor WASM runtime. For true background HTTP work on Blazor, use Shiny.Net.Http (AddBlazorHttpTransfers).

When to Use This Skill

  • The user wants to schedule background work that runs periodically
  • The user needs to run tasks when the app is not in the foreground
  • The user asks about job constraints (network, charging, battery)
  • The user wants to register or manage background jobs
  • The user needs foreground job execution on a timer
  • The user asks about IJobManager, IJob, JobRegistration, or related types

Library Overview

ItemValue
NuGetShiny.Jobs
NamespaceShiny.Jobs (types); Shiny (registration extensions)
PlatformsiOS, tvOS, Android, Windows (native OS); Linux, macOS, Blazor WASM, .NET base (in-process)
tvOS

tvOS carries the same BGTaskScheduler iOS does, so jobs schedule and run identically — same BGTaskSchedulerPermittedIdentifiers and processing background mode in Info.plist, same "the OS decides when" semantics. As on iOS, jobs do not run on the simulator. There is no MAUI on tvOS, so register through Shiny.Hosting.Native, not UseShiny().

Setup

Register jobs during service configuration. Each job is registered by its CLR type using AddJob<TJob> with optional fluent configuration. The job's Type is its unique identity — there is no separate string identifier.

csharp
using Shiny;
using Shiny.Jobs;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder.Services.AddJob<MySyncJob>(r => r
.WithForeground()
.WithInternet(InternetAccess.Any)
.WithBatteryNotLow()
);
return builder.Build();
}
}

AddJob<TJob> registers the infrastructure on first call (job manager + lifecycle task + battery/connectivity dependencies), then adds your job. Subsequent calls only add jobs.

iOS Setup

Add the following background task identifiers to your Info.plist under BGTaskSchedulerPermittedIdentifiers:

  • com.shiny.job
  • com.shiny.jobpower
  • com.shiny.jobnet
  • com.shiny.jobpowernet

Also enable the processing background mode.

Android Setup

No additional manifest setup is required. Shiny.Jobs uses AndroidX WorkManager under the hood (minimum periodic interval: 15 minutes).

Windows Setup

Windows uses COM-activated in-process background tasks. Call ShinyJobsBackgroundTask.RegisterComServer() once in your App constructor before any trigger registration, and declare a matching windows.comServer extension in your appx manifest. Note: no background-mode triggering exists today on Windows — tasks fire while the process is running.

Plain .NET Setup (Linux, macOS, Blazor WASM, Console)

On the base .NET TFM there is no native OS scheduler — Shiny runs an in-process managed JobManager on a recurring timer (default 30s; configurable via the static JobManager.Interval property, minimum 15s, maximum 5 minutes). Jobs only execute while the host process is alive.

There is no separate `Shiny.Jobs.Blazor` package — reference Shiny.Jobs directly on all plain .NET targets (Blazor WASM included). AddJob registers IConnectivity and IBattery for you on every target - Shiny.Core picks the Linux or browser implementation at runtime. Plain .NET on Windows or macOS (a console, service or Avalonia desktop head, not MAUI) has no battery API, so no IBattery is registered there; the JobManager then treats the machine as mains powered (WithCharging() / WithBatteryNotLow() always pass). Register your own IBattery if you need real readings. To replace the defaults with your own implementation on any target, register yours before AddJob — the auto-registration never replaces an existing one.

csharp
using Shiny;
using Shiny.Jobs;
// Linux / Blazor WASM - battery + connectivity are registered by AddJob
// Windows / macOS console - no IBattery needed (treated as mains powered); register one to get real readings
services.AddJob<MySyncJob>(r => r
.WithForeground()
.WithInternet(InternetAccess.Any)
);

The in-process JobManager is an IShinyStartupTask, so the Shiny host must run: UseShiny() in a MAUI app (including Linux GTK and macOS), await host.Services.UseShiny() after Build() on Blazor WASM, or host.Run() from HostBuilder in a console/service app.

Blazor WASM caveat: the in-process JobManager only runs while the tab is open. Background tabs are throttled (~1 min timer floor on Chromium), may be frozen after ~5 minutes, and iOS Safari kills background WASM aggressively. There is no way to run C# jobs via Service Worker Background Sync because the SW has no access to the WASM runtime. For background HTTP work specifically, use Shiny.Net.Http (AddBlazorHttpTransfers).

Code Generation Instructions

When generating job-related code, follow these conventions:

  1. Implement `IJob` directly for simple jobs, or inherit from the `Job` abstract base class for jobs that need a minimum interval between runs (MinimumTime).
  2. The job's CLR type is its identity — do not invent a separate string identifier. Pass typeof(TJob) to RunJob(...); iterate GetJobs() for the registered set.
  3. Use constructor injection — job classes are resolved through DI. Inject dependencies through the constructor.
  4. `IJob.Run` takes only `CancellationToken` — there is no JobInfo argument. If a job needs configuration, inject it through the constructor or read from a settings store.
  5. Honor the `CancellationToken` — the platform may cancel a run on time-budget expiry; check cancelToken.ThrowIfCancellationRequested() between work units.
  6. Use `WithForeground()` when the job should also execute periodically while the app is in the foreground (driven by JobLifecycleTask — platform builds only). The timer stops when the app is backgrounded and a batch never overlaps another. On a normal launch the foreground jobs run straight away; when the OS launches the process in the background (iOS BGTask / silent push / location, Android WorkManager or a service - UIApplication.ApplicationState == Background, or process importance below visible) they do not run at start, so a background launch never runs them twice. They run, and the timer starts, on the first foreground.
  7. Use `WithInternet(InternetAccess.Any | Unmetered)` to require connectivity before the job runs. Unmetered maps to WorkManager's NetworkType.Unmetered on Android; for foreground runs it means internet that is neither constrained (roaming / Low Data Mode) nor cellular. iOS BGProcessingTaskRequest has no unmetered constraint, so there Unmetered background jobs only require connectivity.
  8. Use `WithCharging()` / `WithBatteryNotLow()` for power-sensitive jobs — be aware these may delay a job indefinitely under hostile conditions.
  9. Call `RequestAccess()` (on the concrete JobManager via AbstractJobManager) before relying on background execution, so you can guide the user if a platform configuration is missing.
  10. Register jobs at host build time via services.AddJob<TJob>(...). There is no public runtime-register API on IJobManager.
Conventions
  • Job class names should end with Job (e.g., DataSyncJob, CleanupJob).
  • Place job classes in a Jobs/ folder or namespace within the project.
  • Always handle exceptions inside Run gracefully; unhandled exceptions are caught by the manager, logged, and surfaced via the returned JobRunResult.
  • Job instances are resolved per run from the DI container — keep them scoped-safe (no long-lived per-job state outside DI).

Best Practices

  • Check `RequestAccess()` on startup and guide the user if background jobs are not available (AccessState.NotSetup, AccessState.Restricted, AccessState.Denied, etc.).
  • Keep jobs short-lived — background execution time is limited by the OS, especially on iOS where BGProcessingTask budgets are short.
  • Use constraints wisely — DeviceCharging = true or BatteryNotLow = true means the job may not run for extended periods under hostile conditions.
  • Prefer `InternetAccess.Any` over `Unmetered` unless the job transfers large amounts of data.
  • Use the `Job` base class with `MinimumTime` when the OS may invoke your job more often than necessary and you want a simple in-memory throttle.
  • Use `RunJob(typeof(TJob))` for event-driven on-demand runs of a registered job. The job runs normally (inline); there is no extended-execution / background-task wrapping.

Reference Files

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
1,583
Repository forks
248
7-day trend score
37

Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 22 May 2026, 6 months ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/shinyorg/shiny/shiny-jobs/badge)](https://verified-skill.com/skills/shinyorg/shiny/shiny-jobs)

Something wrong with this skill or its page? Tell us.