Car died during driving

I would start by pulling the battery cables and properly cleaning them. SUSPECT A BAD BATTERY. ..... .. . ..I had one do this exact thing years ago, an inter-cell connector was loose. It was a "great" battery.......it just lost connection internally!!!

I drove the car today...Gone to work fine. Left work still working good....Stop by the store...Come out tried to start... Nothing...I had no lights.....No engagement of starter. Just to check I jumped the starter relay. Still nothing. Took off cables and scraped best I could....Put em back on, tightened them up still nothing. Finally after I kept moving the cables the starter turn over. Gone back inside switch on efi an msd box (fuel pump will energize even when the electrical freaking out)..... Hit the starter again... Thunk thunk. So I hit the starter a few times an BAM ..... start right up....Drove home....Did some cycles of the key and started everytime.... I'm goin to change out the cables and I have a spare starter to try if after replacing the the cables don't fix it....