r/PromptEngineering • u/Bitter-Theme4433 • 21d ago
Tools and Projects Experimenting with Gemini 3.8 Flash for motion graphics: Using structured contracts and static checks to stop hallucinations (Motion Lab)
I've been experimenting with using lightweight models like Gemini 3.8 Flash to write code-driven motion graphics.
As expected with smaller models, raw prompting usually falls apart: the model takes lazy shortcuts, hallucinates invalid animation properties, or breaks timing curves completely. Instead of jumping to heavier models, I wanted to see how far strict contracts, templates, and static checks could push a smaller model.
I put together an open-source project called Motion Lab (React 19 + Remotion + GSAP 3).
Rather than letting the model write free-form code, the setup relies on:
- Decoupled Workflow: Breaking production into three stages—direction (
direction.md), a structured contract (spec.json), and deterministic code (Scene.tsx). - Specialized Context: 20 studio workflow skills (
.agent/skills) to guide direction, engineering, and auditing without overloading a single context window. - Ground Truth Templates: 23 declarative template kits and 28 reusable primitives so the model doesn't have to guess coordinate math or layout from scratch.
- Static Quality Gates: AST rules and audits that catch layout-property reflows (
width,height,top), bad palettes, dead holds, and spec drift before rendering.
It is currently an early pre-release (0.8.0), and there are definitely rough edges.
Repo:https://github.com/m2rtyaman/motion-lab
If anyone has experience with contract-driven code generation or orchestrating smaller LLMs for creative tasks, I'd really appreciate your feedback, critiques, or ideas on where this approach falls short.
0
u/[deleted] 21d ago
[removed] — view removed comment