If you have an engine monitor, the procedure is:
(1) Take off at sea level on a ‘standard’ day.
(2) Note the EGT of a cylinder (I usually monitor the EGT and CHT of my hottest cylinder) just after take off.
(3) During the climb, lean every couple of minutes to get to the same EGT on that cylinder (no need for absolute precision - close is good enough).
When taking off at higher density altitudes:
(1) Lean to until you reach the same EGT as you noted at #2 above.
(2) Do #3.
This assumes that your engine’s fuel flow has been set up properly.
If you maintain full rich for the entire climb, you are steadily losing power compared with the mixture that is an optimal compromise between power and being kind to your engine.
As the APS people say: It’s now how hard you run your engine, but how you run your engine hard.