I've had a go at implementing the primary/secondary specialisation, and here's what I've come up with. I'm not sure how foolproof it is, but it worked on the limited testing I was able to do.
I've left in all my debug comments (which I used print() for, not debug() )
--[[
Skills2 0.4.2 -...