By hangsiahong
Behavioral guidelines to reduce common LLM coding mistakes, derived from Andrej Karpathy's observations on LLM coding pitfalls
A single instruction file to improve AI coding agent behavior, derived from Andrej Karpathy's observations on LLM coding pitfalls.
From Andrej's post:
"The models make wrong assumptions on your behalf and just run along with them without checking. They don't manage their confusion, don't seek clarifications, don't surface inconsistencies, don't present tradeoffs, don't push back when they should."
"They really like to overcomplicate code and APIs, bloat abstractions, don't clean up dead code... implement a bloated construction over 1000 lines when 100 would do."
"They still sometimes change/remove comments and code they don't sufficiently understand as side effects, even if orthogonal to the task."
Four principles that directly address these issues:
| Principle | Addresses |
|---|---|
| Think Before Coding | Wrong assumptions, hidden confusion, missing tradeoffs |
| Simplicity First | Overcomplication, bloated abstractions |
| Surgical Changes | Orthogonal edits, touching code you shouldn't |
| Goal-Driven Execution | Leverage through tests-first, verifiable success criteria |
From within Claude Code, first add the marketplace:
/plugin marketplace add forrestchang/andrej-karpathy-skills
Then install the plugin:
/plugin install andrej-karpathy-skills@karpathy-skills
This installs the guidelines as a Claude Code plugin, making the skill available across all your projects.
From within Codex, install the skill:
$skill-installer install from https://github.com/hangsiahong/andrej-karpathy-skills
Or manually copy:
cp -r skills/karpathy-guidelines ~/.codex/skills/
For Claude Code — copy or append CLAUDE.md to your project root:
curl -o CLAUDE.md https://raw.githubusercontent.com/hangsiahong/andrej-karpathy-skills/main/CLAUDE.md
For Codex — copy or append AGENTS.md to your project root:
curl -o AGENTS.md https://raw.githubusercontent.com/hangsiahong/andrej-karpathy-skills/main/AGENTS.md
Don't assume. Don't hide confusion. Surface tradeoffs.
Minimum code that solves the problem. Nothing speculative.
The test: Would a senior engineer say this is overcomplicated? If yes, simplify.
Touch only what you must. Clean up only your own mess.
The test: Every changed line should trace directly to the user's request.
Define success criteria. Loop until verified.
| Instead of... | Transform to... |
|---|---|
| "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" |
From Andrej:
"LLMs are exceptionally good at looping until they meet specific goals... Don't tell it what to do, give it success criteria and watch it go."
| Agent | Plugin System | Project Instructions | Skill Format |
|---|---|---|---|
| Claude Code | .claude-plugin/ | CLAUDE.md | skills/*/SKILL.md |
| Codex | .codex-plugin/ + .agents/plugins/ | AGENTS.md | skills/*/SKILL.md |
Both agents share the same SKILL.md format. The skill content is universal — only the packaging differs.
These guidelines bias toward caution over speed. For trivial tasks (simple typo fixes, obvious one-liners), use judgment — not every change needs the full rigor.
MIT
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
npx claudepluginhub hangsiahong/andrej-karpathy-skills --plugin andrej-karpathy-skillsCore skills library for Claude Code: TDD, debugging, collaboration patterns, and proven techniques
Behavioral guidelines to reduce common LLM coding mistakes, derived from Andrej Karpathy's observations on LLM coding pitfalls
Programming as Theory Building guidelines for coding agents, grounded in Peter Naur's paper and focused on preserving program theory during code work.
Self-Evolving AI Coding Infrastructure — Generate, Curate, and Enhance Reusable Wisdom
Anti-over-engineering skill for AI coding agents. Teaches your AI when to stop.
Hand token-heavy mechanical work (batch edits, scaffolding, refactors, test generation, plotting scripts) from Claude to Codex CLI.
Analyze Claude Code agent session transcripts to identify inefficiencies, anti-patterns, repeated mistakes, missing tooling opportunities, and user frustration signals for continuous improvement