A new method combining in-situ real-time spectroscopic ellipsometry and optical modeling to optimize the thickness of an anti-reflective (AR) coating for Cu(In,Ga)Se2 (CIGS) solar cells is described and applied directly to fabricate devices. The model is based on transfer matrix theory with input from the accurate measurement of complex dielectric function spectra and thickness of each layer in the solar cell by spectroscopic ellipsometry. The AR coating thickness is optimized in real time to optically enhance device performance with varying thickness and properties of the constituent layers. Among the parameters studied, we notably demonstrate how changes in thickness of the CIGS absorber layer, buffer layers, and transparent contact layer of higher performance solar cells affect the optimized AR coating thickness. An increase in the device performance of up to 6% with the optimized AR layer is demonstrated, emphasizing the importance of designing the AR coating based on the properties of the device structure