What problem does it solve? Writing XS — the glue between Perl and C — involves subtle failure modes: segfaults from wrong refcounts, leaks from skipped OUTPUT sections, cryptic xsubpp errors from typemap escaping, and silent wrong answers from NULL handles. This Skill provides the operational knowledge to write correct XS bindings and diagnose these failures systematically. ## Core Features & Use Cases - Object and memory management: Attach C pointers to blessed SVs via sv_magicext with per-type MGVTBL free hooks, handle child/parent refcount chains, and use generation counters when C libraries free objects behind your back. - Typemap authoring: Write INPUT/OUTPUT conversion templates with correct TAB indentation, quote escaping, and per-type vtable checks that croak instead of segfaulting. - Build and test discipline: Regenerate ppport.h with NEED_ defines, read generated C from ExtUtils::ParseXS, and test crashes in forked children, leaks with Test::LeakTrace and valgrind, and blocking calls with alarm. - Use Case: You are wrapping a C library like libssh as a Perl distribution and a test segfaults when a parent object is undefined — the Skill explains the SvRV(ST(0)) refcount rule and how to test all three ways of losing a variable. ## Quick Start Ask the AI to help write or debug an XS file, typemap, or Makefile.PL for wrapping a C library in Perl, or to diagnose a segfault, leak, or xsubpp compile error in existing XS code.