Pour cooking oil into a wok or large skillet. (Add more oil as necessary during cooking.) Preheat over medium-high heat. Stir-fry onion and garlic in hot oil for 2 minutes or until onions are crisp-tender. Remove onion mixture from the wok.
Add shrimp to the hot wok. Stir-fry for 2 to 3 minutes or until shrimp turn opaque.
Return onion mixture to the wok. Add tomatoes, basil, capers (if desired), salt, and pepper. Stir all ingredients together. Cook and stir for 1 minute more or until heated through. Serve immediately over hot cooked spaghetti or other pasta. Sprinkle with Parmesan cheese. Garnish with fresh basil leaves, if desired. Makes 4 servings.