Can I make a repeat action into a function keystroke I use Safari to gather information in my family history research, and when I get new names to add to my ‘Tree” I like to capitalise the surnames. Can I do this with keystrokes instead of going to edit/transformations/capitalise every time?
You can add key commands for any menu item in any app, or even globally.

For one like this, globally might be the best approach - I actually use it in Safari as well as TextEdit.

System Prefs > Keyboard > Shortcuts > App Shortcuts 

Click the + button, select All Applications then type your menu name
You don't need to specify any hierarchy, it'll just find it no matter how many sub-menus deep it is.

Add your key command - make it something you're not going to be using elsewhere

Done.



Note for future ref. If you need to access a menu item with ellipsis [3 dots] that it is not the same as 3 full stops [periods] ...  it's a true ellipsis … [hard to tell the difference in here, but they are different characters.]