I just discovered 'moats' so next week I will dig a large ditch around my house and fill it with water, and I'm doing it to protect my toothbrush from communists
That depends, are we talking about a dry moat or a water castle moat?
For any moat, the total height from the top of the wall to the bottom of the most should be enough that the enemy cannot use a ladder to climb over the wall. This was easier to achieve before you could walk into a hardware store and come back with a 40' ladder.
The most itself must be deep enough that your attackers cannot simply walk across it if it is a water moat, and any moat should have difficult terrain at the bottom, concrete tetrapods are great. Just make sure the highest point of the terrain is still deeper than a person could stand in.
The width of the moat should be at least 1:1 with the height of the walls above the waterline, and the wall should extend smoothly from the top to the bottom of the moat, with nothing that could be used as a hand or foot hold.