maui-app-lifecycle

maui-app-lifecycle is a skill for Claude Code, Codex from managedcode/dotnet-skills. It costs 144 tokens per session (2,142 once invoked), scanned A, a copy of maui-app-lifecycle, MIT.

A guide to handling the stages of a .NET MAUI app window, such as opening, becoming active, moving to the background, returning, and closing.

In plain words
What is it for?
Use it to respond to lifecycle events, preserve data during backgrounding, refresh on resume, connect to platform-specific callbacks, and handle multiple windows.
Why use it?
It helps apps save state, refresh data, and start or clean up work at the correct time across different platforms.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/managedcode/dotnet-skills/maui-app-lifecycle
Any agent
npx skills add managedcode/dotnet-skills --skill maui-app-lifecycle
Clone the repo
git clone --depth 1 https://github.com/managedcode/dotnet-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for maui-app-lifecycle

README.md
[![agentmods](https://agentmods.dev/badge/skills/managedcode/dotnet-skills/maui-app-lifecycle.svg)](https://agentmods.dev/skills/managedcode/dotnet-skills/maui-app-lifecycle)
Your own site
<a href="https://agentmods.dev/skills/managedcode/dotnet-skills/maui-app-lifecycle"><img src="https://agentmods.dev/badge/skills/managedcode/dotnet-skills/maui-app-lifecycle.svg" alt="Measured on agentmods" height="20"></a>
Per session 144 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,142 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00144 $0.02142
Opus 5 $0.00072 $0.01071
Sonnet 5 $0.00029 $0.00428
Haiku 4.5 $0.00014 $0.00214

Measured 4d ago against content hash 88b2b00a9cc5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

maui-app-lifecycle scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to maui-app-lifecycle — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

catalog/Frameworks/Official-DotNet-MAUI/skills/maui-app-lifecycle/SKILL.md · 225 lines

How it starts

The opening of the file, as written. The whole thing — 225 lines — stays where its author put it; the contents beside it link to each section on GitHub.

.NET MAUI App Lifecycle

Handle application state transitions correctly in .NET MAUI. This skill covers the cross-platform Window lifecycle events, their platform-native mappings, and patterns for preserving state across backgrounding and resume cycles.

When to Use

  • Saving or restoring state when the app backgrounds or resumes
  • Subscribing to Window lifecycle events (Created, Activated, Deactivated, Stopped, Resumed, Destroying)
  • Hooking into platform-native lifecycle callbacks via ConfigureLifecycleEvents
  • Deciding where to place initialization, teardown, or refresh logic
  • Understanding the difference between Deactivated and Stopped

When Not to Use

  • Page-level navigation events — use Shell navigation guidance instead
  • Registering services at startup — use dependency injection guidance instead
  • Calling platform-specific APIs outside lifecycle context — use platform invoke guidance instead

Inputs

  • The target lifecycle transition (e.g., "save draft when backgrounded", "refresh data on resume")
  • Which platforms the developer targets (Android, iOS, Mac Catalyst, Windows)
  • Whether the app uses multiple windows (iPad, Mac Catalyst, desktop Windows)

App States

A .NET MAUI app moves through four states:

State Description
Not Running Process does not exist
Running Foreground, receiving input
Deactivated Visible but lost focus (dialog, split-screen, notification shade)
Stopped Fully backgrounded, UI not visible

Typical flow: Not Running → Running → Deactivated → Stopped → Running (resumed) or Not Running (terminated).

Window Lifecycle Events

Microsoft.Maui.Controls.Window exposes six cross-platform events:

Event Fires when
Created Native window allocated
Activated Window receives input focus
Deactivated Window loses focus (may still be visible)
Stopped Window is no longer visible
Resumed Window returns to foreground after Stopped
Destroying Native window is being torn down

Read the full file on GitHub · 225 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 225 lines · 144 tokens per session scan A 88b2b00a9cc5

Subscribe to this mod's changes

maui-app-lifecycle is a skill published in the GitHub repository managedcode/dotnet-skills (477 stars, last pushed 3d ago), licensed MIT. It adds 144 tokens to every session and 2,142 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to maui-app-lifecycle, differing in 0 lines, and is treated as a copy.

Related

Other skills, from other repositories

close-task-commit-push-pr

Close the active backlog task (detected from branch name), commit all changes, push to remote, and open a pull request. Use when the user says "close task and ship it", "close task commit push pr", or invokes /close-task-commit-push-pr.

devoxx/DevoxxGenieIDEAPlugin · 64 tokens

git-commit-push-pr

Commit all changes, push to remote, and open a pull request in one go. Use when the user says "commit push pr", "ship it", "open a pr", or invokes /git-commit-push-pr.

devoxx/DevoxxGenieIDEAPlugin · 53 tokens

mutation-testing

Use when running mutation testing, killing mutants, verifying test quality, checking mutation score, or analyzing survivors after the test baseline is green.

SebastienDegodez/copilot-instructions · 29 tokens

generate-microcks-openapi-samples

Use when creating OpenAPI mock examples for Microcks, setting up request/response routing with dispatchers, or mapping request fields to mock responses.

SebastienDegodez/copilot-instructions · 37 tokens

extracting-code-structure

Use when listing all methods, functions, or classes in a file, exploring unfamiliar code, getting API overviews, or deciding what to read selectively without loading entire files.

SebastienDegodez/copilot-instructions · 39 tokens

querying-yaml

Use when querying YAML files, filtering or transforming configuration data, or extracting specific fields from large YAML files like docker-compose.yml or GitHub Actions workflows without loading entire files (saves 80-95% context).

SebastienDegodez/copilot-instructions · 48 tokens