Ymmv: I’ve found an awesome rule is to have a directive as follows:
Do not execute terminal commands dutrextly.
Always make a /scripts/ .ps1 file, with comments and description and execute that.
I love this because then I have it keep a .end table for all my scripts and I have the .sql files saved in /scripts/Postgres and any db functions are tools with .env db creds/connection string, then .ps1 which calls the .sql
And I have tables of what all they do in Postgres so I can reuse functions across agents wxevtually