Apple has made some documentation available on building Scripting Additions. While it doesn’t contain any sample code, it should put you well on your way to getting started. Click here for the documentation.
However, the best available online-resource is Apple’s applescript-implementors mailing list and its archives.
You can find some source code in our Scripting Additions section…