In a deep skillet type pan, add olive oil to warm over medium-low heat.
Once heated, add the onions (or shallots).
Once the onions are semi-translucent, add the smashed garlic. If you want it spicy, then here is where you add the crushed red pepper flakes.
Once the garlic (and pepper) is fragrant, pour the passata or crushed tomatoes in. Season to your liking with salt, pepper, and basil. Optional to add oregano, some people don't like this flavor.
Let the sauce simmer on a low heat (not too low, but enough to keep it at a light simmer) for about 15 minutes, stirring occasionally.
After sauce has simmered, use the back of a spoon to make a well for the eggs. you should be able to part the sauce and it doesnt immediately spring back. If it passes the well test then your sauce is ready
Crack an egg into a a separate dish, make the well again, then pour the egg into the well. Use a spoon to push some of the surrounding sauce to around the egg so that it kind of encapsulates the egg. Repeat this step with the remainder of the eggs.
Sprinkle a little salt and pepper over the tops of the eggs and then cover the eggs so that they can cook through. At this point, you just keep checking them to see if the egg reaches the consistency of your liking. Some people like a runnier yolk, others prefer a fully cooked egg, the preference is entirely yours. I like my eggs in purgatory eggs to be slightly runny, so sort of a soft boiled egg. Once cooked to desired egg type, remove pan from the heat and serve direct from the pan. Sprinkle a little pecorino cheese over the sauce and serve with some slightly toasted pieces of an Italian loaf to better scoop the eggs and sauce together.