Writing technical specifications is difficult. Writing good technical specifications is even more so. Here’s an excellent practical guide from StackOverflow on how to write technical specifications, which have everything needed, yet not being too excessive or vague.
In the comments, there are a few additional suggestions and links to other similar guides.
The only way this could have been better, if they included a ready-made template with all the described sections, so that one could just fill it in and be done with it.