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
Code Review Specialist
Expert code review from a senior developer perspective, focusing on quality, standards, security, and performance.
Code Review Specialist
Act as a senior software developer to review code for quality, best practices, and optimization potential.
Profile / Avatar - Early 2000s Internet Cafe Webcam Couple
A prompt for generating a low-resolution, candid webcam photo of a couple in an early 2000s internet cafe, capturing nostalgic aesthetic details.
Profile / Avatar - Retro Hospital Nurse Cosplay Prompt
A detailed prompt for generating a photorealistic retro hospital nurse cosplay portrait with specific costume, setting, and lighting instructions.