To be honest, I would always forget all my trig identities until I learned complex numbers. Assuming you don't want to go there, try to be as efficient as possible. I tell my students to remember these at the bare minimum:
$$
\cos(A\pm B) = \cos(A)\cos(B)\mp \sin(A)\sin(B)\\
\sin(A\pm B) = \sin(A)\cos(B)\pm \cos(A)\sin(B)
$$
Where `$\mp$' means to flip the sign i.e. $A+B$ inside becomes $-$ outside. Then, you can get a lot of the other identities by simply adding or subtracting these! For example, the product-to-sum rule for cosine comes from adding the formulae for $\cos(A+B)$ and $\cos(A-B)$, and the product-to-sum rule for sin comes by subtracting them.
In an exam setting, you'll always be more efficient by having things memorized though, so going `from scratch' should probably be a last resort.