When my kid kept tarantulas, they did the same thing.
They would split - I forget if it was along the back or belly - and slide out leaving behind a perfect "casting."
I believe animals with exoskeletons fast for some while before molting, to better enable them to squeeze out. But hey - I'm a lawyer, not a biologist! I'm sure theyre are multiple studies written about the specific processes whereby the bonds between the creature and it's old skeleton are separated, various lubricating substances involved, etc.