To undo the lens cap I gently rotate the barrel out until I can get a couple of fingers in the gap. Then I hold the barrel with thumb and forefinger while unscrewing the cap. To attach the cap, I try to tighten the cap gently if there's no room to grip the barrel, or I grip the barrel and tighten.
Bottom line for me is grip the barrel while tightening/loosening wherever possible, or be as gentle as you can be when you can't. I just don't want this thing to go all wobbly on me until at least 30 years have passed.