Assume I have a function $f \in L^2(R^d,\mu)$ or $f \in L^1(R^d,\mu)$.
A. Now I know that it as distributional derivative, right?
I call that $\partial f$.
B. If I can show now that $\int (\partial f)^2 \mu < \infty $ is then clear that $\partial f \in L^2(R^d,\mu)$? And hence $f$ weakly differentiable and hence $f$ in the Sobolev space of twice differentiable functions?
C. Or am I not allowed to write something like $\int (\partial f)^2 \mu$? When am I allowed to write this?
Distributions act on (or "can be integrated against") smooth functions - thus the expression $\int (\partial f)^2$ doesn't make sense in general. To establish that $f$ is Sobolev, you need to first check that $\partial f$ is a function (technically that $\partial f = g \mu$ for some function $g$; but it's standard to conflate $\partial f$ with $g$ when the measure is fixed).
Once you have established this, you indeed just need to check that $\partial f$ is square-integrable, which is now a meaningful condition.