Agent skill

Maui App Lifecycle

by davidortinau in davidortinau/maui-skills

.NET MAUI app lifecycle guidance covering the four app states (not running, running, deactivated, stopped), cross-platform Window lifecycle events, backgrounding and resume behaviour…

MITAuto-check passedMobile

Install Maui App Lifecycle

skills CLI
$ npx skills add davidortinau/maui-skills --skill maui-app-lifecycle -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install davidortinau/maui-skills maui-app-lifecycle --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/davidortinau/maui-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/maui-skills/skills/maui-app-lifecycle .claude/skills/maui-app-lifecycle && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
maui-app-lifecycle
GitHub stars
175
Token cost
~947 tokens
SKILL.md length
230 words
Files
2 (incl. references)
Skills in repo
41
Repo updated
First seen
Licence
MIT

At a glance

.NET MAUI app lifecycle guidance covering the four app states (not running, running, deactivated, stopped), cross-platform Window lifecycle events, backgrounding and resume behaviour…

  • : app lifecycle
  • SKILL.md covers Critical Behavioral Gotchas, Performance: Keep Handlers Fast, iOS Scene Lifecycle and State Preservation Checklist
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Window lifecycle

What it does

Maui App Lifecycle is an agent skill from davidortinau/maui-skills. .NET MAUI app lifecycle guidance covering the four app states (not running, running, deactivated, stopped), cross-platform Window lifecycle events, backgrounding and resume behaviour, platform-specific lifecycle mapping for Android and iOS/Mac Catalyst, and state-preservation patterns. USE FOR: "app lifecycle", "OnStart", "OnSleep", "OnResume", "backgrounding", "app state", "window lifecycle", "save state on background", "resume app", "deactivated event", "lifecycle events". DO NOT USE FOR: navigation events (use…

Its SKILL.md is about 950 tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/lifecycle-api.md`).

It sits in Mobile, covering Cross-platform mobile apps and Design patterns. It works with Android and iOS. The repository describes itself as: .NET MAUI skills for GitHub Copilot and Claude Code. The licence is MIT.

When your agent uses it

  • : app lifecycle
  • Window lifecycle
  • Save state on background
  • Deactivated event

Example prompts

  • “app lifecycle”
  • “OnStart”
  • “OnSleep”
  • “/maui-app-lifecycle”

What it can do on your machine

Read from SKILL.md and the folder at commit 79bb4bf. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are csharp).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Maui App Lifecycle loads about 947 tokens when it runs, and up to ~2.3k if it reads all its reference files. Until then it costs about 167 tokens; SKILL.md has 230 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~167
When it runs · the whole SKILL.md, loaded when a task matches
~947
With references · SKILL.md plus every file in references/, read only if the agent opens them
~2.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from davidortinau/maui-skills at commit 79bb4bf, republished under its MIT licence (© davidortinau). 230 words, ~947 tokens.

Download SKILL.mdSave it as .claude/skills/maui-app-lifecycle/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
maui-app-lifecycle
description
.NET MAUI app lifecycle guidance covering the four app states (not running, running, deactivated, stopped), cross-platform Window lifecycle events, backgrounding and resume behaviour, platform-specific lifecycle mapping for Android and iOS/Mac Catalyst, and state-preservation patterns. USE FOR: "app lifecycle", "OnStart", "OnSleep", "OnResume", "backgrounding", "app state", "window lifecycle", "save state on background", "resume app", "deactivated event", "lifecycle events". DO NOT USE FOR: navigation events (use maui-shell-navigation), dependency injection setup (use maui-dependency-injection), or platform APIs (use maui-platform-invoke).

.NET MAUI App Lifecycle

Critical Behavioral Gotchas

⚠️ Resumed ≠ first launch

Resumed only fires when returning from the Stopped state. On first launch the sequence is Created → Activated — Resumed is never called.

csharp
// ❌ Putting initialization logic in OnResumed — won't run on first launch
protected override void OnResumed()
{
    LoadUserProfile();  // Skipped on cold start!
}

// ✅ Use OnActivated for logic that must run on every foreground entry
protected override void OnActivated()
{
    LoadUserProfile();  // Runs on both first launch and resume
}
⚠️ Deactivated ≠ Stopped

A dialog, split-screen, or notification pull-down triggers Deactivated without Stopped. Don't save heavy state on Deactivated — the app may never actually background.

csharp
// ❌ Heavy save on every deactivation — fires too often
protected override void OnDeactivated()
{
    await SaveAllDataToDatabase();  // Wasteful for a dialog appearance
}

// ✅ Save state only when truly backgrounded
protected override void OnStopped()
{
    await SaveAllDataToDatabase();
}
⚠️ Android back button skips Stopped

On Android, pressing the hardware back button may call Destroying without Stopped if the activity finishes. Critical save logic in OnStopped alone can be missed.

csharp
// ✅ Save in both Stopped and Destroying for safety on Android
protected override void OnStopped()
{
    base.OnStopped();
    SaveDraft();
}

protected override void OnDestroying()
{
    base.OnDestroying();
    SaveDraft();  // Catches Android back-button finish
}
⚠️ Multiple windows fire independently

On iPad, Mac Catalyst, and desktop Windows, each Window instance fires its own lifecycle events independently. Don't assume a single global lifecycle.

Performance: Keep Handlers Fast

Long-running work in lifecycle handlers causes ANR kills on Android (5s timeout) and watchdog kills on iOS (limited background time).

csharp
// ❌ Blocking the lifecycle handler
protected override void OnStopped()
{
    Thread.Sleep(3000);  // ANR on Android!
    SaveData();
}

// ✅ Fire-and-forget or use a brief async save
protected override void OnStopped()
{
    base.OnStopped();
    Preferences.Set("draft_text", _viewModel.DraftText);  // Fast, synchronous
}

For larger state, use SecureStorage or file-based serialization — but keep it under 1–2 seconds.

iOS Scene Lifecycle

iOS 13+ uses the scene lifecycle (SceneWillConnect, etc.). Older delegate methods are still forwarded by MAUI, but you should target scene-based APIs for modern iOS.

State Preservation Checklist

  • Transient UI state (scroll position, draft text) saved in OnStopped
  • State restored in OnResumed — not in OnActivated (avoid double-restore)
  • No heavy I/O in OnDeactivated — it fires too frequently
  • Android: critical save logic also in OnDestroying (back-button case)
  • Lifecycle handlers complete in under 2 seconds
  • Multi-window apps handle per-window state independently

© davidortinau, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (references) in plugins/maui-skills/skills/maui-app-lifecycle of davidortinau/maui-skills.

  • SKILL.md
  • references/lifecycle-api.md

Open the folder on GitHubat commit 79bb4bf

Compare with similar skills

Maui App Lifecycle next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Maui App Lifecycle compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Maui App Lifecycle this skilldavidortinau/maui-skills175—~947Automated safety check: PassMIT
Flutter Appccplugins/awesome-claude-code-plugins970—~1.1kAutomated safety check: NotesApache-2.0
Engine Whats Newflutter/flutter179k—~978Automated safety check: PassBSD-3-Clause
Rnn Codebasewix/react-native-navigation13k—~2kAutomated safety check: PassMIT
Building Native UICherryHQ/cherry-studio-app4k8 repos~2.6kAutomated safety check: PassMIT
Expo Tailwind SetupCherryHQ/cherry-studio-app4k8 repos~3kAutomated safety check: PassMIT

Similar skills

  • Flutter App

    ccplugins/awesome-claude-code-plugins

    Bootstrap a new Flutter mobile app with clean architecture, Riverpod, FVM-pinned SDK, current packages, and no deprecated APIs.

    970 GitHub stars~1.1k tokensUpdated 1 mo ago
    MobileAuto-check: notes
  • Engine Whats New

    flutter/flutter

    Generates the "what's new" release summary and diff file for changes in the Flutter engine (//engine/src/flutter) between two releases (e.g., 3.47 vs 3.44).

    179k GitHub stars~978 tokensUpdated today
    MobileAuto-check passed
  • Rnn Codebase

    wix/react-native-navigation

    Official

    Navigate and work with the react-native-navigation (RNN) codebase.

    13k GitHub stars~2k tokensUpdated 3 days ago
    MobileAuto-check passed
  • Building Native UI

    CherryHQ/cherry-studio-app

    Complete guide for building beautiful apps with Expo Router.

    4k GitHub starsUsed in 8 repos~2.6k tokens
    MobileAuto-check passed
  • Expo Tailwind Setup

    CherryHQ/cherry-studio-app

    Set up Tailwind CSS v4 in Expo with react-native-css and NativeWind v5 for universal styling

    4k GitHub starsUsed in 8 repos~3k tokens
    MobileAuto-check passed
  • Screenmap

    aleqsio/screenmap

    Generate a visual navigation map of an Expo / React Native or NativeScript app.

    244 GitHub stars~7.2k tokensUpdated 5 days ago
    MobileAuto-check passed

More from davidortinau/maui-skills

All 41 skills in this repo
  • Maui Hot Reload Diagnostics

    davidortinau/maui-skills

    Diagnose and troubleshoot .NET MAUI Hot Reload issues (C Hot Reload, XAML Hot Reload, Blazor Hybrid).

    175 GitHub stars~1.3k tokensUpdated 3 mo ago
    Auto-check passed
  • Maui Accessibility

    davidortinau/maui-skills

    Guide for making .NET MAUI apps accessible — screen reader support via SemanticProperties, heading levels, AutomationProperties visibility control, programmatic focus and announcements, and…

    175 GitHub stars~974 tokensUpdated 3 mo ago
    Auto-check passed
  • Maui Animations

    davidortinau/maui-skills

    .NET MAUI view animations, custom animations, easing functions, rotation, scale, translation, and fade effects.

    175 GitHub stars~911 tokensUpdated 3 mo ago
    Auto-check passed
  • Maui App Icons Splash

    davidortinau/maui-skills

    .NET MAUI app icon configuration, splash screen setup, SVG to PNG conversion at build time, composed/adaptive icons, and platform-specific icon and splash screen requirements for Android, iOS, Mac…

    175 GitHub stars~995 tokensUpdated 3 mo ago
    Auto-check passed
  • Maui Aspire

    davidortinau/maui-skills

    Guide for .NET MAUI apps consuming .NET Aspire-hosted backend services.

    175 GitHub stars~1.3k tokensUpdated 3 mo ago
    Auto-check passed
  • Maui Authentication

    davidortinau/maui-skills

    Add authentication to .NET MAUI apps. An agent skill from davidortinau/maui-skills.

    175 GitHub stars~1.5k tokensUpdated 3 mo ago
    Auto-check passed

Works with

Categories

Questions about Maui App Lifecycle

What does Maui App Lifecycle do?

.NET MAUI app lifecycle guidance covering the four app states (not running, running, deactivated, stopped), cross-platform Window lifecycle events, backgrounding and resume behaviour…. Maui App Lifecycle is an agent skill from davidortinau/maui-skills.NET MAUI app lifecycle guidance covering the four app states (not running, running, deactivated, stopped), cross-platform Window lifecycle events, backgrounding and resume behaviour, platform-specific lifecycle mapping for Android and iOS/Mac Catalyst, and state-preservation patterns.

When should I use Maui App Lifecycle?

Maui App Lifecycle fits situations like: : app lifecycle; window lifecycle; save state on background; deactivated event.

How do I install Maui App Lifecycle in Claude Code?

Run `npx skills add davidortinau/maui-skills --skill maui-app-lifecycle -a claude-code`. Or copy the skill folder (plugins/maui-skills/skills/maui-app-lifecycle in davidortinau/maui-skills) into .claude/skills/maui-app-lifecycle in your project. Claude Code loads it when a task matches its description.

How do I install Maui App Lifecycle in Codex?

Run `npx skills add davidortinau/maui-skills --skill maui-app-lifecycle -a codex`. Or copy the skill folder (plugins/maui-skills/skills/maui-app-lifecycle in davidortinau/maui-skills) into .agents/skills/maui-app-lifecycle in your project. Codex loads it when a task matches its description.

Can I use Maui App Lifecycle in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add davidortinau/maui-skills --skill maui-app-lifecycle -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/maui-app-lifecycle, .gemini/skills/maui-app-lifecycle, .github/skills/maui-app-lifecycle and .opencode/skills/maui-app-lifecycle in your project.

What does Maui App Lifecycle need to run?

SKILL.md names no scripts, command-line tools or credentials: Maui App Lifecycle is instructions for the agent only.

Does Maui App Lifecycle access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Maui App Lifecycle safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Maui App Lifecycle use?

Maui App Lifecycle is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Maui App Lifecycle use?

About 947 tokens (SKILL.md is roughly 3.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.3k tokens, read only when the agent opens those files.

What are the alternatives to Maui App Lifecycle?

Skills that share tags, products or a category with Maui App Lifecycle: Flutter App (ccplugins/awesome-claude-code-plugins, 970 stars), Engine Whats New (flutter/flutter, 179k stars), Rnn Codebase (wix/react-native-navigation, 13k stars) and Building Native UI (CherryHQ/cherry-studio-app, 4k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Maui App Lifecycle?

davidortinau (a GitHub user) maintains it in davidortinau/maui-skills, which has 175 GitHub stars. The repository holds 41 skills in this directory. The repository was last updated on July 6, 2026.

Source: davidortinau/maui-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.