I've seen the question Equivalent definitions of vector field pertaining to the equivalence of two definitions of a vector field, but in my differential geometry lecture notes, a certain formula springs out seemingly out of nowhere: if $f \in C^{\infty}(M)$, and if $X$ is a vector field, we can understand it as a function from $C^{\infty}(M) \to C^{\infty}(M)$, $X(f)(x) = df(x)(X(x)) \in \mathbb{R}$.
Now in the linked question, I guess this is kind of close to the second definition, because at least the domain and the range are the same. However, the second definition in the linked question makes no mention of the differential of the smooth mapping $f$ that the vector field is "attacking".
Did I write it down wrong, or does this expression actually make sense? If so, how is it equivalent to the second definition in the link? I can't even check that $X$, defined like this, satisfies Leibniz's rule - $d(fg)(x)(X(x)) = (X(x))(\cdot \circ (fg))$ - where $\cdot$ is an empty spot left for a function $h \in C^{\infty}(fg(p))$ - I guess this is a function from $\mathbb{R}$ to $\mathbb{R}$ - so, other than my previous question, my question is also - how do I check the Leibniz rule and linearity for this mapping?