This is my version of a 9V battery cap. Rough sizing and geometry are adapted from muxbux's model, but most of the dimensions and alignment have been changed to work with my printer and my batteries.
As a part of modifying the model, I recreated it in FreeCAD, so now the entire thing is driven by two sketches which you can adjust to adapt the model to your use case. Attached are two images pointing out the adjustable dimensions in the model.
My printer has a 0.6mm nozzle, so this is designed around that. All the wall thicknesses are adjustable, though, so you can make it as sturdy or thin as you want. I have found 9V geometry to be fairly inconsistent, so your mileage may vary for fitment. The snap part is pretty uniform, so you should just need to adjust the skirt dimensions and offset parameter in the sketches.
STEP and STL files are provided for a generic 9V snap with 1mm and 2.5mm inside corner radii. I designed the 2.5mm model to fit my Tenergy Li-Ion 9V batteries. Also provided is a Cura project file with 9 caps set up for my Ender 3
The author remixed this model.
Modified the retention mechanism geometry and adjusted the fitment to the battery. Extended the skirt to overlap the battery. Uploaded parametric model files to geometry can be adjusted easily.