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.
- Assert action - "If not condition, then fail". Useful for checking if you got right kind of data.
- It is always better to run compiled Applescripts.