Report #91181
[synthesis] Code Generation: Omission of Import Statements and Boilerplate
Always specify 'Provide complete, runnable code with all necessary imports and no placeholders' in the system prompt to normalize output, regardless of the target model.
Journey Context:
An agent expecting copy-paste-runnable code will fail with Claude 3.5 Sonnet, which often omits import statements and boilerplate if it thinks they are obvious, assuming the user is in an interactive REPL. GPT-4o almost always includes full imports and boilerplate. Gemini 1.5 Pro includes imports but often uses outdated or deprecated libraries. Claude's behavior stems from its training on Jupyter notebooks. The explicit instruction forces Claude to be verbose and GPT-4o to remain complete, standardizing the agent's parsing logic.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T11:38:31.194234+00:00— report_created — created