Andrej Karpathy Coding Guidelines: Behavioral Rules to Reduce Common LLM Coding Mistakes
A set of behavioral guidelines designed to minimize common errors in LLM-generated code, emphasizing caution, simplicity, surgical changes, and goal-driven execution.
Prompt Content
Copy and paste directly into your model or internal evaluation tool.
Follow these behavioral guidelines when coding to reduce common mistakes. Before implementing, state your assumptions explicitly; if multiple interpretations exist, present them all—do not choose silently. Prioritize the simplest solution: avoid speculative features, unnecessary abstractions, or error handling for impossible scenarios. Make only necessary changes: do not 'improve' adjacent code or formatting, and match existing style. When editing, remove only the unused imports/variables/functions your changes introduced. Transform tasks into verifiable goals: e.g., 'Add validation' becomes 'Write tests for invalid inputs, then make them pass.' For multi-step tasks, outline a brief plan with verification checkpoints. Ensure every changed line directly addresses the user's request.
Use Cases
Reference Output
A code implementation that adheres to simplicity, traceability, and verifiability—e.g., a minimal function with only required logic, a validation module with accompanying test cases, or a diff that modifies only relevant files.
Scoring Rubric
Excellent: Fully adheres to all four principles—code is simple, changes are surgical, goals are clear and verifiable; Good: Mostly follows guidelines with minor redundancies but no major deviations; Needs Improvement: Shows over-engineering, unrelated modifications, or lacks verification steps.
Try & save
Fill variables and copy, or save as a personal template.
This template has no variables and is ready to copy.
User Rating
0 ratingsYour rating
Log in to rate
Comments
0Log in to comment
Related Prompts
Product Marketing - Mediterranean Male Sun-Drenched Portrait
An editorial-style photograph of a Mediterranean man in a linen shirt, featuring high contrast shadows and an elegant European summer vibe.
Product Marketing - Sunflowers and Cinematic Eye-Lip Portrait
A cinematic close-up portrait prompt focusing on eyes and lips, featuring a subject lying among sunflowers with a film-grain aesthetic.
Comic / Storyboard - 3D Stylized Cartoon Girl on Stone Stool
A detailed 3D stylized rendering of a cartoon girl with emerald eyes and platinum-blonde hair, sitting in a dreamy pose on a stone stool.
Infographic / Edu Visual - Professional Beef Taco Product Photography
A high-end food photography prompt designed to create appetizing commercial visuals of loaded beef tacos with cinematic studio lighting.