If you’re a grandparent developing your estate plan, you may choose to leave some of your assets directly to your grandchildren rather than leave it to their parents to pass on a portion of their inheritance.

Whether your grandchildren are toddlers or young adults, you may have some concerns about these assets being taken by their spouse in a divorce. You’ve worked hard for your money. Perhaps some of it has been passed down for generations. You want to make sure it stays in the family — and specifically with the grandchildren you’re bequeathing it to. What can you do to help ensure that?

By having a will or trust that specifically designates an inheritance for each grandchild, you’re taking an important step. There are multiple ways you can do this, including leaving them an individual retirement account (IRA) via an IRA inheritance trust. You can also set up a dynasty trust. This type of trust also helps protect assets from creditors.

Typically, if a person inherits money directly, their spouse cannot claim a portion of it in a divorce because it’s not considered a marital asset. However, if the beneficiary in any way commingles it with marital assets, it can be up for grabs in a divorce (unless they specify otherwise in a prenuptial agreement). Spouses often commingle their inheritances with marital assets without realizing it by using some of the money to buy a home or putting it in a shared bank account — just to name a couple of examples.

If you are leaving your children and/or grandchildren significant assets, it’s wise to have some discussions with them, if they’re old enough, about any specific wishes or intentions you have for how they’ll use the money. You can set up trusts that stipulate that money be used for designated purposes, such as college, starting a business or charitable giving.

If you have grandchildren who are too young for such conversations, you can include language in your estate plan that outlines your wishes and goals. Your estate planning attorney can provide valuable guidance that will help you keep your assets in the family after you’re gone.