How to properly work with Leibniz notation This question regards the manipulation of derivatives as if they were fractions. But more generally it also regards doing calculus in a "Leibnizian" way.
Before asking I checked out the current poll of question regarding this topic: link, link and another one for good measure; my objective with this question is to fill in the holes that I think are left open in the discussion of this topic on this site.
In the cited questions is clarified why is incorrect to define the derivate not as a limit but as a fraction, and the consequent importance of knowing the proper definition of the derivative as a limit. This is clear. But when working whit derivatives and integrals I think the usefulness of working with Leibniz notation, and interpreting derivatives as fractions, is beyond any doubt, as this answer points out.
Problem is: when working with imprecise assumptions things can go wrong really fast, and for this reason interpreting the derivative as a fraction has the nomea of a pretty dangerous gamble.
Here are some examples on how this can go terribly wrong:
Example 1:
$$\int \nabla \phi \cdot d\vec{x}=\int \frac{d\phi}{dx}dx+\frac{d\phi}{dy}dy+\frac{d\phi}{dz}dz=\int \frac{d\phi}{dx}dx+\int\frac{d\phi}{dy}dy+\int\frac{d\phi}{dz}dz=\phi+\phi+\phi=3\phi$$
but on the other hand if we state that: $d\phi+d\phi+d\phi=d\phi$ we get the correct result:
$$\int \nabla \phi \cdot d\vec{x}=\int \frac{d\phi}{dx}dx+\frac{d\phi}{dy}dy+\frac{d\phi}{dz}dz=\int d\phi+d\phi+d\phi=\int d\phi=\phi$$
But if we write it with the proper notation of partial derivative then we should elide $\partial x$ with $dx$, even more chaos.
Example 2:
$$\frac{\partial \phi}{\partial x}/\frac{\partial \phi}{\partial y}=\frac{\partial y}{\partial x}$$
by "eliding the $\partial \phi$".
And I am sure I could go on with more example, but I think there is no need.
Question is: is there a ruleset to follow to ensure to not fall for mistakes like this when working with Leibniz notation? I feel like this question hasn't been properly answered in the previous discussion on this topic. And if there is such ruleset, why it works?
Also it's often said that this way of handling derivatives and integrals no longer works when dealing with multivariable calculus, but from my experience it seems to give the correct answer even in this case, what is up with this exactly? Why should it no longer work? For example let's take the integral:
$$\int \frac{\partial \vec{A}}{\partial t} \cdot d\vec{x}$$
It would seem a bit difficult to solve this integral "rigorously", but by interpreting it in a somewhat Leibnizian way we get:
$$\int \frac{\partial \vec{A}}{\partial t} \cdot d\vec{x}=\int \frac{\partial A_x}{\partial t}dx+\frac{\partial A_y}{\partial t}dy+\frac{\partial A_z}{\partial t}dz=\int dA_x \frac{dx}{dt}+dA_y\frac{dy}{dt}+dA_z\frac{dz}{dt}=\int \vec{v} \cdot d\vec{A}=\vec{v}\cdot \vec{A}$$
This seems like a miracle, should we not use this way of working with things like this?
 A: The thing to keep in mind is that partial differentials, as they are commonly notated, are not distinct.  That is, $\partial \phi$ can refer to any number of values.  This is an unfortunate development in the history of mathematics.  One way (but not the only way!) to do it is to notate on the differential which other variables were free (i.e., independent) when taking the derivative.
In this way, if $z = f(x, y)$, then $dz = \partial_x z + \partial_y z$.  If I want to know the partial derivative of $z$ with respect to $x$, that is $\frac{\partial_x z}{dx}$.  In your example above, $d\phi = \partial_x\phi + \partial_y\phi + \partial_z\phi$.  That's why the integral is $\phi$.  This is also why you can't just multiply partials and get rid of one of them.  But it is why Ian's example does work.
Let's say you have $f(x, y) = c$.  Then, $df = \partial_x f + \partial_yf$.  The two partial derivatives, then, are $\frac{\partial_xf}{dx}$ and $\frac{\partial_yf}{dy}$.  If $f(x, y) = c$, then $df = 0$, which means that $\partial_x f + \partial_yf = 0 $ which means that $\partial_yf = -\partial_x f$.  Then we can rewrite the second partial derivative as $\frac{-\partial_x f}{dy}$.  Then, if we put them in ratio with each other, we get:
$$ \frac{\frac{\partial_xf}{dx}}{\frac{-\partial_x f}{dy}} = \frac{\partial_xf}{dx}\frac{dy}{-\partial_xf} = -\frac{dy}{dx}$$
If you rigorously keep track of the differentials, it all works out.  Unfortunately, most mathematical work does not keep track so rigorously.  As I mentioned in my comment, in order for all this to work out as well, you need to deal with higher-order differentials properly as well.  My article "Extending the Algebraic Manipulability of Differentials" covers this.  So, when taking the second derivative, you are actually taking the derivative of $\frac{dy}{dx}$.  If you take differentials seriously, then this is a fraction, and therefore the quotient rule has to be applied.  When you do this, you get the following formula for the second derivative:
$$\frac{d^2y}{dx^2} - \frac{dy}{dx}\frac{d^2x}{dx^2}$$
This is not what most people use for the second derivative, but you can algebraically manipulate the differentials in this equation.  Note that if you use this formula, then the "chain rule for the second derivative" becomes algebraically self-evident.
So, the question was "how do I know when I'm doing it right".  I'm sorry I don't have a definitive answer, but, in general, think about what differentials are, what they mean, and where they are coming from, and only trust formulas if you know how they were derived, since many of them have historically been derived being careless with differentials.
My own hunch is that, since, in the 1800s, the validity of differential thinking was in doubt, and they all thought that derivatives were the only "actual" things, they stopped being rigorous with lone differentials.
