A third way:
Skin blueSkin = skeletonData.findSkin("blue");
int headIndex = skeletonData.findSlotIndex("head");
Attachment blueHead = blueSkin.getAttachment(headIndex, "head");
skeleton.getSlots().get(headIndex).setAttachment(blueHead);
The point here is that you can set any attachment (from any skin or one you created programmatically). Most of the time you want to set an attachment from the skeleton's current skin, so Skeleton#setAttachment(slot, attachment)
is what you want.