Templates are basically just regular
.sketch files. Sketch uses a different workflow to open them though (templates are opened as
Untitled documents). In order to open any sketch file as a template - use the following code snippet from a dedicated command in your plugin bundle:
var filePath = "/paths/to/document.sketch";
Custom templates are stored at the following location and you can copy the template bundled with your plugin to the template folder any moment:
Sketch has a built-in file watcher that constantly monitors changes in ^ this folder, thus you custom template will appear in the menu immediately as soon as it copied. The only problem here is that there's no such action as
PluginBundleWasInstalled or something similar to hook up some handler and copy required templates.