There really is not any guide or template for creating classes or talents.
Your best bet is to unpack addons that other people have created (to do so, make a copy of the addon file from your addons folder, change the '.teaa' to '.zip' and extract it) and then starting digging through the text files. Take note of the file structure as you do so, as this is essential to creating a working addon.
You can also do this with any official addons (i.e. DLCs) that you may have, and these are an especially good resource, as they are guaranteed to work without breaking the main game, while user-made addons carry no such assurances. You will also probably want to make a copy of the ToME game file itself, tome.team (on Windows, through Steam, the path is: Program Files(x86) > Steam > steamapps > common > TalesMajEyal > game > modules). Once you've copied it, change the '.team' to '.zip' and extract it (this may take a little while). Just as with the addons, this will yield a folder brimming with text files for you to dig through.
I started off with zero experience with LUA (the langue ToME is coded in), hardly any formal training in code, and the desire to make a new class or two. I started off simple, just hashing together already existing talent trees into a 'new' class that was basically a specialized adventurer. From there I moved onto editing existing talents to create 'new' talents of my own, and eventually I was able to write whole new talent trees from scratch. Trial and error is the best way to learn.
Speaking of errors, when you get them (and you will, I promise) you can open the te4_log.txt file to find the exact line of your code that is causing the game to bug out. This should be in your main ToME folder (again, on Windows and installed via steam, the path is: Program Files(x86) > Steam > steamapps > common > TalesMajEyal). Assuming you close the program right after the error occurs, you should find a block of text that starts with "Error: " and a line or two that will reference the file within your addon and the line within said file that is causing the error, right near the end of the file. This is especially helpful if you cause an error which prevents the game from loading (you will know this has happened if the game freezes up and starts to flicker on the loading screen when the bar reaches 100%), as you won't get an error message pop-up as you would with an error that only occurs after the game has successfully loaded. You'll want to make sure you have a text editor for coding that will denote line numbers, or this will be a real hassles (trust me, I started off coding in NotePad, counting line breaks manually

). NotePad++ is good, free, and also has an option to search multiple text files at once, which is great when you are trying to figure out how certain mechanics are implemented. If you want a cloud-based option, the website Codeanywhere has a great editor which you can sync up to your preferred cloud data storage, such as Google Drive.
Also, you should drop into the #tome channel on rizon IRC (here's a mibbit link for quick browser-based access:
https://client01.chat.mibbit.com/#tome@irc.rizon.net). Many of the devs and several modders idle in this channel, and the folks there have always been very helpful to me.
That's about the best advice that I can give. Good luck!