Contracts page on Bitcoin Wiki [0] is classic, unfortunately to understand most of it one has to know how script and various extensions (lock time etc.) work. Generally I'd advise reverse engineering how Bitcoin works, something like this [1] in JavaScript. There is also high level description of some contract types [2] but it's basically the same content as on Bitcoin Wiki.