The work contribution in more detail

The change in the internal energy (U) of the system can be represented mathematically by: 

ΔU = q + w
 
q is positive if heat is transferred TO the system from the surroundings (as in an endothermic reaction)
q is negative if heat is transferred FROM the system to the surroundings (as in exothermic reactions)

w is positive if work is done ON the system (as when a gas is compressed by a piston)
w is negative if work is done BY the system (as when a gas expands against a constant pressure)
 
The work contribution to changes in internal energy of a chemical reaction system is most significant for reactions involving gases.

For processes done at constant pressure (open to the atmosphere):

Work is done by the system on the surroundings if the system expands (it pushes back the surrounding atmosphere).
The system expands if the number number of gas molecules increases as the reaction proceeds.
 
For the decomposition of limestone, the system expands: 
CaCO3(s CaO(s) + CO2(g)
 
.Work is done on the system if the system contracts (the atmosphere pushes the particles in the system closer together).
The system contracts if the number of gas molecules decreases as the reaction proceeds.
 
For the synthesis of ammonia, the system contracts: 
N2(g) + 3H2(g  2NH3(g)

For processes done at constant pressure the work done on or by the system can be calculated:  w = -PΔV
ΔV = Vfinal - Vinitia
The SI unit for work is joule which is a N m (newton metre).
The SI unit for pressure is Pa which is N m–2 (newton per metre squared)   This can also be expressed as J m–3
Therefore the unit joule (for work) comes directly from using m3 (1 L = 10–3 m3) in the calculation above.
 

Example: A system that occupies 3 L (3 × 10–3 m3) expands to occupy 4 L (4 × 10–3 m3) at an external pressure of 100 kPa. 
w = – 100 000  J m–3 × 1 × 10–3 m3 = –100 J
The sign is negative because it is an expansion and the system does work on the surroundings and has a lower internal energy as a result.