i was reading about alternative dark energy models and i stumbled across the concept of quintessence: a scalar field that should generate a dark energy component with a EoS parameter $w$ that varies with the redshift. In particular i wanted to read more about the wcdm model in which $w$ is still a constant but different from -1 but every source i found simply tells that
$$ p= \frac{1}{2} \dot\phi^2 + V(\phi)$$ and
$$ \rho= \frac{1}{2} \dot\phi^2 - V(\phi)$$
without explaining how they reach this conclusion. i know it comes from classical field theory but i was wondering if you could give me a source where it is explained in a more pedagogical way or explain to me what's the procedure to reach this conclusion.