From shiny-extensions
Generate and configure Shiny MAUI Hosting for .NET - modular MAUI app configuration with IMauiModule, static Host.Services access, and platform lifecycle hooks
How this skill is triggered — by the user, by Claude, or both
Slash command
/shiny-extensions:shiny-maui-hostingThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
- IMauiModule
You are an expert in Shiny Extensions MAUI Hosting, a .NET library providing modular MAUI app configuration via IMauiModule with a static service provider accessor and platform lifecycle hooks.
Invoke this skill when the user wants to:
IMauiModuleIAppForeground, IAppBackground, etc.)Host.ServicesDocumentation: https://shinylib.net/extensions/mauihost/
Repository: https://github.com/shinyorg/Shiny.Extensions
Package: Shiny.Extensions.MauiHosting
Namespace: Shiny
public interface IMauiModule
{
void Add(MauiAppBuilder builder); // Register services
void Use(IPlatformApplication app); // Post-build initialization (do NOT block)
}
Each module implements IMauiModule with two methods:
Add(MauiAppBuilder builder) — register services, configure the builder. Runs before the app is built.Use(IPlatformApplication app) — post-build initialization. Host.Services is available here. Do NOT block — runs on the main thread.public class AnalyticsModule : IMauiModule
{
public void Add(MauiAppBuilder builder)
{
builder.Services.AddSingleton<IAnalytics, AppCenterAnalytics>();
}
public void Use(IPlatformApplication app)
{
var analytics = Host.Services.GetRequiredService<IAnalytics>();
analytics.TrackEvent("AppStarted");
}
}
using Shiny;
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.AddInfrastructureModules(new AnalyticsModule(), new NetworkModule());
return builder.Build();
After initialization, Host.Services provides access to the service provider from anywhere:
var service = Host.Services.GetRequiredService<IMyService>();
:::caution
Host.Services throws InvalidOperationException if accessed before initialization. Host.Lifecycle is internal — lifecycle dispatch is handled automatically.
:::
Register services that implement lifecycle interfaces to respond to platform events. The ILifecycleExecutor dispatches events to all registered handlers automatically.
[Singleton]
public class AppLifecycleHandler : IAppForeground, IAppBackground
{
public void OnForeground() { /* app came to foreground */ }
public void OnBackground() { /* app went to background */ }
}
| Interface | Purpose |
|---|---|
IAppForeground | App entering foreground |
IAppBackground | App entering background |
[Singleton]
public class DeepLinkHandler : IContinueActivity
{
public bool Handle(NSUserActivity activity)
{
// Handle universal links, handoff, etc.
return true;
}
}
| Interface | Purpose |
|---|---|
IContinueActivity | Universal links, handoff |
IOnFinishedLaunching | App finished launching |
[Singleton]
public class PermissionHandler : IOnActivityRequestPermissionsResult
{
public void Handle(Activity activity, int requestCode, string[] permissions, Permission[] grantResults)
{
// Handle permission results
}
}
| Interface | Purpose |
|---|---|
IOnApplicationCreated | Application creation |
IOnActivityOnCreate | Activity creation |
IOnActivityRequestPermissionsResult | Permission request results |
IOnActivityNewIntent | New intent received |
IOnActivityResult | Activity result callback |
public static class MauiExtensions
{
// Register MAUI modules - calls Add() on each, sets up Host initialization
public static MauiAppBuilder AddInfrastructureModules(
this MauiAppBuilder builder,
params IEnumerable<IMauiModule> modules);
}
public class Host : IMauiInitializeService
{
public static IServiceProvider Services { get; }
}
Add() for service registration and Use() for post-build initializationUse() - it runs on the main thread during app startupHost.Services to resolve services after the app is builtIAppForeground, IAppBackground, etc.) via DI for platform eventsTask.Run or similarHost.Services only where DI is unavailable[Singleton] attributes on lifecycle handler classesnpx claudepluginhub shinyorg/skills --plugin shiny-extensionsGuides completion of development work by verifying tests, detecting environment, and presenting structured options for merge, PR, or cleanup.
Guides creation and editing of skills using test-driven development with pressure scenarios and subagents to verify agent compliance.
Dispatches multiple subagents concurrently for independent tasks without shared state. Use when facing 2+ unrelated failures or subsystems that can be investigated in parallel.