For retirement accounts, you can set different contributions that will take effect if the spouse/partner of the account holder dies first.
You can change amounts, or even eliminate contributions in case of the spouse/partner's death. If your general plan is to only contribute to retirement accounts if the spouse/partner dies, then only enter contributions under the contingency settings area for the account.
Note that on the overview screen for each adult you can set a contingency for retirement age so any retirement account contributions that are set to end at 'Retirement' will end at that age if the contingency takes effect.