Generally speaking, a living trust and any other self-settled trust is not effective to bar a creditor's claims and all transfers to a revocable trust are, in the technical sense of the word, "fraudulent transfers".
Also, if the trustee is the grantor of the trust, or the trust is revocable, a court can order a debtor to exercise powers as a trustee or as an individual with the power to revoke the trust, to do so.
Even in jurisdictions that are asset protection havens like Nevis and the Cayman Islands, a transfer to a self-settled trust for which the transferor is a beneficiary can be undone in a fraudulent transfer action brought within a short statute of limitations.
Some jurisdictions, especially those which are asset protection havens, however, provide a defense to a claim of a fraudulent transfer to a self-settled irrevocable trust with a third party trustee who has absolute discretion to make distributions to people in a class of persons including the grantor, if at the time of the transfer, the grantor was not insolvent and was not rendered insolvent by the transfer.
For example, in suppose that you own investment real estate (which does not benefit from any exemption from creditors and which is owned in your own name as publicly disclosed in real estate records, worth $10,000,000, free and clear, and you have no contractual debts, you have no known liability for civil wrongs that you have caused, and you have never been married or had kids. Then, you put put $5,000,000 of cash in a trust like the one described above (irrevocable, with a third party trustee who has absolute discretion to distribute funds to you or other people in a class of beneficiaries).
Then, ten years later, your building was destroyed in a fire at a time when you had carelessly failed to have it insured, and two days later, you get drunk and crash into a bus full of neurosurgeons who are sent careening off a cliff and into the Tasman Sea dying horribly and painfully. You have only $500,000 of automobile liability insurance. You now have a net worth of only $1,000,000 of assets, and are sued for causing the accident, you lose, and the court awards $6,500,000 of damages against you. Your insurance pays the first $500,000 of damages and your $1,000,000 bank account is seized to pay the judgment as well, leaving $5,000,000 of the judgment unpaid.
Can the creditors go after the funds in the self-settled trust?
Unless there is a categorical ban on creating self-settled trusts and the statute of limitations on claims for fraudulent transfers into self-settled trust is more than ten years after the date of the transfer, then no, they can't get the trust assets.
I don't have the resources personally to determine what NZ law is on self-settled trusts as fraudulent transfers, and whether there is a statute of limitations in this case. The majority rule would be that the self-settled trust could be pierced by the creditors, but that would certainly not be true in every jurisdiction.
Provided that the trust is set up before the debt gets incurred, will
it protect his assets? Will it not be seen fraudulent?
Will the situation change if the trust is set up when, although no
debt is incurred yet, nevertheless Bob sees the risk somewhat
possible? For example, if Bob is involved in litigation (regarding a
matter not related to Bob's assets) and would owe lots of money in
legal costs to the other party if he loses?
A transfer that does not render someone insolvent can still be a fraudulent transfer and undone, if there is an intent to deprive future creditors of the ability to recover their claims. In the U.S. many jurisdictions have a statute of limitations for undoing the claim of four years after the transfer or one year after the transfer is or should have been discovered by the creditor, whichever comes first. Most, but not all U.S. jurisdictions would also or instead declare that all self-settled trusts are invalid.
If litigation is pending, then the litigation creditor is a present creditor rather than a future creditor (since the unliquidated debt is still a debt), and it is generally easier to prove that the transfer was fraudulent and undo it in those circumstances.
In particular, if the transfer to the trust makes the debtor insolvent on a balance sheet basis, considering the amount eventually awarded on the litigation claim to the other side, then the transfer is automatically invalid in most jurisdictions and can be undone, even if they don't have a per se self-settled trust prohibition and even if an intent to defraud is not proved.