How to measure the capacity of the battery Instantly?
It is not possible to measure or guess the capacity of a battery with a single set of instantaneous measurements, like voltage, current, and temperature.

At best you can tell how much current is going into or out of the battery a what voltage.  However, there is no way to infer capacity from that.  If you can control the load, you can get some idea of the internal resistance, but even that would take at least two measurements separated in time and therefore can not be done instantly.  And, battery voltage and internal resistance does not tell you capacity.