How do you use もんか? Once, I saw this sentence: お前に俺の気持がわかるもんか. I understand the meaning but I don't know how you can use it
「もんか」 is the colloquial pronunciation of 「ものか」.
The usual structure:
「Mini-sentence/Verb phrase/Adjective + ものか/もんか」
This expresses the speaker's total denial regarding what is described before the ものか/もんか part.
= "There's just no way you could understand my feelings!"
(Adult) female speakers might use 「ものですか」 instead.
How to use it (or rather, how not to use it):
「～～～ものか/もんか」 is obviously not an expression that you would use often or repeatedly because of its highly negative resonance. You could end up sounding unreasonably angry (and even funny) if you used it incorrectly. I would go so far as to say that you would probably hear it more often in fiction than in real life. The last thing you want to do is to sound like a fictional character, which unfortunately happens all the time in today's world of Japanese-as-a-foreign-language.
You could use it with close friends and they will think nothing of it. It is just not something you would say to strangers, people older than you or people you do not know very well even when you rightfully want to make a statement of total denial. You would sound far more natural and civilized using phrases such as:
「～～～はずがない。」、「～～～って（or という）ことはない（と思う）。」、「～～～って、そんなわけはないでしょう（or ないだろう）。」 , etc.
Try replacing the ~~~ with 「お前に俺の気持ちが分かる」 for practice.