Consider a container filled with ideal gas and is covered by a frictionless and lightweight piston that exerts pressure on the gas.
I understand that during an isobaric process, the container is in contact with a pressure reservoir, ensuring that the gas is in mechanical equilibrium with its surroundings for the whole process. This process happens quasistatically.
I am uncertain how this process works step-by-step. Suppose a small amount of heat is added to the container, it causes the gas to have greater pressure than its surroundings (in quasistatic process, the pressure of the gas is infinitesimally greater than its surroundings so that $\Delta P$ is negligible which makes pressure constant). In order to respond to this pressure imbalance, the gas expands until mechanical equilibrium is reached. According to the ideal gas law $P\Delta V=nR\Delta T$, volume increase causes the temperature to increase. Did I understand it correctly?
Also there is one thing that bothers me: If gas expands, then it performs work on the surroundings right? In that case, its internal energy should decrease which in turn decreases temperature, according to this formula $\Delta U=\frac{f}{2}Nk_B\Delta T$, no? I am not sure why temperature increases during an isobaric process.