It is usually used before consonants that are categorized in phonetics as plosives or stops, affricates, and unvoiced fricatives, or more precisely unvoiced sibilants.
Stops: the initial sounds of か /k/, が /g/, た /t/, だ /d/, ぱ /p/, and ば /b/
Affricates: the initial sounds of ち /tɕ/, じ or ぢ /dʑ/, つ /ts/, and ず or づ /dz/
Unvoiced sibilants: the initial sound of さ /s/ and し /ɕ/
The initial sounds of は /h/, ひ /ç/, and ふ /ɸ/ are also unvoiced fricatives, but (not being sibilants) they are usually not used with a small っ, at least not in Japanese words.
How foreign words are spelled is rather arbitrary as you can see in the pair of バッグ (bag) and バグ (bug). The reason ポスト has no small ッ is probably because the vowel in “post” is a so-called “long” vowel and it doesn’t sound like ポッスト to a Japanese ear. (ポスット is even less likely.) In addition, the /s/ sound, unlike /t/, /p/, etc., doesn’t usually require a small っ unless it is followed by a vowel. For example, “bus” is spelled バス and “pass” as パス, whereas “message” is written メッセージ. There are a few exceptions to this rule as “kiss” may be spelled either キス or キッス. The latter sounds a bit comical.
In some foreign names or words, a small ッ appears before a sound that is usually not used with it, as in バッハ (Bach), ハインリッヒ (Heinrich), カペッロ (Capello), etc.