How validation works
The validation happens in the API route atsrc/app/api/generate/route.ts using a dedicated validation prompt and structured output with Zod schemas.
Validation prompt
The system uses a specialized prompt to classify whether a user request is valid for motion graphics generation:src/app/api/generate/route.ts:11-37
Implementation
The validation runs before skill detection and code generation:src/app/api/generate/route.ts:331-354
When validation is skipped
Validation is only applied to initial prompts, not follow-up edits. Once the user has generated valid code and is making iterative changes, validation is skipped because:- The conversation already has valid motion graphics context
- Follow-up prompts like “make it blue” or “speed it up” wouldn’t pass validation on their own
- It improves performance by reducing unnecessary API calls
Error handling
If validation fails, the user receives an error of type"validation" with a clear message:
If the validation API call itself fails (network error, timeout, etc.), the system allows the prompt through rather than blocking it. This fail-open approach prevents false negatives from blocking valid requests.
Valid prompt examples
Data visualizations
Data visualizations
- “Create a bar chart showing monthly revenue”
- “Animated pie chart with 4 segments”
- “Progress bar loading from 0 to 100%”
- “Line graph with smooth transitions”
Typography animations
Typography animations
- “Typewriter effect with blinking cursor”
- “Word carousel rotating between 3 words”
- “Kinetic title that zooms in”
- “Animated subtitle with highlight effect”
Social media content
Social media content
UI animations
UI animations
- “Button with loading spinner”
- “Card flip animation”
- “Menu slide-in transition”
- “Modal fade in effect”
Invalid prompt examples
Questions
Questions
- “How do I use Remotion?”
- “What’s the best animation library?”
- “Can you explain how React works?”
Non-visual content
Non-visual content
- “Write me a poem”
- “Translate this to Spanish”
- “Calculate the area of a circle”
- “Summarize this article”
Conversations
Conversations
- “Hello, how are you?”
- “Tell me a joke”
- “What’s the weather?”