Install any skill in seconds. Free to start, no credit card required.
Get Started Free →growthxai/llm-output-schema-constraints
Zod schema constraints that Anthropic rejects or silently ignores when sent as structured-output tool definitions via Output.object().
Passed 22 of 23 test cases with the skill, and 10 of 23 without it.
and 13 more in the full report
12 fixed10 passed either way1 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 12 test cases the skill fixed. Same model, same prompt, with and without the skill.
I am defining a structured output object schema for an automated essay grader LLM tool call using Zod. The essay score should be a number between 1 and 10. How should I constrain the score field in the Zod schema sent directly to the model?
| Checked | Without skill | With skill |
|---|---|---|
| The score field uses describe() to indicate the 1-10 range. | Passed | Passed |
| The score field does not use min() or max() methods in the schema passed to the model. | Missed | Passed |
The instructions your model reads when the skill loads.
When using aiSdk.Output.object() with generateText, the Zod schema is converted to JSON Schema and sent to the LLM provider as a tool definition. Anthropic does not support many JSON Schema constraints, which means certain Zod methods will cause errors or be silently ignored when the schema is sent to the provider.
Numbers: .min(), .max() on z.number() produce minimum/maximum — rejected by Anthropic.
Arrays: .min(), .max(), .length() on z.array() produce minItems/maxItems — Anthropic only supports minItems of 0 or 1. Any other value (e.g. .length(3), .min(2)) will be rejected.
.describe() instead of numeric/array constraints for LLM output schemasimport { aiSdk } from '@outputai/llm';
// LLM output schema - sent to provider via aiSdk.Output.object()
output: aiSdk.Output.object( {
schema: z.object( {
score: z.number().describe( 'Quality score 0-100' ),
predictions: z.array( predictionSchema ).describe( 'Exactly 3 predictions' )
} )
} )
// Workflow/evaluator validation schema - Zod-only, NOT sent to LLM
export const workflowOutputSchema = z.object( {
score: z.number().min( 0 ).max( 100 ).describe( 'Quality score 0-100' ),
predictions: z.array( predictionSchema ).length( 3 ).describe( 'Exactly 3 predictions' )
} );
| Context | .min()/.max()/.length() | .describe() |
|---|---|---|
Schema passed to aiSdk.Output.object() | No (numbers or arrays) | Yes |
inputSchema / outputSchema on workflows | OK | Optional |
outputSchema on evaluators | OK | Optional |
workflowOutputSchema in types.ts | OK | Optional |
test cases passed, vs 10 / 23 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.