State Specific.
E.g. in Ohio it was codified into law that you are to provide a termination letter via certified mail and offer up to 1 month's worth of medications.
I currently practice in Missouri. There is no codified state law on how to terminate patients. Despite this I still follow the above because a lawyer could pull the argument that despite that there aren't codified laws that the standard of care in many states follow the above so this should be a standard-of-care argument and not one already codified into state law.
Many sources also recommend a referral to 3 sources. Again this may not be in your state's laws but a lawsuit could argue that this is the standard since it is recommended in several sources that are considered respected such as medical textbooks and lectures.
The meds for 30 days thing is a widely repeated myth based on AMA guidance (the AMA are irrelevant)
I wouldn't push this argument. In several occasions courts have used AMA or APA guidelines as an acceptable standard. In many SCOTUS cases they invited APA opinions to help them guide their judgments. If you didn't break a state law you could still lose a non-criminal probate case such as a malpractice or abandonment case. Those cases don't involve breaking state or federal law but violating civil laws.
Standard of Care need not be codified into law. E.g. I'd bet appropriate insulin dosages aren't codified into law. If a doctor gave too much insulin I'm sure the court wouldn't rely on state laws to determine if the doctor committed malpractice but practice guidelines available through several sources such as scientific studies, practice guidelines, and AMA recommendations.
Bottom line: certified mail, 1 month's worth of prescriptions (but you could argue that you won't do this if you have reason to believe giving 1 month's worth is dangerous for this specific patient), 3 referrals, follow state laws and look them up but if there aren't any still do the above just in case. If there are no state laws on this issue and you don't do the above you have a wiggle-room argument that you didn't break the law but the plaintiff lawyer could still accuse you of not following the standard of care. You wouldn't have broken state law but you could have broken civil law.
One more thing, aside from the law, the ethics and good practice. 3 referrals, certified mail and 1 month's worth of prescriptions is just (usually) good solid practice in termination, looks more professional, and is usually the right thing to do.