What problem does it solve? Writing native Windows interop in C#/.NET is error-prone: incorrect P/Invoke signatures, wrong handle ownership, mismatched calling conventions, and architecture-specific bugs can compile cleanly yet cause memory corruption, leaks, and crashes. This Skill provides structured guidance to design, implement, review, and debug native interop correctly. ## Core Features & Use Cases - Declaration Strategy Selection: Guides choosing between CsWin32, LibraryImport, DllImport, GeneratedComInterface, and WinRT projections based on the API layer and project constraints. - ABI and Lifetime Correctness: Covers typed handles, SafeHandle ownership, structure layout, string encoding, HRESULT vs Win32 errors, COM apartments, and callback lifetimes. - Architecture and Deployment Validation: Addresses x64/ARM64/x86 differences, AnyCPU pitfalls, NativeAOT/trimming compatibility, packaging models, and secure DLL loading. - Use Case: When adding a Win32 call to a WinUI 3 app, use this Skill to generate the correct CsWin32 declaration, wrap it behind a SafeHandle-based service, and validate error handling and architecture behavior. ## Quick Start Ask the AI to review or implement a specific native interop call in your C# project, such as adding a CsWin32-based Win32 API call with correct handle ownership and error handling.