In a Friday lecture of Holy Ramadan, Mufti Taqi Usmani (DB) mentioned:
Sayiduna Siddiq-e-Akbar (RA) said (Meaning), Whenever you get the Tawfeeq (ability) of accomplishing a good deed, carry out two actions to Allah. Say الحمد لله (Alhamdulillah – All Praise is for Allah!) and utter أستغفر الله(Astagfirullah – Forgive me O Allah!). الحمد لله Alhamdulillah, because the Tawfeeq (ability) of doing good deed has been achieved (from Allah Taala) and أستغفر الله (Astagfirullah), because the deed had not been carried out (by me) in the way it should have been.