Almost every book on physics that I read have some weird and non-clear explanations regarding the potential energy. Ok, I do understand that if we integrate a force over some path, we'll get a difference in some origin-function values ($\int_{A}^{B} Fdx = U(B) - U(A)$). This function is the potential energy. Of course, whether we can define this term or not depends on the force.
Now, here's an example of explanation (to be more precise - lack of explanation) regarding the GPE from one of the books:
"...When a body moves from some point A to point B, gravity is doing work: $U_A-U_B=W_{A \to B}$. The magnitude can be calculated using an integral: $W_{A \to B}=\int_{r_A}^{r_B} F(r) dr = \int_{r_A}^{r_B} \left(-\frac{GMm}{r^2} \right)dr=(-\frac{GMm}{r_A})-(-\frac{GMm}{r_B})=U_A-U_B$
...
Thus, when $r_A>r_B$, the magnitude is positive and therefore $U_A>U_B$. In other words: when the distance between the bodies is being increased - the gravitational potential energy of the system is also being increased.
Giving absolutely no explanation on why all of a sudden they put a minus sign into the integral.
From another book:
Work done by Coulomb's force: $W_{el}=\int_{r_1}^{r_2}\frac{q_1q_2dr}{4 \pi \epsilon_0 r^2}=\frac{q_1q_2}{4 \pi \epsilon_0 r_1}-\frac{q_1q_2}{4 \pi \epsilon_0 r_2}$
... Calculating the work gravity is doing is no different from the calculation of the work done by an electric field, with two exceptions - instead of $q_1q_2/4 \pi \epsilon_0$ we should plug $G M m$, and we also should change the sign, because the gravitational force is always a force of attraction.
Now, this is not satisfying at all. So what if it is an attraction force? How this should influence our calculations, if the work is defined as $|F| |\Delta x| \cos \theta$, so the sign only depends on the angle between the path vector and the force vector? Why they put a minus sign? Is is just a convention or a must thing to do?
Some say the sign is important, others say the opposite. Some explain this as a consequence of that we bring the body from infinity to some point, while others say it is a consequence of an attractive nature of the gravitational force. All of that is really confusing me.
Also, in some of the questions like "what work is required to bring something from point $A$ to point $B$ in the field of gravitational/electric force", the books sometimes confuse $U_A-U_B$ and $U_B-U_A$ - as I understand it - the work that I must do is always $U_B-U_A$. However the work that the force that is being created by the field do is always $U_A-U_B$, am I correct?