There should be a clsguide.tex or clsguide.dvi file installed with your LaTeX. (Mine is in /usr/share/texmf/doc/latex/base on Linux, or you can get it from ctan.org.) This is a basic starting point. The book "The LaTeX Companion" has a whole chapter about writing class and style files. For actual documentation on all the internal commands, you will need to get the LaTeX source in the .dtx form (from ctan.org), and then run it through LaTeX. This produces a huge boring document that is several