It is well known (since Euler) that if a positive integer $N$ can be written as a sum of two squares in at least two essentially different ways, then $N$ is composite.

In other words, if

$N=a^2+b^2=c^2+d^2$ with $\{a,b\}\neq \{c,d\}$ and $a, b, c, d$ nonnegative integers, then $N$ must be composite.

The condition is sufficient as there are many composites which cannot be written as a sum of two squares: $6, 12, 14, 15, 21, 22, \ldots$.

Are there any other similar sufficient criteria (similar in the sense that they involve quadratic forms) which ideally cover a larger subset of composites?