Question:

"Did the 12 imams wrote any books on fiqh and hadith or any other subject ?"
 

Answer:

The twelve Shia Imams did not write any books. However, their speeches and words are narrated in Shia compilation books. These speeches contain false and true sayings.

The sayings of Ali, Al-Hasan, and Al-Hussain, may Allah be pleased at all of them, are extensively reported in Sunni hadeeth books. Some sayings of Muhamed Al-Baqir and Jaffar Al-Saddiq, may Allah have mercy on their souls, are reported as well in Sunni books.