wpf-rule-rendering-antipatterns

wpf-rule-rendering-antipatterns is a skill for Claude Code from christian289/dotnet-with-claudecode. It costs 31 tokens per session (491 once invoked), scanned A, original, MIT.

A set of WPF rendering rules that identifies coding patterns likely to cause slow drawing or visual errors. Rendering is the process of drawing the user interface on screen.

In plain words
What is it for?
Use it when reviewing custom WPF drawing code, especially loops that update many items or code inside OnRender.
Why use it?
It prevents repeated redraw requests and resource creation from causing freezes, dropped frames, or corrupted visuals.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Part of the wpf-dev-pack plugin — 28 skills, 10 agents, 4 hooks, 2 MCP servers shipped together

Good fit Use it when reviewing custom WPF drawing code, especially loops that update many items or code inside OnRender.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/christian289/dotnet-with-claudecode/wpf-rule-rendering-antipatterns
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.

Any agent
npx skills add christian289/dotnet-with-claudecode --skill wpf-rule-rendering-antipatterns
Clone the repo
git clone --depth 1 https://github.com/christian289/dotnet-with-claudecode

Made for: Claude Code.

Or install wpf-dev-pack, the plugin that ships this one along with the rest of its 28 skills, 10 agents, 4 hooks, 2 MCP servers.

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 wpf-rule-rendering-antipatterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/christian289/dotnet-with-claudecode/wpf-rule-rendering-antipatterns/github.svg)](https://agentmods.dev/skills/christian289/dotnet-with-claudecode/wpf-rule-rendering-antipatterns)
Your own site
<a href="https://agentmods.dev/skills/christian289/dotnet-with-claudecode/wpf-rule-rendering-antipatterns"><img src="https://agentmods.dev/badge/skills/christian289/dotnet-with-claudecode/wpf-rule-rendering-antipatterns/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 wpf-rule-rendering-antipatterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/christian289/dotnet-with-claudecode/wpf-rule-rendering-antipatterns"><img src="https://agentmods.dev/badge/skills/christian289/dotnet-with-claudecode/wpf-rule-rendering-antipatterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 31 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 491 The whole file, excluding the scripts and references it only reads on demand.
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.00031 $0.00491
Opus 5.5 $0.00012 $0.00196
Sonnet 5.5 $0.00006 $0.00098
Haiku 4.5 $0.00003 $0.00049

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

Security

Grade A, and why

wpf-rule-rendering-antipatterns 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.

wpf-dev-pack/skills/wpf-rule-rendering-antipatterns/SKILL.md · 76 lines

What it actually says

Rendering Anti-Patterns

Common WPF rendering mistakes that cause performance problems or visual corruption.


Anti-Pattern 1: InvalidateVisual() in a Loop

Calling InvalidateVisual() inside a loop schedules a separate render pass for each iteration. WPF does not coalesce these — each call queues a layout/render cycle, causing frame drops or freezes.

// Prohibited: InvalidateVisual inside a loop
foreach (var item in items)
{
    item.Value = ComputeNewValue(item);
    InvalidateVisual();   // ← queues N render passes
}

Correct: Batch Update Pattern

Mutate all state first, then invalidate once after the loop completes.

// Correct: one invalidation after all state is updated
foreach (var item in items)
{
    item.Value = ComputeNewValue(item);
}
InvalidateVisual();   // ← single render pass

For data-driven scenarios where items notify individually, suppress notifications during bulk update and raise a single reset at the end:

// Correct: bulk update with deferred notification
_suppressNotifications = true;
try
{
    foreach (var item in items)
        item.Value = ComputeNewValue(item);
}
finally
{
    _suppressNotifications = false;
    InvalidateVisual();
}

Anti-Pattern 2: Creating Resources in OnRender

OnRender is called on every render pass (layout changes, animations, window resize). Allocating Brush, Pen, Geometry, or other objects inside OnRender creates garbage on every frame.

// Prohibited: resource allocation inside OnRender
protected override void OnRender(DrawingContext dc)
{
    var brush = new SolidColorBrush(Colors.Red);   // ← allocated every frame
    var pen   = new Pen(brush, 1.0);               // ← allocated every frame
    dc.DrawEllipse(brush, pen, _center, _rx, _ry);
}

Move resource creation to the constructor or a property setter. See freezable-performance.md for the correct constructor-initialize-and-freeze pattern.

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 · 76 lines · 31 tokens per session scan A 985821bbf1dd

Subscribe to this mod's changes

wpf-rule-rendering-antipatterns is a skill published in the GitHub repository christian289/dotnet-with-claudecode (41 stars, last pushed 2mo ago), licensed MIT. It adds 31 tokens to every session and 491 once invoked, about $0.0001 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-09-03.

Related

Other skills, from other repositories

chrome-devtools-mcp

Use Chrome DevTools MCP from .NET agents and .NET-focused repos to inspect, debug, and automate Chrome through an MCP client. USE FOR: the repo needs browser-level debugging for ASP.NET Core, Blazor, WebAssembly, or any .NET app with a web UI; the user wants an MCP server that can inspect console. DO NOT USE FOR: pure…

managedcode/dotnet-skills · 130 tokens

asynkron-profiler

Use the open-source free Asynkron.Profiler dotnet tool for CLI-first CPU, allocation, exception, contention, and heap profiling of .NET commands or existing trace artifacts. USE FOR: Asynkron.Profiler setup; automation-friendly profiling output; CPU, allocation, exception, contention, and heap investigation. DO NOT…

managedcode/dotnet-skills · 122 tokens

managedcode-orleans-graph

Integrate ManagedCode.Orleans.Graph into an Orleans-based .NET application for grain-call policy enforcement, deadlock detection, live-call telemetry, and Mermaid graph diagnostics. USE FOR: ManagedCode.Orleans.Graph integration; allowed grain transitions; Orleans call filters; live policy graphs; reviewing Orleans…

managedcode/dotnet-skills · 114 tokens

maui-ai-debugging

Legacy DevFlow debug skill. USE FOR: maui-ai-debugging, maui devflow, screenshots, visual tree, Blazor CDP, simulator/emulator debugging. DO NOT USE FOR: setup, desktop automation, AppleScript, host xdotool.

dotnet/maui-labs · 62 tokens

maui-ui-patterns

Fix MAUI UI layout, state, and automation issues. USE FOR: CollectionView scrolling, DataTemplate bindings, command bindings, Grid/FlexLayout sizing, binding-driven states, avoiding ScrollView parents, stable AutomationIds, x:DataType, EmptyView/loading/error states. DO NOT USE FOR: Shell routes, full accessibility…

dotnet/maui-labs · 82 tokens

devflow-connect

Diagnose DevFlow agent connectivity. USE FOR: maui devflow connection failures, agent not found, ports, adb forwarding, broker. DO NOT USE FOR: build failures, setup, visual tree, or Blazor CDP.

dotnet/maui-labs · 53 tokens