Marinate the chicken: Add all of the ingredients for the marinade in a large mixing bowl. Then use either a whisk or a fork to mix everything together until thoroughly combined. Add the chicken pieces and sliced onions to this bowl and toss them with the marinade. Cover the bowl and let it sit in your fridge for at least 2 hours or preferably overnight.
Brown up the chicken: Remove the pieces of chicken from the marinade, but make sure to save the marinade & onions. Pour 2 tablespoons of oil into a large walled pan, or Dutch oven and place it over medium heat. Add the pieces of chicken to the pan/Dutch oven and cook them for roughly 5 minutes on each side or until they have developed a nicely browned crust. Remove them from the pan/Dutch oven and set them aside on a plate.
Caramelize the onions: Remove the sliced onions from the marinade, and add them to the same pan/Dutch oven you cooked the chicken. Reduce the heat to medium-low and cook the onions, stirring often, for 10 to 15 minutes or until they are slightly caramelized.
Return everything and let it cook: Deglaze the pan/Dutch oven with the reserved marinade, and chicken stock/water. Return the browned pieces of chicken and add the habanero pepper if using. Let the liquid come to a boil then reduce the heat so the liquid is at a simmer and let it cook covered with a lid for 20 to 30 minutes. If at any point the liquid reduces too much you can always add a splash or two of water. You will know that the dish is finished cooking when the chicken has an internal temperature of 165℉/74℃.
Finish the dish: Add the olives to the pan/Dutch oven and stir everything together so that they heat through. Finally taste some of the sauce and add additional salt if needed.
Serve the chicken yassa immediately and enjoy!