Posted this a while back but it is still 100% relevant now and rarely viewed. Also, I decided to revamp the guide a bit to make it easier to read and add facts I know now and did not at the time.
.addtrainerspell <spell id> <training cost> <required spell> <required level> <delete spell>
the first one is the spell id, obviously enough. The spell id is an id assigned to each spell in the database. .char learn <spellid> teaches you the spell using that id, it is also found as the last number string in your web browser on thotbot.com or wowhead.
the second is the training cost, in copper. 0 results in no cost. 1000 is 10 silver, 10000 is 1 gold
third is required spell rank to learn the next rank. e.g. you need rank 2 to learn 3 and 1 to learn 2.
fourth is required level to train for the ability. Again, speaks for itself, 0 results in no level requirement.
Delete spell deletes a spell when learned. Meaning you can make it the id of a spell you want the player to self delete upon learning, like if a patch comes and the spell is removed or you want rank 2 to remove rank 1. either way, that's how it works.
.addtrainerspell 11111 10 0 20 0
gives the trainer spell 11111 and it costs 10 copper and you need to be level 20 to learn it.
This helped me alot when I myself made custom trainers and for those of you who don't know, I'm sure this helps. enjoy!