There is a zsh plugin (zsh-github-copilot) that automates this process. Just type what you want to do, hit a custom keybind, and buffer is replaced by a command that does what you described.
You can also have a second keybind that uses a zle widget to show an annotated description of the command currently in the buffer.
It works surprisingly well, and has saved me from having to dig through manpages several times.