maui: Instructions file for GitHub Copilot

.github/instructions/performance-hotpaths.instructions.md

maui performance-hotpaths.instructions.md is an instructions file for GitHub Copilot from dotnet/maui. It costs 441 tokens per session, scanned A, original, MIT.

Coding rules for performance-sensitive parts of .NET MAUI, a framework for building mobile and desktop apps with C#. They focus on code that runs frequently, such as layout, scrolling, touch handling, and list-item recycling.

In plain words
What is it for?
Use them when changing layout measurement, scrolling callbacks, data binding, property notifications, CollectionView or CarouselView recycling, ScrollView code, or other allocation-sensitive handlers.
Why use it?
They help avoid repeated memory allocations and expensive work in frequently called code, which can otherwise cause slow scrolling or a less responsive interface.

Instructions file for GitHub Copilot

Written for GitHub Copilot: a Copilot instructions file.

This is dotnet/maui's own configuration. It tells GitHub Copilot how to work on maui itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything maui configures →

About the project

.NET MAUI is a C# and XAML framework for building native mobile and desktop applications from one shared codebase. Developers use it to create apps for Android, iOS, iPadOS, macOS, and Windows. The catalogue entries provide skills, instructions, and agents for working with .NET MAUI.

dotnet/maui · 23,322 stars · on GitHub · dot.net

Reuse

Borrowing it

Nothing to install: this file belongs to dotnet/maui. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/dotnet/maui/main/.github/instructions/performance-hotpaths.instructions.md
Clone the repo
git clone --depth 1 https://github.com/dotnet/maui

Made for: GitHub Copilot.

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 performance-hotpaths.instructions.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/dotnet/maui/performance-hotpaths/github.svg)](https://agentmods.dev/instructions/dotnet/maui/performance-hotpaths)
Your own site
<a href="https://agentmods.dev/instructions/dotnet/maui/performance-hotpaths"><img src="https://agentmods.dev/badge/instructions/dotnet/maui/performance-hotpaths/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for maui performance-hotpaths.instructions.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/dotnet/maui/performance-hotpaths"><img src="https://agentmods.dev/badge/instructions/dotnet/maui/performance-hotpaths.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 441 This file is loaded in full into every session.
When invoked 441 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found 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.1 $0.00441 $0.00441
Opus 5.5 $0.00176 $0.00176
Sonnet 5.5 $0.00088 $0.00088
Haiku 4.5 $0.00044 $0.00044

Measured 1mo ago against content hash 5ea9380b4959, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

maui performance-hotpaths.instructions.md 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 1mo 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.

.github/instructions/performance-hotpaths.instructions.md · 35 lines

What it actually says

Performance-Critical Path Rules

Scope rationale: globs target the actual hot paths — layout measure/arrange, platform scroll/touch callbacks, CollectionView/CarouselView (Items + Items2) recycling, and ScrollView. The full handler tree is intentionally NOT included; most handlers (Button, DatePicker, CheckBox, …) are not hot paths and don't need these constraints. If you're working on a handler that IS allocation-sensitive (image decoding, animation tick, etc.), apply these rules anyway.

Hot Paths in MAUI

Measure/arrange cycles, scrolling callbacks, binding propagation, and property change notifications are called at high frequency. All rules below apply to code on these paths.

Allocation Avoidance

  • No LINQ methods (.Where, .Select, .FirstOrDefault, .ToList) — use indexed for loops
  • No closures or lambdas that capture variables — these allocate a compiler-generated class per invocation
  • No string concatenation or interpolation — use StringBuilder or pre-allocated strings if logging is required
  • Prefer Count + indexer over IEnumerable iteration to avoid enumerator allocation

Caching and Invalidation

  • Cache results of expensive computations called multiple times per layout pass
  • Invalidate caches when inputs change — stale caches cause incorrect layout
  • Skip redundant work: if a property's new value equals the old value, do not trigger layout invalidation or re-render

Collection Iteration

  • When the source implements IList or IReadOnlyList, use for (int i = 0; i < list.Count; i++) instead of foreach
  • ObservableCollection change handlers should process only the affected range, not re-enumerate the entire collection
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. 1mo ago First seen · 35 lines · 441 tokens per session scan A 5ea9380b4959

Subscribe to this mod's changes

maui performance-hotpaths.instructions.md is an instructions file published in the GitHub repository dotnet/maui (23,322 stars, last pushed today), licensed MIT. It adds 441 tokens to every session, about $0.0018 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.