Know that when you desire to perform any act of obedience, no matter how small, you must have a conscious intention. That means that you intend to please Allah by your action. Your intention should be simultaneous with the action. This includes all acts of worship: the prayer, fasting, wudu’, tayammum, retreat, hajj, paying the zakat, giving charity, taking care of needs, visiting th sick, following a funeral, initiating the greeting and returning it, blessing anyone who sneezes, objecting to what is rejected as wrong, and commanding what is recognized as right, answering an invitation, attending gatherings of knowledge and dhikr, visiting virtuous people, spending on your family and guests, honoring the people you love and close relatives, learning knowledge and discussing it, repeating it, teaching it, instructing in it, reading it, writing it and putting it in order, giving legal opinions (fatwas), and any other similar actions.
It is applicable to such an extent that you should make an intention when you eat, drink, or go to sleep. By doing this, you intend fearful awareness in obedience to Allah, or to give the body a rest in order to have more energy for obeying Allah. It is the same when you want to have sexual intercourse with your wife. You intend by it to give her the rights due to her, to obtain a good child who will worship Allah, and to refrain from looking at what is haram and dwelling on it and to protect yourself from it.
Whoever lacks an intention in these actions is denied great good. Whoever is successful in making one has been given a vast favor. We ask Allah the Generous for success in this matter and in all aspects of good. The proof of this principle is contained in the words of the Prophet, may Allah bless him and grant him peace, “Indeed, actions are according to intentions, and every man has what he intends!” They say that someone said to Habib ibn ‘Abi Thabit at-Tabi’i, the mufti of the people of Kufa and a very reliable man, “Tell us about the most difficult thing to do!” He replied, “To have a conscious intention!” Sufyan ath-Thawri stated, “I do not have to deal with anything more difficult for me than my intention.” Yazid ibn Harun said, “The only reason intention is so exalted in the hadith is because of its nobility.”
Ibn ‘Abbas stated, “Man is protected according to his intention.” Muhammad ibn Idris ash-Shafi’i said, “I would like people to learn this, even though not one single letter of it is ascribed to me.” Ash-Shafi’i also said, “I have never competed with anyone with the idea of defeating him. Whenever I compete with anyone, it is only in order to show him the truth.” He also said, “I have never spoken to anyone without wanting success for him, and desiring that he be directed to the right way, be helped and have protection and preservation from Allah Almighty.” Abu Yusuf, Abu Hanifa’s disciple, stated, “I desire to teach you for the sake of Allah. I never sit down in any assembly in which I intend to be humble without standing up having elevated them. And I do not sit down in any assembly in which I intend to elevate them without standing up having been compromised.”
Imām Abū Zakariyyā Yaḥyā ibn Sharaf al-Nawawī , The Garden of the Gnostics (Bustan-ul-Arifeen)