In this paper, we construct Hamilton-Jacobi equations for a great variety of mechanical systems (nonholonomic systems subjected to linear or affine constraints, dissipative systems subjected to external forces, time-dependent mechanical systems...). We recover all these, in principle, different cases using a unified framework based on skew-symmetric algebroids with a distinguished 1-cocycle. Several examples illustrate the theory.