Do:
Document every verbal counseling, incident, or attack that happens in the workplace.
Forward all disciplinary or negative emails to your personal account.
Ask for all repirmands/counseling to be in email form.
Don't:
Have personal conversations using corporate tools (slack, teams, etc.)
Give out the forms (excel, code, etc) that you've built to make your job easier.
Trust HR. They are there to protect the company, and if your rights become more expensive to them than keeping you, they'll drop you in a heartbeat.