In the Shi'i view, it is held that the knowledge of the Prophet (S) passed directly to the Imams. Therefore, when one of the Imams speaks, they are speaking accurately and correctly on behalf of the Prophet, whether or not it is word for word.
In some cases, the Imam may have a dialogue with someone present with them, refer to people in their time by name, or discuss current events and questions. In these cases, these are not word for word quotations from the Prophet (S) but accurately reflect or expound upon the Prophet's teachings as applied to those situations.
In other cases the Imams provide a direct quotation from one of their forebears.
Apart from that, it would be very lengthy to always give the full chain of narration back to the Prophet (S) through all the Imams. However, it is understood that this is intended to be the chain of transmission of knowledge.
This principle is mentioned in al-Kafi and is related from Imam al-Sadiq (A) as follows:
"My hadith is the hadith of my father. The hadith of my father is the hadith of my grandfather. The hadith of my grandfather is the hadith of al-Husayn. The hadith of al-Husayn is the hadith of al-Hasan. The hadith of al-Hasan is the hadith of the Commander of the Faithful. The hadith of the Commander of the Faithful is the hadtih of the Messenger of God (peace and blessings be upon him and his family). The hadith of the Messenger of God is the word of God, the Mighty and Glorious."
علي بن محمد، عن سهل بن زياد، عن أحمد بن محمد، عن عمر بن عبد العزيز عن هشام بن سالم وحماد بن عثمان وغيره قالوا: سمعنا أبا عبد الله عليه السلام يقول: حديثي حديث أبي، وحديث أبي حديث جدي، وحديث جدي حديث الحسين، وحديث الحسين حديث الحسن، وحديث الحسن حديث أمير المؤمنين عليه السلام وحديث أمير المؤمنين حديث رسول الله صلى الله عليه وآله وحديث رسول الله قول الله عز وجل.
Here, of course, the "word of God" does not mean the same thing as the Qur'an being the "word of God" in the sense of the literal divine word, but rather is the correct teaching given from God to the Prophet (S).
So, from a Shi'i perspective, the Imam has full knowledge of the teachings of the Prophet (S) and full authority to speak about it. Therefore the Imam can speak authoritatively without giving a further chain of narration back or may provide a further chain of narration back.
Hope that helps!