01 - Preheat oven to 375°F. Lightly grease a 9x13-inch baking dish.
02 - Bring a large pot of salted water to a boil. Cook ziti until al dente according to package directions. Drain and set aside.
03 - Heat olive oil in a large skillet over medium heat. Add chopped onion and sauté for 3 to 4 minutes until softened. Stir in minced garlic and cook for 1 minute until fragrant.
04 - Add ground beef to the skillet. Cook, breaking meat apart, until fully browned, about 5 to 6 minutes. Drain excess fat if needed.
05 - Stir marinara sauce, Italian seasoning, crushed red pepper flakes (if using), salt, and black pepper into the beef mixture. Simmer for 5 minutes, then remove from heat.
06 - In a medium bowl, blend ricotta, 1 cup mozzarella, ¼ cup Parmesan, and egg until thoroughly combined.
07 - Spread half of the cooked ziti in the prepared baking dish. Top with half of the meat sauce, then dollop half the cheese mixture. Repeat layers with remaining pasta, sauce, and cheese mixture.
08 - Sprinkle remaining 1 cup mozzarella and ¼ cup Parmesan evenly over the final layer.
09 - Cover dish with foil and bake for 25 minutes.
10 - Remove foil and bake an additional 10 to 15 minutes until cheese is melted, bubbly, and slightly golden. Let rest for 10 minutes before serving.