Easy Prompt
CodingCodeIntermediate

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

Avoiding over-engineering when generating new featuresEnsuring bug fixes are reproducible and testableMinimizing code changes during refactoringMaintaining consistent code style in team collaboration

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 ratings
-

Your rating

Log in to rate

Comments

0

Log in to comment

Related Prompts