〜ことだ
you should, the best thing is to (advice)
Verb dictionary form / ない-form + ことだ
Sign up free to review this point on a spaced schedule.
ことだ gives direct advice: "the thing to do is…". 日本語が上手になりたければ、毎日話すことだ, "if you want to get better at Japanese, speak it every day".
It's usually said by someone with more experience, like a teacher, a parent or a senior colleague, and often after a condition (たければ, なら, たいなら). With the ない-form, it's "don't": 甘い物を食べないことだ.
It's firmer than ほうがいい and more personal than ものだ: ものだ is what people in general should do, while ことだ is what this listener should do in this situation.
Because it's directive, don't use it to people above you.
Examples
日本語が上手になりたければ、毎日話すことだ。
If you want to get better at Japanese, speak it every day.
風邪を治したいなら、よく寝ることだ。
If you want to get over your cold, get plenty of sleep.
痩せたいなら、甘い物を食べないことだ。
If you want to lose weight, don't eat sweet things.
合格したければ、過去問をたくさん解くことだ。
If you want to pass, work through plenty of past papers.
分からないことがあったら、すぐ聞くことです。
If there's something you don't understand, ask right away.