The paper presents a general theoretical model of the behaviour of thermal energy harvesting devices (TEHDs), in which phase-change materials (PCMs) are used for energy storage. The main aim of the model is to establish a set of conditions, under which these devices operate in an optimal way, that is, achieve the highest thermal buffering capacity and rapidly exchange heat with the adjacent phase. An expression for the characteristic harvesting time is derived under the optimal performance assumption from the constructal theory viewpoint. A dimensionless criterion, which characterises the performance of PCMs is introduced. Further, a non-field solution of the energy equation governing the heat transfer process within TEHDs with PCMs has been obtained. An expression for the effective thermal effusivity is then derived. Finally, a concise procedure for the best choice of PCMs in TEHDs under a given set of the boundary conditions and geometrical constraints has been formulated.