Preheat the oven to 190°C (375°F) and position a rack in the middle.
Bring a large pot of lightly salted water to a boil and cook the pasta shells until al dente, about 5 minutes; drain and pat dry on paper towels.
Heat 1 tablespoon olive oil in a large skillet over medium-high heat. Add the finely chopped onion and garlic and cook until translucent, 1–2 minutes.
Add the spinach to the skillet, cover, and cook for about 4 minutes, stirring occasionally, until wilted. Season with a pinch of nutmeg and salt and pepper to taste. Remove from heat and let cool slightly.
Transfer the cooked spinach to a cutting board and finely chop, then combine in a mixing bowl with the drained ricotta, chopped basil, and additional salt and pepper; mix until smooth and well combined. Transfer the mixture to a piping bag or keep a spoon ready.
Drizzle a little olive oil in the bottom of a large oven-proof casserole dish and spread the tomato sauce across the base.
Stuff each pasta shell generously with the ricotta-spinach mixture and arrange the filled shells upright in the baking dish. Spoon any remaining tomato sauce over the shells and drizzle a little olive oil on top.
Cover the dish with aluminium foil and bake for 2 minutes. Remove the foil, sprinkle with the grated Parmesan, then broil or bake briefly until the cheese is melted and lightly browned.
Remove from the oven and serve immediately.