Custom Drush command without module
You might be interested in the drushify project, which will create a Drush commandfile for you, from a template.  You can give it the name of a module, and run it from a Drupal site to make a Drush command for a module, or just give it an arbitrary name and run it from outside any Drupal site, and it will create a global Drush command.

From there, you only need to go through and fill in the parts of the template that it made for you.  You may delete any of the optional hooks that you don't need -- which is usually most of them.