Open the Script Editor, then I think File > Open Scripting Dictionary… and pick an app. Gives nouns and verbs it understands. There's a core vocabulary that most anything gets, around manipulating the app lifecycle and windows, but some can do a lot more. You can also record a script, though how well it works varies.

Another system with a better list of all the things available is Automator. You snap blocks together in a pipeline to make stuff happen. It's a more visual Script Editor. You can save the script as a runnable file, or add it to the Services menu systemwide.

// @skematica @kdfrawg