add-sample

Generate XAML and C# code-behind files for new Uno Platform sample pages.

10.0k|872|Updated May 7, 2018
One-click install
npx skills add https://github.com/unoplatform/uno --skill add-sample
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-sample
Source: https://github.com/unoplatform/uno/tree/main/.claude/skills/add-sample
Command: npx skills add https://github.com/unoplatform/uno --skill add-sample

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill automates the creation of new UI sample pages for the Uno Platform, ensuring all necessary files, code-behind, and project registrations are correctly set up, preventing common errors.

Core Features & Use Cases

  • Automated File Generation: Creates .xaml and .xaml.cs files for new samples.
  • Correct Registration: Automatically adds the sample to the UITests.Shared.projitems file, which is crucial for the sample to appear in the app.
  • Standard Templates: Uses predefined templates for XAML and C# code-behind, including necessary attributes like [Sample].
  • Use Case: When adding a new sample for the Button control demonstrating CustomStyle, this skill will generate Button_CustomStyle.xaml, Button_CustomStyle.xaml.cs, and update the project file, ensuring it's immediately discoverable and functional.

Quick Start

Use the add-sample skill to create a new sample for the 'Slider' control called 'BasicUsage'.

Frequently Asked Questions about add-sample

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create new UI sample pages for the Uno Platform?

To create new UI sample pages for the Uno Platform, you need to generate XAML and C# code-behind files with correct namespaces and attributes, then register them in the project. This skill automates that file generation and updates the necessary project items for immediate discoverability.

What is the process for adding XAML samples to SamplesApp?

Adding XAML samples to SamplesApp requires creating the `.xaml` and `.xaml.cs` files using standard templates, and registering the sample in the `UITests.Shared.projitems` file. This ensures the sample appears and functions correctly within the app.

Can I use predefined templates for WinUI control samples?

Yes, you can use predefined templates for WinUI control samples. The generation process follows established patterns for the XAML framework, Shapes, and Media controls, automatically including necessary attributes like `[Sample]` in the C# code-behind.

Why does my new Uno Platform sample not appear in the app?

Your new Uno Platform sample might not appear because it lacks proper registration in the `UITests.Shared.projitems` file. Automatically adding the sample to this project file is crucial for making it discoverable and functional within the SamplesApp.

How do I generate C# code-behind files with correct namespaces for Uno Platform?

Generating C# code-behind files with correct namespaces for Uno Platform involves using standard templates that automatically configure the required structure and attributes. This prevents common errors by ensuring proper integration within the SamplesApp project.