Preheat the oven to 375°F (190°C).
Cook the pasta shells according to package directions, but slightly undercook them by 1-2 minutes so they don’t break when stuffed. Drain and set aside to cool.
In a large skillet, cook the ground beef over medium heat, breaking it apart with a spoon. Add the chopped onion and minced garlic, and cook for 5-7 minutes, until the beef is browned and the onions are softened.
Stir in 1 cup of marinara sauce and season with salt and pepper to taste. Let the mixture simmer for 5 minutes.
In a separate bowl, combine the ricotta cheese, shredded mozzarella, egg, grated Parmesan, and chopped basil (if using). Stir until well combined.
Spread a thin layer of marinara sauce on the bottom of a 9x13-inch baking dish.
Stuff each pasta shell with the beef mixture and carefully place them in the baking dish, opening side up.
Spoon the ricotta mixture into the top of each shell, covering them with the creamy filling.
Pour the remaining marinara sauce over the shells, covering them evenly.
Cover the dish with aluminum foil and bake for 25-30 minutes, until the cheese is melted and the dish is bubbly.
Remove the foil and bake for an additional 5-10 minutes, until the top is golden and slightly crispy.
Serve hot, garnished with extra basil or grated Parmesan if desired.