
Karpathy Guidelines
FreeBehavioral guidelines to improve LLM coding practices.
Free · Opens the source repo
What Karpathy Guidelines does
The Karpathy Guidelines provide a structured approach to reduce common coding mistakes made when using large language models (LLMs) for software development. These guidelines are based on insights from Andrej Karpathy, who has highlighted frequent pitfalls in LLM-generated code. By emphasizing clarity, simplicity, and surgical precision, these guidelines serve as a valuable resource for developers and designers looking to enhance their coding practices when working with LLMs.
These guidelines are particularly useful during the writing, reviewing, or refactoring phases of coding. They encourage developers to articulate their assumptions, avoid unnecessary complexity, and focus on achieving clear, verifiable goals. The emphasis on simplicity means that developers are urged to implement only the essential features required for a task, steering clear of speculative abstractions or excessive error handling. This approach not only leads to cleaner code but also reduces the cognitive load on both the developer and any collaborators who may work with the code in the future.
When making changes to existing code, the guidelines advocate for surgical modifications—touching only the necessary components and maintaining the existing style. This minimizes the risk of introducing new issues and keeps the codebase manageable. Additionally, the framework encourages defining success criteria for tasks, transforming vague requests into actionable steps that can be independently verified. This structured approach helps streamline development processes and fosters a culture of accountability.
Overall, the Karpathy Guidelines are designed for developers and designers who want to leverage LLMs effectively while maintaining high coding standards. By following these principles, users can create more reliable, maintainable code and enhance their overall productivity when working with AI-assisted coding tools.
When to use it
Use this skill when writing, reviewing, or refactoring code with LLMs to ensure clarity and avoid overcomplication.
When not to use it
This skill is not suitable for projects requiring rapid prototyping or extensive architectural changes without clear guidelines.
What you can build with it
Refactoring Existing Code
When tasked with refactoring, use the guidelines to ensure that changes are minimal and only address the specified issues, avoiding unnecessary alterations.
Reviewing LLM-Generated Code
Apply the guidelines during code reviews to surface assumptions and trade-offs, ensuring that the code is simple and meets the project's requirements.
Writing New Features
When implementing new features, use the guidelines to clarify assumptions and define success criteria, helping to keep the implementation straightforward.
How to install Karpathy Guidelines
View source1. Install with the skills CLI
npx skills add sickn33/agentic-awesome-skills/andrej-karpathy --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by sickn33Karpathy Guidelines
Behavioral guidelines to reduce common LLM coding mistakes, derived from Andrej Karpathy's observations on LLM coding pitfalls.
Tradeoff: These guidelines bias toward caution over speed. For trivial tasks, use judgment.
When to Use This Skill
- Use when writing, reviewing, or refactoring code with an LLM.
- Use when a change needs to stay surgical and avoid speculative abstractions.
- Use when assumptions, tradeoffs, and verification criteria should be made explicit.
- Use when code has become overcomplicated and needs to be simplified.
1. Think Before Coding
Don't assume. Don't hide confusion. Surface tradeoffs.
Before implementing:
- State your assumptions explicitly. If uncertain, ask.
- If multiple interpretations exist, present them - don't pick silently.
- If a simpler approach exists, say so. Push back when warranted.
- If something is unclear, stop. Name what's confusing. Ask.
2. Simplicity First
Minimum code that solves the problem. Nothing speculative.
- No features beyond what was asked.
- No abstractions for single-use code.
- No "flexibility" or "configurability" that wasn't requested.
- No error handling for impossible scenarios.
- If you write 200 lines and it could be 50, rewrite it.
Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.
3. Surgical Changes
Touch only what you must. Clean up only your own mess.
When editing existing code:
- Don't "improve" adjacent code, comments, or formatting.
- Don't refactor things that aren't broken.
- Match existing style, even if you'd do it differently.
- If you notice unrelated dead code, mention it - don't delete it.
When your changes create orphans:
- Remove imports/variables/functions that YOUR changes made unused.
- Don't remove pre-existing dead code unless asked.
The test: Every changed line should trace directly to the user's request.
4. Goal-Driven Execution
Define success criteria. Loop until verified.
Transform tasks into verifiable goals:
- "Add validation" -> "Write tests for invalid inputs, then make them pass"
- "Fix the bug" -> "Write a test that reproduces it, then make it pass"
- "Refactor X" -> "Ensure tests pass before and after"
For multi-step tasks, state a brief plan:
1. [Step] -> verify: [check]
2. [Step] -> verify: [check]
3. [Step] -> verify: [check]
Strong success criteria let you loop independently. Weak criteria such as "make it work" require constant clarification.
Examples
User request: "Add validation to this form."
Better response:
1. Assumption: validation should run before submit and show inline errors.
2. Plan: add a small validator, add tests for invalid inputs, then verify existing submit behavior.
3. Scope: only touch the form component and its test file.
User request: "Refactor this service."
Better response:
1. Ask what behavior must remain unchanged.
2. Identify a concrete smell, such as duplicated parsing logic.
3. Make the smallest refactor and run the existing service tests.
Limitations
- These guidelines are behavioral guardrails, not a replacement for project-specific architecture or style rules.
- For emergency fixes, prioritize the smallest verified correction over extensive planning.
- For exploratory prototypes, some caution can be relaxed, but assumptions and verification should still be explicit.
Frequently asked questions about Karpathy Guidelines
Similar skills
Quality Playbook Generator
Run comprehensive quality audits on any codebase.
PR Draft Summary
Automate PR summary generation for openai-agents-python.
Final Release Review
Streamline your release candidate audits with ease.
Unit Test Vue Pinia
Efficiently write and review unit tests for Vue 3 applications.
Slang Shader Expert
Optimize and integrate Slang shaders with ease.
Telemetry Standards
Ensure consistent event tracking in Supabase Studio.
