multica-ai / andrej-karpathy-skills
Summary
A `CLAUDE.md` file, inspired by Andrej Karpathy's observations on large language model (LLM) coding pitfalls, provides four core principles to improve Claude Code's behavior. These principles address common issues such as LLMs making wrong assumptions, overcomplicating code, performing orthogonal edits, and lacking verifiable success criteria. The solution outlines "Think Before Coding" to surface assumptions and confusion, "Simplicity First" to prevent overengineering, "Surgical Changes" to limit modifications to only what is necessary, and "Goal-Driven Execution" to define clear success criteria and enable iterative verification. The guidelines can be installed as a Claude Code plugin or integrated per-project via a `CLAUDE.md` file, and also apply to Cursor projects.
Key takeaway
For AI Engineers and Machine Learning Engineers developing with Claude Code or similar LLM agents, adopting these Karpathy-inspired guidelines can significantly reduce costly coding mistakes and improve code quality. You should prioritize defining explicit success criteria and encourage agents to surface assumptions and simplify code. This approach biases toward caution, leading to cleaner, more focused code changes and fewer rewrites, especially for non-trivial tasks.
Key insights
LLMs excel at meeting specific goals; define clear success criteria for optimal coding agent performance.
Principles
- Explicitly state assumptions and clarify confusion.
- Prioritize minimum viable code over speculative features.
- Limit code changes strictly to the task at hand.
Method
Transform imperative coding tasks into verifiable, declarative goals with explicit success criteria. This enables LLMs to loop independently until criteria are met, reducing constant clarification needs.
In practice
- Install as a Claude Code plugin for project-wide application.
- Integrate into `CLAUDE.md` for project-specific guidelines.
- Use Cursor's project rules for consistent application.
Topics
- LLM Coding Pitfalls
- Claude Code Guidelines
- Andrej Karpathy's Observations
- Think Before Coding
- Simplicity First
Code references
Best for: AI Engineer, Machine Learning Engineer, Prompt Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by Github Trending: All languages.