As a 終助詞（しゅうじょし） (sentence ending particle), こと has two primary functions. These are as follows:
表（あらわ）す - Highlighting a desire or weak command.
表（あらわ）す - Highlighting astonishment or doubt.
We will focus on the first meaning in this grammar point, as the ‘astonishment’ nuance is not as commonly used in modern Japanese, and is primarily used only by women.
At the end of a sentence, こと will be paired with the dictionary (or ない) form of a verb, to highlight a particular action that either should, or should not occur. It is usually grouped with the 助動詞（じょどうし） (auxiliary verb) だ
, although this is not always the case. This construction is most often translated as ‘should/should not (A)’, or ‘ought to/not (A)’.
Even though it might be a pain, you should eat breakfast.
The exams will begin tomorrow at 8 am. No matter what happens, you should come on time. Understood?
You should not give up, no matter how tired you are.
If you get hurt, you shouldn’t just suffer in silence. Immediately call your supervisor.
This use of こと implies a certain level of ‘authority’, and is therefore regularly used in relation to set rules and expectations (can very frequently be seen on signs in shops/parks, etc). Due to this, it should not be used when giving ‘general’ advice, especially to people of higher status.