Creating a valid Codicil requires you to meet essentially the same requirements as creating a valid will.
A Codicil must be written down, signed, and witnessed. It must be created voluntarily by somebody who is of sound mind (ie they’re aware of the contents and implications of the document they’re creating and its effect on their current will).
Your Codicil should be signed and witnessed in line with the rules in the Wills Act 1837, the same way a will would be. The Codicil must be:
signed by hand (ie on paper), and
signed in the presence of two independent witnesses over 18 (in England and Wales) or one independent witness over 16 (in Scotland), who meet(s) other certain criteria (ie are/is not a beneficiary or executor of your will or Codicil)
For more information, read Codicils and Executing a will.
You must also ensure that you do not physically attach your Codicil to your will as this could be considered altering the original will, which would invalidate it. It’s a good idea to store your Codicil in the same place as your will - just don’t attach it. For more information, read Codicils and Storing your will.
Your Codicil must also apply to a current and valid will in order to be effective. If you create an otherwise valid Codicil to a will which has been cancelled and replaced, or which was never valid (eg because it was witnessed incorrectly), the wishes you’ve set out in your Codicil will not stand alone (ie they will not be legally valid and need not be followed when you die).