1Prepare the shrimp. You can use shell-on or peeled shrimp - shell-on shrimp have more flavor and the shells become deliciously caramelized, but peeled shrimp are easier to eat. If using shell-on, leave the shells intact but devein by cutting along the back with scissors and removing the vein. If using peeled shrimp, devein and pat very dry with paper towels - moisture will cause the caramel to seize and sputter. Mince the garlic and slice the shallots. Have all ingredients measured and ready by the stove as this dish comes together very quickly.
2Make the caramel sauce. In a large skillet or wok, combine the sugar and water. Cook over medium heat without stirring, swirling the pan occasionally, until the sugar melts and turns a deep amber color - about 4-5 minutes. Watch carefully as the caramel can burn quickly. The color should be like dark honey or coffee - darker than Western caramel but not black. The caramel will have a slightly bitter, complex aroma. This is the foundation of the dish''s flavor, so do not rush this step. Remove from heat immediately once it reaches the right color to prevent burning.
3Carefully add the vegetable oil, minced garlic, and sliced shallots to the hot caramel - stand back as it will sizzle and sputter. Stir quickly to coat the aromatics in the caramel. Return to medium heat and cook for about 30 seconds until fragrant. Add the fish sauce and soy sauce - the mixture will bubble vigorously. Stir to combine and let it simmer for about 30 seconds until the sauce comes together and the bubbling subsides slightly. Add the coconut water or plain water to thin the sauce to a syrupy consistency.
4Add the shrimp to the caramel sauce in a single layer. Cook without stirring for about 1-2 minutes until the bottoms begin to turn pink and caramelize slightly. Flip each shrimp and cook for another 1-2 minutes on the other side. The shrimp should be pink and opaque throughout - do not overcook or they will become rubbery. The sauce should coat each shrimp in a glossy, dark glaze. If the sauce seems too thick, add a splash more water. If too thin, let it reduce for another minute.
5Add the black pepper and sliced Thai chili if using. Toss the shrimp in the sauce to coat evenly. Taste the sauce and adjust seasoning if needed - add a pinch more sugar for sweetness, more fish sauce for saltiness, or more pepper for heat. The flavor should be a perfect balance of sweet, salty, and savory with a slight caramel bitterness that adds depth. Remove from heat - the shrimp will continue cooking in the residual heat.
6Transfer the tom rim to a serving plate, making sure to spoon all the delicious caramel sauce over the shrimp. Garnish with sliced green onions for color and freshness. Serve immediately over steamed jasmine rice - the sauce is meant to be spooned generously over the rice, flavoring each bite. Tom rim is also delicious with a side of steamed vegetables or a simple cucumber salad to balance the richness. The dish is best eaten immediately while the shrimp are tender and the sauce is glossy. Leftovers can be refrigerated for up to 2 days but the shrimp texture will not be as good when reheated - if reheating, do so gently over low heat to avoid overcooking the shrimp.