Besides enjoining upon children to obey Allah The Almighty and perform good deeds (and accustoming them to doing so), the Prophet, sallallaahu 'alayhi wa sallam, instructed us regarding the necessity of guarding children from falling into prohibited things.
In a Hadeeth (narration) on the authority of Abu Moosa Al-Ash'ari, may Allah be pleased with him, the Prophet, sallallaahu 'alayhi wa sallam, said:"Wearing silk and gold has been forbidden for the males of my nation and permissible for its females." (At-Tirmithi) Although this order is mainly directed at adult men, which excludes children, the Prophet, sallallaahu ‘alayhi wa sallam, referred to the masculine gender in general, not just those held accountable for their deeds.
Abu Hurayrah, may Allah be pleased with him, said that Al-Hasan ibn 'Ali, may Allah be pleased with them both, took a date from the dates of Sadaqah (obligatory charity) and put it in his mouth. The Prophet, , said to him:"Kakh, Kakh! (a word for scolding) Throw it, don't you know that we do not eat the Sadaqah?" (Al-Bukhari and Muslim)
However, when a child is blamed for committing an error, one hears voices strongly objecting to this, claiming that the child is still young and will not be held accountable for his (or her) deeds. Although the Prophet, sallallaahu 'alayhi wa sallam, was fully aware of this fact, he, sallallaahu 'alayhi wa sallam, did not excuse or justify a wrong act. Abu Al-Hawraa' said, "I asked Al-Hasan ibn 'Ali, may Allah be pleased with them both, what he remembered about the Prophet, sallallaahu 'alayhi wa sallam. He said, ‘I remember that I took a date from the dates of As-Sadaqah, and put it into my mouth. The Prophet, sallallaahu 'alayhi wa sallam, pulled it out of my mouth with its saliva (still on it), and put it back in the dates. Some people said, "O Messenger of Allah, what [did it matter] if you left this date for this child?" The Prophet said: “Sadaqah is not permissible for us, the family of Muhammad." (Ahmad).
Ibn 'Umar, may Allah be pleased with them both, also narrated that when the Prophet, sallallaahu 'alayhi wa sallam, saw a boy who had some of his hair shaved and some left, he forbade them (others) from doing that and said:"Shave it all or leave it all". (Abu Dawood).
Thus, the Prophet, sallallaahu 'alayhi wa sallam, ordered them not to perform Qaza' (shaving some of the hair and leaving the rest), and he directed this order to them all, disregarding the fact that this boy was not Mukallaf (held accountable for his deeds). A sin is a sin regardless of who commits it, whether he is a child or an adult, but the issue of punishment varies accordingly.
Parents should thus guard their children from falling into bad deeds, as this is how the Companions of the Prophet, sallallaahu 'alayhi wa sallam, perceived these Hadeeths and acted upon them. Abdullaah ibn Mas'ood, may Allah be pleased with him, for example, when he saw one of his sons vaingloriously wearing and flaunting a silk shirt, he tore the shirt and ordered the boy to go to his mother and ask her to dress him in another shirt. [Abdur-Razzaq, Saheeh]
Finally, it is very important for parents to pay this issue the utmost attention, and keep their children away from all prohibited deeds. For instance, males should not wear feminine clothes and vice versa; girls’ haircuts should not be similar to those of boys (or imitate haircuts popularized by disbelievers) and vice versa; boys should not wear gold chains and so on.
To conclude, Muslim scholars agree upon the fact that guardians must keep their children away from what has been prohibited for adults. Shaykh al-Islam Ibn Taimiyyah said, "An adult should not only avoid falling into prohibited deeds, but also should prevent their child from falling into it; he should command him to perform prayers at (the age of) seven, and should beat him for neglecting it at (the age of) ten. Moreover, how can it be permissible to dress him in what has been forbidden?"
Prophetic Guidance on Dealing with Youngsters - I
Prophetic Guidance on Dealing with Youngsters - II