I'll start with quoting another Stack Overflow user:
Apple's MacBook Pro has a slight delay on the caps lock key. That is, the caps lock key has to be held down slightly longer than normal to register the key press required to engage the caps lock.*
It appears that by remapping the caps-lock key on macOS (in System Preferences, Keyboard, Modifier Keys), the delay goes away until reboot.
I would like to automate this settings configuration remapping with a script and to set it to run at startup. I have tried to use Automator but with no luck. How can we achieve this?