When I use Extendscript Toolkit, I always want to start with the same foundation, setting up an IIFE so I can play and not fuck with After Effects scripting global scope. For this example, the snippet below is what I want to start with.

(function () {
    
})(); 

Note: This involves editing ESTK Required files. Edit at your own risk!

These files are located here on Windows:
C:\Program Files (x86)\Adobe\Adobe ExtendScript Toolkit CC\Required


Method 1: Prepopulate temp file on Startup

01startup.jsx, line 246

If you only want to set up default text when ESTK starts up, on a blank document, use this method.

Replace this:

if( docwin && docwin.docObj )
docMgr.activateDocument( docwin.docObj );

with this:

if( docwin && docwin.docObj ) {
 docMgr.activateDocument( docwin.docObj );
 docwin.docObj.setText("(function () {\n\t\n})();\n", false);
}

Method 2: Prepopulate 'new file':

61fileMenu.jsx, line 33

If you want to set up default text when creating a new document (via File => New, or Ctrl+N), use this method.

Replace

menus.file.newFile.onSelect = function()
 {
 if( app.modalState ) return;
 docMgr.create();
 }

With

menus.file.newFile.onSelect = function()
 {
  if( app.modalState ) return;
  docwin = docMgr.create();
  docwin.docObj.setText("(function () {\n\t\n})();\n", false);
 }

Method 3: Prepopulate global 'new document' action

78documentmanager.jsx, line 91

This goes further upstream – any 'new document' action (such as opening ESTK, or making a new file) will now be prepopulated with your snippet. Broadest option.

Replace

if( !text )
 text = "";

With

if( !text )
 text = "(function () {\n\t\n})();\n";

While ESTK still works on Windows, it's no longer supported on MacOS, and as a result Adobe has transitioned out of using it. The official Extendscript development environment is now a plugin for Visual Studio Code– see how I use VS Code here.