Pull the main shell off the crab and discard it. Remove the gray gills and the soft insides. Cut the body in fourths and then cut between each leg. Crack the legs and claws with the back of the knife or a hammer and set aside.
In a large bowl, mix together ketchup, water, cornstarch, soy sauces and tamarind.
Heat skillet and the oil, stir in garlic and shallots. Fry the garlic and shallots for 1 to 2 minutes before adding the chili. Fry another 2 minutes. Add crab pieces and fry until they turn red, about 4 minutes.
Stir sauce mixture into the skillet until the crabs are well coated. Cover the skillet and let simmer on high heat, for 7 minutes or until the shells turn bright red.
Remove cover and stir in the lime juice. Stir in beaten egg until it is fully cooked. Turn the heat off and stir in green onions.
Serve with steamed or fried mantou (Chinese buns), French loaves, toasted sliced bread or plain white rice.