Automates the creation of XAML unit tests to verify parsing, compilation, and source generation.
Install
mkdir -p .claude/skills/write-xaml-tests && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/4420" && unzip -o skill.zip -d .claude/skills/write-xaml-tests && rm skill.zipInstalls to .claude/skills/write-xaml-tests
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Creates XAML unit tests for GitHub issues in the Controls.Xaml.UnitTests project. Tests XAML parsing, compilation (XamlC), and source generation. Use when testing XAML-specific behavior, not UI interactions.Key capabilities
- →Generates boilerplate test classes for specific GitHub issues
- →Validates XAML source generator logic
- →Executes XamlC compilation verification
- →Applies standardized naming conventions to files
- →Filters and runs specific tests via dotnet CLI
How it works
It reads specific project guidelines and conventions to generate test files and executes the dotnet build and test CLI commands.
Inputs & outputs
When to use write-xaml-tests
- →Test custom markup extensions
- →Validate XAML source generator output
- →Verify XamlC compilation correctness
About this skill
Write XAML Tests Skill
Creates XAML unit tests that verify XAML parsing, XamlC compilation, and source generation behavior.
When to Use
- ✅ Testing XAML parsing/inflation behavior
- ✅ Testing XamlC (IL generation) correctness
- ✅ Testing Source Generator output
- ✅ XAML-specific bugs (bindings, markup extensions, x:Name, etc.)
When NOT to Use
- ❌ Testing UI interactions or visual behavior → Use
write-ui-testsskill - ❌ Testing runtime behavior after page loads → Use
write-ui-testsskill - ❌ Testing platform-specific rendering → Use
write-ui-testsskill
Required Input
Before invoking, ensure you have:
- Issue number (e.g., 12345)
- Issue description - what XAML behavior is broken
- Expected vs actual behavior
Workflow
Step 1: Read the XAML Unit Test Guidelines
cat .github/instructions/xaml-unittests.instructions.md
This contains the authoritative conventions for:
- File naming (
MauiXXXXX.xamlandMauiXXXXX.xaml.cs) - File location (
src/Controls/tests/Xaml.UnitTests/Issues/) - Test patterns with
[Values] XamlInflator - XamlC testing with
MockCompiler - Source Generator testing with
MockSourceGenerator - Special file extensions for invalid codegen (
.rt.xaml,.rtsg.xaml,.rtxc.xaml)
Step 2: Create Test Files
Following the conventions from Step 1, create:
src/Controls/tests/Xaml.UnitTests/Issues/MauiXXXXX.xamlsrc/Controls/tests/Xaml.UnitTests/Issues/MauiXXXXX.xaml.cs
Step 3: Verify Tests Compile and Run
# Build the test project
dotnet build src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj -c Debug --no-restore -v q
# Run specific test
dotnet test src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj --filter "FullyQualifiedName~MauiXXXXX" --no-build
Step 4: Verify Test Behavior
- For bug reproduction tests: Tests should FAIL before fix, PASS after fix
- For regression tests: Tests should PASS to confirm behavior works
Output
After completion, report:
✅ XAML unit test created for Issue #XXXXX
**Files:**
- `src/Controls/tests/Xaml.UnitTests/Issues/MauiXXXXX.xaml`
- `src/Controls/tests/Xaml.UnitTests/Issues/MauiXXXXX.xaml.cs`
**Test method:** `DescriptiveTestName`
**Inflators tested:** Runtime, XamlC, SourceGen
**Verification:** Tests [PASS/FAIL] as expected
References
- Full conventions:
.github/instructions/xaml-unittests.instructions.md - Test project:
src/Controls/tests/Xaml.UnitTests/ - Existing issue tests:
src/Controls/tests/Xaml.UnitTests/Issues/
When not to use it
- →Testing end-to-end UI interactions
- →Verifying post-load runtime page behavior
- →Testing platform-specific visual rendering
Prerequisites
Limitations
- →Limited to XAML-specific compilation and parsing logic
- →Requires manual verification of build outputs
- →Dependent on specific mock objects like MockCompiler
How it compares
It automates compliance with specific project directory and naming conventions rather than just creating generic unit tests.
Compared to similar skills
write-xaml-tests side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| write-xaml-tests (this skill) | 1 | 6mo | Review | Intermediate |
| csharp-pro | 9 | 4mo | No flags | Intermediate |
| performance-benchmark | 3 | 4mo | No flags | Intermediate |
| run-device-tests | 3 | 2mo | Review | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by dotnet
View all by dotnet →You might also like
csharp-pro
sickn33
Write modern C# code with advanced features like records, pattern matching, and async/await. Optimizes .NET applications, implements enterprise patterns, and ensures comprehensive testing. Use PROACTIVELY for C# refactoring, performance optimization, or complex .NET solutions.
performance-benchmark
dotnet
Generate and run ad hoc performance benchmarks to validate code changes. Use this when asked to benchmark, profile, or validate the performance impact of a code change in dotnet/runtime.
run-device-tests
dotnet
Build and run .NET MAUI device tests locally with category filtering. Supports iOS, MacCatalyst, Android on macOS; Android, Windows on Windows. Use TestFilter to run specific test categories.
backend-testing
exceptionless
Backend testing with xUnit, Foundatio.Xunit, integration tests with AppWebHostFactory, FluentClient, ProxyTimeProvider for time manipulation, and test data builders. Keywords: xUnit, Fact, Theory, integration tests, AppWebHostFactory, FluentClient, ProxyTimeProvider, TimeProvider, Foundatio.Xunit, TestWithLoggingBase, test data builders
bunit-test-migration
FritzAndFriends
Migrate bUnit test files from deprecated beta API (1.0.0-beta-10) to bUnit 2.x stable API. Use this when working on .razor test files in BlazorWebFormsComponents.Test that contain old patterns like TestComponentBase, Fixture, or SnapshotTest.
deployment-e2e-testing
dotnet
Guide for writing Aspire deployment end-to-end tests. Use this when asked to create, modify, or debug deployment E2E tests that deploy to Azure.