gum-cross-platform-unification

Unifies per-platform Gum runtime classes into single shared source files with #if directives.

614|78|Updated Mar 11, 2015
One-click install
npx skills add https://github.com/vchelaru/Gum --skill gum-cross-platform-unification
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gum-cross-platform-unification
Source: https://github.com/vchelaru/Gum/tree/main/.claude/skills/gum-cross-platform-unification
Command: npx skills add https://github.com/vchelaru/Gum --skill gum-cross-platform-unification

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The Gum UI framework maintains duplicate runtime classes (SpriteRuntime, TextRuntime, ColoredRectangleRuntime, etc.) across MonoGame, Raylib, Skia, KNI, and FNA backends, causing drift, inconsistent behavior, and triple the maintenance cost. This Skill guides the safe consolidation of those per-platform copies into one canonical source file with conditional compilation.

Core Features & Use Cases

  • Divergence Classification: Distinguishes platform-necessary differences (kept under #if) from historical drift (corrected), with a mandatory checklist covering base class, HasEvents defaults, constructor defaults, renderable types, and Clone() overrides.
  • Incremental Convergence: Drives two per-platform file copies toward byte-identical content block by block, then links the unified file into each backend's csproj via <Compile Include> entries.
  • Pitfall Prevention: Encodes hard-won rules such as never promoting decorative runtimes to InteractiveGue, never redeclaring base-class properties, never widening obsolete APIs, and handling #nullable context and duplicate extension methods in linked files.
  • Use Case: When asked to unify ColoredRectangleRuntime across MonoGame and Raylib, the Skill walks through diffing both files, surfacing every disagreement to the user before writing code, then producing the unified file and csproj links.

Quick Start

Unify the SpriteRuntime class across the MonoGame and Raylib backends following the cross-platform unification pattern.

Frequently Asked Questions about gum-cross-platform-unification

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

FAQPage Schema
How do I unify duplicate runtime classes across MonoGame, Raylib, and Skia?

Diff all per-platform copies, classify each difference as platform-necessary or historical drift, then write one canonical file in MonoGameGum/GueDeriving with #if RAYLIB/#if SKIA guards and link it into the other csprojs via Compile Include entries. Unify only one platform pair per pass.

What is the pattern for sharing one C# source file across multiple csproj backends?

Place the canonical file in one project and add <Compile Include="..\path\File.cs" Link="File.cs" /> to the consuming csprojs. Use #if directives with per-backend symbols like RAYLIB, SKIA, and XNALIKE for platform-specific branches.

Why does promoting a runtime to InteractiveGue break click-through behavior?

InteractiveGue sets HasEvents, which makes the element absorb pointer events. Promoting a decorative runtime like ColoredRectangleRuntime silently breaks click-through in every downstream project with no compile or runtime error, so base-class changes must always be confirmed first.

Can I unify more than two platforms in a single change?

No. The incremental unification rule limits each pass to one platform pair: unify, build AllLibraries.sln, run filtered tests, then proceed to the next platform. This keeps changes reviewable and prevents build errors in one backend from blocking the whole effort.

Why do linked shared files fail with CS8632 nullable warnings in some projects?

The #nullable context comes from the consuming project, not the file, so a linked file's string? annotations raise CS8632 in projects without <Nullable> enabled. Add #nullable enable at the top of the shared file so it compiles cleanly in every consumer.

When should this unification pattern not be applied?

Do not apply it to tool code, GumCommon code, Forms controls, or duplication between two different runtime classes on the same platform, which is a composition problem instead. It targets only files that already exist as per-platform duplicate copies heading for a single linked home.