Write a failing test for the functionality you want to implement.
Write just enough code to make that test pass.
If your code is getting ugly, clean it up. Ensure that all tests still pass.
A code kata is an exercise in programming which helps a programmer hone their skills through practice and repetition. Wikipedia
A kata is intended to be completed using Test Driven Development.