Skip to content

BumpyClock/agent-templates / skills_archive/merged-into-parent/winui-packaging

winui-packaging

Verified

MSIX packaging, code signing, and distribution for WinUI 3 apps — build for release, certificate generation (winapp cert generate), certificate trust, code signing (winapp sign), self-contained deployment, CI/CD with GitHub Actions, and Microsoft Store submission. Use when preparing for release, creating MSIX installers, managing certificates, setting up CI/CD packaging, or publishing to the Microsoft Store.

FileKindSize
SKILL.mdskill md5.5 KB
references/sourcegen-patterns.mdmarkdown3.0 KB

references/sourcegen-patterns.md

View on GitHub
# Source Generator Patterns — Detailed Reference

Detailed code patterns for AOT compilation and source generators. See [SKILL.md](../SKILL.md) for rules summary.

---

## Trimming Configuration

```xml
<PropertyGroup>
  <PublishTrimmed>true</PublishTrimmed>
  <TrimMode>full</TrimMode>
  <SuppressTrimAnalysisWarnings>false</SuppressTrimAnalysisWarnings>
</PropertyGroup>
```

For reflection-heavy code, annotate to preserve members:

```csharp
public void LoadService([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type serviceType)
    => Activator.CreateInstance(serviceType);
```

---

## Trim Compatibility Testing

Keep warnings enabled during development:

```xml
<SuppressTrimAnalysisWarnings>false</SuppressTrimAnalysisWarnings>
<TrimmerSingleWarn>false</TrimmerSingleWarn>
```

Patterns to eliminate:

- `Type.GetType("MyNamespace.MyClass")` — use `typeof(T)` or `[DynamicDependency]`
- `Activator.CreateInstance(someType)` without `[DynamicallyAccessedMembers]`
- `Assembly.LoadFrom()` — use compile-time references
- Unattributed reflection: `typeof(T).GetProperties()`

---

## JSON Source Generator Setup

```csharp
[JsonSerializable(typeof(UserProfile))]
[JsonSerializable(typeof(List<UserProfile>))]
internal partial class AppJsonContext : JsonSerializerContext { }

// No reflection at runtime
var json = JsonSerializer.Serialize(profile, AppJsonContext.Default.UserProfile);
var obj = JsonSerializer.Deserialize(json, AppJsonContext.Default.UserProfile);
```

---

## Regex Source Generator

```csharp
public partial class InputValidator
{
    [GeneratedRegex(@"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$")]
    private static partial Regex EmailRegex();
    public bool IsValidEmail(string input) => EmailRegex().IsMatch(input);
}
```

---

## XAML Compilation (x:Bind)

```xml
<!-- ✅ AOT-safe: compile-time generated -->
<TextBlock Text="{x:Bind ViewModel.Title, Mode=OneWay}" />

<!-- ❌ Reflection-based, not trim-safe -->
<TextBlock Text="{Binding Path=Title}" />
```

Set `x:DataType` on pages: `<Page x:DataType="viewmodels:MainViewModel">`

---

## CsWin32 Setup

Generates P/Invoke wrappers at compile time. Add `Microsoft.Windows.CsWin32` NuGet package. List needed APIs in `NativeMethods.txt`:

```
GetDpiForWindow
SetWindowPos
ShowWindow
```

---

## CommunityToolkit.Mvvm Source Generators

Use partial properties (CommunityToolkit.Mvvm 8.4+). The legacy field form emits **MVVMTK0045** in WinRT/WinUI projects.

```csharp
public partial class SettingsViewModel : ObservableObject
{
    [ObservableProperty] public partial string UserName { get; set; }
    [RelayCommand] private async Task SaveAsync() => await _service.SaveAsync(UserName);
}
```

---

## Single-File Publishing Configuration

```xml
<PropertyGroup>
  <SelfContained>true</SelfContained>
  <PublishSingleFile>true</PublishSingleFile>
  <EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
</PropertyGroup>
```

Primarily for unpackaged apps. Combine with `<PublishTrimmed>true</PublishTrimmed>`.
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 319kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 118kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 117kUpdated Claude CodeCodexVerifiedInstall