There are rules, but in fact memorizing the rules is not as good as memorizing the words directly. The key is that the pronunciation of English must be accurate.
The principle of katakana is to write the sound of each letter.
T = ツ
D = ド
pant パンツCAT キャッツROOT ルーツBOOT ブーツ
shampoo シャンプー
credit クレジットcard カード