The chain length probably isn't the issue but a worn cassette or freewheel is. Chains and cogs wear together and if the chain is replace on old cogs, the chain and cog tooth spacing no longer match and the skipping you are experienceing is the result.
So, you now need to replace your cassette or freewheel. The preventative in the future is to change chains frequently or expect to change the chain and cassette together.