Ok so this actually doesn't have to do with a b6 a4, but my other car, a 97 vw passat glx vr6. So the problem i'm having is... this morning when i went to start my car it would start in normal time, had no trouble starting at all. Keep in mind it's moderate weather outside, about 80 degrees or so. The problem was that the car was having a lot of trouble staying started. I would start it and of course it would do the normal rev to about 1500 rpm's and then drop back to about 1k rpm's to idle. And when it would drop back down to idle the rpm's would just fall all the way to zero and the car would shut off. It did this about 7 times so eventually i went to open the hood to see if anything was wrong.

I still had the key in the ignition turned so that electricity would be flowing to the car. And when i opened the hood i heard my open door chime as if the battery kicked in from being off. So i started the car and it went to drop again but caught itself at about 500 rpm's, just before shutting off, and then went back to 1k and idled steadily. So i figured it was my battery since all my electronics and my alarm reset in my car just like they do when i disconnect the battery terminals. So i went home and looked at the battery terminals to make sure they were tight enough and they were. But i noticed they were very dirty and corroded. So i spent about a half hour taking apart all the wires, screws, and bolts, from both terminals and i used to degreaser and a wire brush to clean each piece completely. Then i cleaned the actual terminals themselves in the same manner. Dried them all off and put it all back together.

So all day today i haven't had any problem with starting my car but it has been doing something unusual. When i start the car it still drops to about 500 rpm's and sounds like it's gonna die and then goes back up to 1k and idles. The car drives fine, but another wierd thing it's doing is once i get going and drive around (for any period of time at all, it could be for 10 ft or 2 miles) once i start coming to a stop the engine drops to 500 and comes back up again and slightly rattles as if it's wanting to die. It does this low rpm and back up again thing about 4 times once i'm completely stopped and then idles fine again. But i'll get going again and once i stop the exact same thing happens all over again. And i've checked my oil and all my fluids which i know shouldn't be the case since i changed and filled all of them last week. And i have about 5.5 gallons of gas in my tank right now so it shouldn't be a gasoline problem. Besides the battery what could be the problem?