I recently learned about a case of Ali ibn Yaqteen I think it was. He was ordered by Imam Musa Al kathum to make wudhu like Sunnis do to protect him. But then when he could make wudhu like Shias the imam told him to re do the previous prayers done with the wrong wudhu. I know that for instance if you pray like Sunnis in the state of fear you don’t have to re do your prayers and how I understand it it’s different with the wudhu. So my question is when and how do we know when we have to re do when doing a'mal in taqqiya?

I’ve heard that different maraje' say different things here, like if you have to re do hajj and so on. But I don’t really know how to think in general about what to re do.

The Imam issued a special command to him to perform the wudhu the Sunni way, because the Imam knew they would spy on him and find out. Hence, he was not excused in disobeying the Imam.

As for us, if we don’t practice Taqiyyah we get harmed (attacked, killed, etc…) then we are obligated to do Taqiyyah. If one prays in a dangerous area knowing that he could be killed for the Shia way, then praying the Shia way would be invalid and haram. But if it’s not to this extent, like living in a safe society (like in Sweden) then you don’t have to do Taqiyya. Yes, it’s optional. You can go to their mosques and pray their way to establish good ties and bring harmony to society (according to many scholars). But you are not obligated to do that.

As for the Hajj, if you observed it properly, and you observed the pillars of the Hajj, then it doesn’t have to be repeated if you did something out of Taqiyyah.