In some cases, $\mathcal{L}$ is not $T-V$. There may not even be a clear distinction between $T$ and $V$ (see below; magnetic field). Sometimes the Lagrangian has to be determined empirically!
Thus, the most general statement is:
The Lagrangian of a system is defined as the physical quantity whose stabilisation is equivalent to the laws of motion.
Stabilize $\cal{A}$, i.e. $\delta \cal{A} = 0$. Result:
$$ \frac{d}{dt}\frac{\partial \cal{L}}{\partial \dot{q}} = \frac{\partial \cal{L}}{\partial q} $$
Mnemonic: ‘Cancel’ the dot derivative.
$$ \dot{\left( \frac{\partial \cal{L}}{\partial \dot{q}} \right)} = \frac{\partial \cal{L}}{\partial q} $$
Note. The principle of least action is a ramification of fundamental results in quantum mechanics.
$$ p_i = \frac{\partial \cal{L}}{\partial \dot{q_i}} $$
$$ \dot{p_i} = \frac{\partial L}{\partial q_i} $$
If $q_i$ does not appear in the Lagrangian, then $q_i$ is cyclic.