Nobody said the mold has to be done in a human language. It _can_ be a part of it for the fuzzy bits.
But it's just writing the hard limits on the outside, in code. Define that when A goes in B must come out. Enforce hard linting rules and other code-level checks on the output etc.