Shadow Boxing, absolutely.
But Shadow boxing isn’t supposed to be what a lot of people thing it is.
People think Shadow boxing is supposed to be at 100% speed and effort. It’s not.
Shadow boxing is a warmup and technical drill, to be done at most medium speed and effort. The way I shadowbox is roughly 50% speed and work on my technique. Make sure every punch, kick, or swing is done correctly at a technical level.
You also work counters by visualizing an opponents action and responding appropriately.
Too much effort and speed in shadow boxing is terrible for your joints, and slowing it down has the added benefit of not taxing the joints nearly as much.