The cloning potion creates a clone of your character with the same amount of health it has when you use it. In Candy Box the clone is a copy with similar damage but not effects (a "cloned sword") while in Candy Box 2 the clone is a weaker version that uses its fists to attack for 3 damage. It does not inherit gifts.
Making a Cloning potion
A cloning potion is made in the Cauldron by boiling water until it burns and then adding multiples of 1337 candies, stopping, and then bottling in Candy Box or by adding 20000 lollipops and at least 1 candy and stirring until your arms hurt (60 seconds) in Candy Box 2 (a corruption of the Berserk potion).