I was looking at the magic code master list page in the resouces section.passives
grants player cghosen passive skill.
I tried adding that to automagic.txt and it didn't seem to do anything. I put 129 in on a sword. 129 being Sword Mastery. (Mwa ha ha ha ha ha, Can you imagine a pally weapon with Sword mastery.) 
As stated it didn't seem to do anything at all. Even if it was because I should use SkillID and not the line # of the skill, It should have displayed Mace Mastery.
I noticed that in the passive column in Skills.txt the Masteries have 2 and not a 1. I changed that to a 1 to see if that did anything, but to no avail.
I think this could really enhance my mod, making things have cool passive skills added to them. Sorceress finally getting the Natural resistance she should have to begin with!?
I haven't tried it with any other skills yet, just wanted to test the idea out.