As salam aleykum,
I don't believe te Prophet (saws) commanded the killing of the dog. There is another famous tradition about that, I paste you below,it's is discused by Allama Tabatabai in AL-Mizan (volume 10 of English translation:
Also, he says, "al-Fãriyãbī, Ibn Jarīr, Ibnu 'l-Mundhir, Ibn Abī Hãtim, at-Tabarãnī and al-Hãkim (who has said that the tradition is correct) and al-Bayhaqī have narrated from Abū Rãfi‘ that he said, 'Jibrīl came to the Prophet (s.a.w.a.), and asked permission to enter. The Prophet gave him permission but he tarried (in entering). The Prophet took hi