Though both Scratch and Snap are open source, I can't see any documentation for building on top of either of them. If you're interested in building something in this space, Blockly [1] is essentially the same and has some great docs for working with it (no affiliation).
It's definitely possible but the Scratch Blocks [1] wiki [2] is indeed a little sparse. VEXcode Blocks [3] seem to be a successful product, so somebody must have figured it out.
[1] https://developers.google.com/blockly