what has helped me is to aim a GoPro camera at the front crank and play back in slo-mo to analyze what happens.
Many times, it's multiple factors that contribute:
- loose BB
- loose chainring bolts
- FD trim / cable-tension
- riding style
This last item was helped by having riders behind me show me videos of myself. Learning to push and pull at the same time out of the saddle allows me to keep the bike and my body perfectly upright. None of the power is wasted flexing the frame laterally and no rubbing of the chainrings or auto shifting.