In the standing position, practice lifting the knee caps by engaging the inner thigh, or vastus medialis, muscles. Watch your knees as they rise and note which direction they take. If they lift upward, toward the hips, then they are properly aligned. Any outward sliding could be a sign of poor alignment or weak inner thigh muscles.
The hero pose, also called virasana, can help with knee alignment when done correctly. Bring attention to the toes while sitting on your bent knees and make sure that they are pointing straight back and not to the side. This prevents any excessive twisting in the knee joints, which could lead to ligament damage.
In trikonasana, or triangle pose, the inner thigh muscles engage in a deep stretch and allow the knee caps to slide into a comfortable place. If the inner thigh muscles are working, the knee cap will slide straight up the leg with perfect alignment. If they are not engaged, it is possible to hyperextend and cause discomfort. Here, alignment and active muscle engagement work hand in hand.