We develop the XCALIB toolkit to calibrate the beam profile of an X-ray free-electron laser (XFEL) at the focal spot based on the experimental charge state distributions (CSDs) of light atoms. Accurate characterization of the fluence distribution at the focal spot is essential to perform the volume integrations of physical quantities for a quantitative comparison between theoretical and experimental results, especially for fluence dependent quantities. The use of the CSDs of light atoms is advantageous because CSDs directly reflect experimental conditions at the focal spot, and the properties of light atoms have been well established in both theory and experiment. To obtain theoretical CSDs, we use XATOM, a toolkit to calculate atomic electronic structure and to simulate ionization dynamics of atoms exposed to intense XFEL pulses, which involves highly excited multiple core hole states. Employing a simple function with a few parameters, the spatial profile of an XFEL beam is determined by minimizing the difference between theoretical and experimental results. We have implemented an optimization procedure employing the reinforcement learning technique. The technique can automatize and organize calibration procedures which, before, had been performed manually. XCALIB has high flexibility, simultaneously combining different optimization methods, sets of charge states, and a wide range of parameter space. Hence, in combination with XATOM, XCALIB serves as a comprehensive tool to calibrate the fluence profile of a tightly focused XFEL beam in the interaction region.