guidelines-karpathy
Skill28 starsChanged 3 months agoApache-2.0View on GitHub
Behavioral guidelines to reduce common LLM coding mistakes. Use when writing, reviewing, or refactoring code to avoid overcomplication, make surgical changes, surface assumptions, and define verifiable success criteria.
In this repository34 other files it gives its agents.
- bigquery-query-optimizationSkill
- build-and-ci-gatesSkill
- cdc-scd-patternsSkill
- code-implementerSkill
- code-smells-expertSkill
- commit-expertSkill
- compliance-verifierSkill
- context-captureSkill
- context-restoreSkill
- database-migration-expertSkill
- design-spec-expertSkill
- documentation-expertSkill
- flutter-architecture-decisionsSkill
- flutter-performance-profilingSkill
- flutter-release-engineeringSkill
- flutter-review-checklistSkill
- flutter-senior-orchestrationSkill
- flutter-test-strategySkill
- flutter-upgrade-migrationSkill
- gcp-data-engineeringSkill
- loop-engineeringSkill
- performance-scalabilitySkill
- product-analystSkill
- pull-request-expertSkill
- python-expertSkill
- qa-testerSkill
- refactoring-code-expertSkill
- repo-researchSkill
- security-auditSkill
- senior-architect-engineeringSkill
- senior-dev-orchestratorSkill
- sql-query-optimizationSkill
- test-driven-developmentSkill
- testing-expertSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 27
If multiple valid architectural interpretations exist, present them with trade-offs rather than guessing silently.
- Distinctive: line 28
If a simpler, lower-code approach exists, propose it.
- Distinctive: line 32
Never introduce speculative configurability, unused parameters, or generic abstractions for single-use code.
- Distinctive: line 33
Avoid writing defensive error handling for logically impossible internal scenarios.
- Distinctive: line 38
Do NOT "improve", reformat, or refactor adjacent working code or comments unrelated to the task.
- Distinctive: line 39
Remove variables, imports, and functions that your edits made redundant.
- Distinctive: line 52
Claude Code: Keep changes atomic and surgical, avoiding gratuitous refactoring of unrelated code.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Karpathy Guidelines Skill
Overview
This skill enforces behavioral and architectural restraint to prevent common LLM coding pitfalls, derived from Andrej Karpathy's observations on LLM developer tendencies. It acts as an Architectural Pragmatist and Code Simplicity Sentinel, curbing over-engineering, preventing speculative abstractions, enforcing surgical modifications, and insisting on empirical, test-backed verification.
When to Use
Trigger Scenarios
- Pre-implementation sanity checks before generating code or designing solutions.
- Code reviews to evaluate whether a proposed solution is overcomplicated or speculative.
- Debugging and fixing targeted defects where touching adjacent code risks regressions.
- Refactoring tasks to ensure changes remain strictly minimal and goal-driven.
When NOT to Use
- Product requirement definition: Route to
product-analyst. - Automated AST-based code smell detection: Route to
code-smells-expert. - High-level enterprise architecture frameworks: Route to
senior-architect-engineering. - CI/CD pipeline and git hook setups: Route to
build-and-ci-gates.
Process
Rule 1: Think Before Coding
- State technical assumptions explicitly before modifying files. If genuine ambiguity exists, ask the user directly.
- If multiple valid architectural interpretations exist, present them with trade-offs rather than guessing silently.
- If a simpler, lower-code approach exists, propose it. Actively push back against unnecessary complexity.
Rule 2: Simplicity First (YAGNI)
- Implement the absolute minimum amount of code necessary to solve the problem cleanly.
- Never introduce speculative configurability, unused parameters, or generic abstractions for single-use code.
- Avoid writing defensive error handling for logically impossible internal scenarios.
Rule 3: Surgical, Minimal Changes
- Touch only the files and lines strictly required to satisfy the goal.
- Match existing repository styling, conventions, and idioms.
- Do NOT "improve", reformat, or refactor adjacent working code or comments unrelated to the task.
- Remove variables, imports, and functions that your edits made redundant; leave pre-existing dead code untouched unless requested.
Rule 4: Goal-Driven Execution & Loop Verification
- Establish concrete, verifiable success criteria (e.g. specific tests that must pass) before editing.
- Loop and iterate until tests pass; never assume victory without running the verification command.
Usage
Example Prompts
- "Review this proposed solution against the Karpathy guidelines: are we overcomplicating the architecture?"
- "Fix this bug surgically without touching or refactoring any adjacent functions."
- "Implement the simplest possible solution for this feature without speculative abstractions."
Host Execution Instructions
- Claude Code: Keep changes atomic and surgical, avoiding gratuitous refactoring of unrelated code.
- Antigravity: Apply Karpathy principles during the PLAN and BUILD phases of the Loop Engineering workflow.
Red Flags
- Adding "future-proofing" flags, hooks, or interfaces for features not explicitly requested.
- Refactoring or reformatting adjacent working functions during a focused bug fix.
- Creating multi-tiered inheritance or factory patterns when a simple 10-line function suffices.
- Declaring a solution complete without executing the relevant test suite.
Verification
- Assumptions stated and confirmed before implementing.
- Minimum lines of code written to solve the problem (zero speculative abstractions).
- Only target files modified; adjacent working code untouched.
- Automated tests executed and passing cleanly.
References
For the comprehensive behavioral checklist and review rubrics:
- Karpathy Behavioral Checklist
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

