My urologist gave me the green light to start macrobid at the first sign of a UTI symptom and and stop taking the macrobid once the symptom goes away. My first symptom is usually a sharp increase in muscle spasms without any other explanation. Doctor said this method does not apply in general but it's fine to manage UTI symptoms.
Before, I would try to increase water intake for several days. If that wouldn't work, I'd wait for lab sensitivities. Two weeks could go by before I'd finally take an antibiotic. In that time, the spasms would grow stronger every day and other symptoms may start too. In hindsight, I'll go as far as to say that all this waiting made the antibiotics less effective. Because waiting enables bacteria to grow stronger and more resistant.
Now I don't wait. First sign and I take a macrobid. Often one pill is all it takes to stop the spasms if I nip it in the bud. I find this to be a very effective way to manage acute leg spasms (of course, it's not the answer for chronic spasms). 36 years, and still learning!