Some visas that are employment-limited specifically mention volunteering and charitable work as problematic. You do not need to personally gain financially. A crude way to tell is "is this an activity which someone could be paid for, even if I'm doing it for free?"
However the practical answer is ask. Some visas like the J1 allow this - even consulting, provided it meets a bunch of criteria and relevant people sign off. It's not a trivial process, but it's not outright forbidden.
However the practical answer is ask. Some visas like the J1 allow this - even consulting, provided it meets a bunch of criteria and relevant people sign off. It's not a trivial process, but it's not outright forbidden.