---
name: avalonia-viewmodels-zafiro
description: "Optimal ViewModel and Wizard creation patterns for Avalonia using Zafiro and ReactiveUI."
risk: none
source: community
date_added: "2026-02-27"
---

# Avalonia ViewModels with Zafiro

This skill provides a set of best practices and patterns for creating ViewModels, Wizards, and managing navigation in Avalonia applications, leveraging the power of **ReactiveUI** and the **Zafiro** toolkit.

## Core Principles

1.  **Functional-Reactive Approach**: Use ReactiveUI (`ReactiveObject`, `WhenAnyValue`, etc.) to handle state and logic.
2.  **Enhanced Commands**: Utilize `IEnhancedCommand` for better command management, including progress reporting and name/text attributes.
3.  **Wizard Pattern**: Implement complex flows using `SlimWizard` and `WizardBuilder` for a declarative and maintainable approach.
4.  **Automatic Section Discovery**: Use the `[Section]` attribute to register and discover UI sections automatically.
5.  **Clean Composition**: map ViewModels to Views using `DataTypeViewLocator` and manage dependencies in the `CompositionRoot`.

## Guides

- [ViewModels & Commands](viewmodels.md): Creating robust ViewModels and handling commands.
- [Wizards & Flows](wizards.md): Building multi-step wizards with `SlimWizard`.
- [Navigation & Sections](navigation_sections.md): Managing navigation and section-based UIs.
- [Composition & Mapping](composition.md): Best practices for View-ViewModel wiring and DI.

## Integration boundaries

Guide snippets omit imports, interfaces and application services; verify APIs/source-generator syntax against the installed Zafiro/ReactiveUI version. Do not mix field-based and partial-property generator styles without checking compatibility. Use one actual section registration method rather than assuming both are required. Keep the service provider alive for the app lifetime and dispose it and subscriptions on shutdown; handle wizard cancellation/failure before committing side effects. Angor files named below are external examples, not bundled prerequisites.

## Example Reference

For real-world implementations, refer to the **Angor** project:
- `CreateProjectFlowV2.cs`: Excellent example of complex Wizard building.
- `HomeViewModel.cs`: Simple section ViewModel using functional-reactive commands.

## When to Use
This skill is applicable to execute the workflow or actions described in the overview.

## Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.


---
Source attribution: SuperJMN
Original project: https://github.com/sickn33/agentic-awesome-skills/blob/c6df6cee4c65632533e33316552e8425d9d7af6a/skills/avalonia-viewmodels-zafiro/SKILL.md
License: CC-BY-4.0
License information: https://creativecommons.org/licenses/by/4.0/
Original upstream instructions; downloaded from Mega AI Hub.


# Mega AI Hub resource metadata

Creator / publisher: SuperJMN
Original project: https://github.com/sickn33/agentic-awesome-skills/blob/c6df6cee4c65632533e33316552e8425d9d7af6a/skills/avalonia-viewmodels-zafiro/SKILL.md
Attribution basis: Original package contribution recorded in publisher Git history

Fields of work: Development & Engineering
Roles: Software Developer
Specialties: Specialty not specified
Tools: Tool not specified
Country applicability: Country not specified
Classification basis: Dave AI task review of package instructions and description
Instruction SHA-256: ed15b33c38d4b1e2c30e160e214368cdecd7aeecc09b2f0dfd4c285c24bec3a6
Metadata reviewed: 2026-10-27
This metadata supersedes earlier Mega AI Hub catalog attribution. Original instruction and supporting files are preserved.
