Keyboard Maestro is essentially an IDE for automation. You create macros of actions that you can then easily call from Karabiner.
It has a wonderful community that is happy to help with whatever you are trying to achieve.
I share all the macros I use with the app.
It is always better to run compiled AppleScripts.
Assert action. "If not condition, then fail". Useful for checking if you got right kind of data.
You need to set ENV_PATH variable to make sure all your shell tools work in KM.
You can read the full text of any error message in the Engine.log file (Help ➤ Open Logs Folder), and make sure (at least when testing or having problems) that the Execute Shell Script is configured to display the result in a window so you can see any error message.
KM forum - Great place to discuss all things related to KM.