Does anybody know how the computer decides which unit is "skirmish infantry" and which one is "missile infantry"?

Darth Vader's, Sinuhet's and even the vanilla descr_formations_ai.txt contain reference both types of units. I guess the AI reads this information in export_descr_unit.txt and my question is what attribute[s] make it decide this is a "skirmish infantry unit" as opposed to a "missile infantry unit".

Why I'm asking this is because I want to prevent the AI from putting the slingers behind the lines, since they're not good at firing over the heads of their comrades.

Also I'm curious to know how the AI decideds if a cavalry unit can skirmish or not. Is skirmishing associated only with weapons that are fired or thrown or is there something else?