Heat oil in a large saucepan over medium heat. Add chopped onion, salt, and pepper. Cook until the onion softens and browns lightly, about 10 minutes.
Add minced garlic and red pepper flakes. Stir and cook for 30 seconds.
Stir in tomato puree, water, and sugar. Simmer for 5 minutes.
Mix all filling ingredients in a bowl. Transfer to a pastry or zipper-lock bag, snipping a corner for piping.
Preheat oven to 400°F. Arrange shells open side up on the counter. Pipe filling into shells until three-quarters full, then distribute remaining filling evenly.
Spread 1 cup sauce in a 13x9-inch baking dish. Place filled shells in dish. Pour remaining sauce over shells.
Cover dish with foil, place on a baking sheet, and bake for 45 minutes.
Remove foil, sprinkle with shredded fontina, and bake uncovered for 15 minutes more.
Cool for 25 minutes, garnish with chopped basil, and serve.