The concept of work is clear from mechanics, where $dW=F\cdot dx$, leading to $dW=PdV$. Also different forms of energy are defined in mechanics, e.g., $E=\frac{1}{2}m v^2$, etc. How are the energy and heat defined and measured in thermodynamics?
Because once we define them independently, we can state the first law of thermodynamics, $d E=\delta Q+\delta W$.