1. Marginal battery. This can absolutely give you idle/stalling symptoms. And yes, you can have a battery that is plenty strong enough to start the engine, but marginal enough to give the engine management system fits. Have the battery "load tested". Any parts store will do this for free. Load testing is the ONLY accurate way of determining battery condition as voltage testing alone can be misleading.
2. Clean throttle body and idle air control. Here's more.
The Idle Air Control (IAC) is mounted on the back of the throttle body. (front for 87-90) The valve controls the idle speed of the engine by controlling the amount of air flowing through the air control passage. It consists of a stepper motor that moves a pintle shaped plunger in and out of the air control passage. When the valve plunger is moved in, the air control passage flows more air which raises the idle speed. When the valve plunger is moved out, the air control passage flows less air which lowers the idle speed. Over time and miles, the IAC can get carboned up which can have an adverse affect on idle quality. Cleaning the IAC may restore proper function and is an easy procedure to perform and good preventive maintenance so it is never a bad idea.
CLEANING THE JEEP 4.0 IDLE AIR CONTROL
Remove the air filter cover, associated hoses and the rubber boot that goes from the air filter cover to the throttle body. Remove the IAC with a torx driver (2 bolts; one can be kind of hard to get to)
“Gently” wiggle out the IAC from the throttle body. Gasket on the IAC can be re-used if it is not damaged
Clean the IAC with a spray can of throttle body cleaner; inexpensive and available at any place that sells auto parts. Throttle body cleaner is recommended rather than carburetor cleaner as it is less harsh, safe for throttle body coatings and is best for this task. Use cleaner, a rag and a toothbrush and or Q-Tips. Be gentle; don’t twist or pull on the pintle that protrudes from the IAC as it is fragile and you could damage it.
Thoroughly spray clean and flush where the IAC seats in the throttle body with the same spray cleaner
It is also a good idea to clean the entire throttle body itself, the butterfly valve inside of the throttle body and all associated linkage as long as you have things disassembled
Reinstall IAC and check idle quality
99 Cherokee, 4.0 AW4, NP242
Past Jeeps: 49 Willys, 81 Scrambler, 88 Comanche
Without "data", all you have is an opinion!