As a postdoc, how to make sure I get credit for helping undergrad and grad students?
If you wish to be a coauthor, you should definitely ask if that will happen before you start the work.  Setting clear expectations is the best way to get people to do what you want.  In those cases where you think you cannot become a coauthor, ask the person you are helping to tell your supervisor that you helped them.   Keep a list of things you did and give it to your supervisor when you need letters of recommendation.