I would suggest reading through the instructions for Form 8889 here:
https://www.irs.gov/pub/irs-pdf/i8889.pdf. That link currently points to the 2021 instructions, but the 2022 instructions should be essentially the same. Pay particular attention to the discussion of self-only coverage vs. family coverage, the last month rule, and the instructions for the amount to enter on line 3.
Generally:
You can contribute to your HSA any amounts at any time during the calendar year and up through the filing deadline next year. So if you know you're going to qualify for $X, you can contribute that amount today. You don't have to wait. However, if your plans change and you contribute too much, you'll of course have to deal with withdrawing the excess contribution amount.
The maximum amounts are a bit higher for 2022: $7,300 family and half that for individual.
If you're married and have family coverage, my understanding is that you can divide the $7,300 between your HSA and your husband's HSA any way you want.
The annual contribution amount is sometimes calculated on a monthly basis. See Line 3 instructions above.
The rules on how the limits work between individual and family coverage, especially in a situation like yours where the coverage is changing back and forth, can be tricky to apply, so I am hesitant to give a direct answer. I'd refer you to the instructions link above and suggest reading through it carefully.
There is something called the last month rule, discussed in the instructions. If you have family coverage on 12/1/2022, then you can contribute the maximum amount, even if you didn't have family coverage earlier in 2022, as long as you maintain coverage throughout all of 2023. It's a weird rule, but its part of the HSA rule set.