Prepare the dough: In a large bowl, mix ricotta, salt, and egg (if using). Gradually add flour until a soft dough forms. Knead lightly for 2–3 minutes on a floured surface.
Shape the cavatelli: Divide dough into small logs about 1/2 inch thick. Cut into 3/4-inch pieces. Shape each piece by pressing with your thumb or rolling over a fork/cavatelli board. Dust with flour to prevent sticking.
Cook the pasta: Bring a large pot of salted water to boil. Cook cavatelli in batches for 2–4 minutes until they float. Drain using a slotted spoon.
Serve: Toss with your choice of sauce and garnish with Parmesan or fresh herbs. Serve immediately.