Wash the tomatoes and peel them. It's best if the tomatoes you're using are well ripened, to make them easy to peel.
After you've boiled the tomato paste, take it off the stove and leave to cool, then strain through a very fine gauze or strainer (don't wait for it to strain well because we don't want the tomato paste too thick, nor do we want to throw out too much of the tomatoes).
Then distribute the paste into the ice cube bags and freeze. Whenever you need some tomato paste, tear off 1 or several cubes and add them to the dish you're cooking.
You can also add fresh spices of your choice after the tomato paste cools but immediately before pouring it into the ice cube bags. To make it easier to pour it in, I personally used a sports bottle with its narrow nozzle.