karpathy-coder
Fungsinya
Skill ini meninjau kode berdasarkan empat prinsip: nyatakan asumsi, buat tetap sederhana, ubah hanya yang diperlukan, dan verifikasi terhadap tujuan yang jelas. Cocok untuk pengembang yang menginginkan kode AI yang lebih ramping dan aman.
Kapan dipakai
- โSaat Anda akan commit kode dan ingin memeriksanya dari pembuatan berlebihan.
- โSaat Anda meninjau diff dan mencurigai perubahannya terlalu luas.
- โSaat agent mungkin membuat asumsi yang belum Anda setujui.
Link skill
https://github.com/alirezarezvani/claude-skills/blob/main/engineering/karpathy-coder/skills/karpathy-coder/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
โSaya ingin Anda memeriksa perubahan terakhir saya dari pembuatan berlebihan dan dari hal apa pun yang Anda asumsikan tanpa bertanya kepada saya.โ
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent menjalankan skrip pembantu yang menandai kompleksitas tambahan, perubahan di luar tujuan, dan asumsi yang tidak dinyatakan, lalu melaporkan temuannya.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Karpathy Coder โ Active Coding Discipline
Derived from Andrej Karpathy's observations on LLM coding pitfalls. This is not just guidelines โ it ships Python tools that detect violations, a review agent, a slash command, and a pre-commit hook.
"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."
"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."
โ Andrej Karpathy
The four principles
1. Think Before Coding
Don't assume. Don't hide confusion. Surface tradeoffs.
- State 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.
The test: 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.
- 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.
- 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.
| 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" |
For multi-step tasks, state a brief plan:
1. [Step] โ verify: [check]
2. [Step] โ verify: [check]
3. [Step] โ verify: [check]
Slash command
/karpathy-check โ Run the full 4-principle review on your staged changes.
Python tools (scripts/)
All tools are stdlib-only. Run with --help.
| Script | What it detects |
|---|---|
complexity_checker.py |
Over-engineering: too many classes, deep nesting, high cyclomatic complexity, unused params, premature abstractions |
diff_surgeon.py |
Diff noise: lines that don't trace to the stated goal โ comment changes, style drift, drive-by refactors |
assumption_linter.py |
Hidden assumptions in a plan: unasked features, missing clarifications, silent interpretation choices |
goal_verifier.py |
Weak success criteria: vague plans without verifiable checks, missing test assertions |
Sub-agent
karpathy-reviewer โ Runs all 4 principles against a diff. Dispatched by /karpathy-check or manually before committing.
Pre-commit hook
hooks/karpathy-gate.sh โ runs complexity_checker.py and diff_surgeon.py on staged files. Warns (non-blocking) when violations are found. Wire it via .claude/settings.json or Husky.
References
references/karpathy-principles.mdโ the source quotes, deeper context, when to relax each principlereferences/anti-patterns.mdโ 10+ before/after examples across Python, TypeScript, and shellreferences/enforcement-patterns.mdโ how to wire hooks, CI integration, team adoption
When to relax
These principles bias toward caution over speed. For trivial tasks (typo fixes, obvious one-liners), use judgment. The principles matter most on:
- Non-trivial implementations (>20 lines changed)
- Code you don't fully understand
- Multi-step tasks with unclear requirements
- Anything that will be reviewed by humans
Cross-tool compatibility
Installs via plugin for Claude Code. For other tools, copy the principles into your s
Pertanyaan umum
Apa arti membuat tetap sederhana?
Artinya menulis hanya kode yang dibutuhkan tugas, tanpa fitur tambahan atau abstraksi spekulatif.
Bisakah ia memeriksa kode sebelum commit?
Bisa. Ia dapat berjalan sebagai pemeriksaan pra-commit, sehingga masalah tertangkap sebelum commit dibuat.
Dari mana prinsip-prinsipnya berasal?
Prinsip itu didasarkan pada pengamatan Andrej Karpathy tentang kesalahan umum yang sering dibuat alat coding AI.
Detail
Deskripsi asli dari pembuat
Use before committing or while reviewing a diff, or when code may be overbuilt. Checks it against Karpathy's four principles with complexity_checker.py, diff_surgeon.py and assumption_linter.py: surface assumptions, keep it simple, change surgically, verify goals.
Popularitas
- Bintang GitHub
- 29k
- Peringkat
- #9563
- Lisensi
- MIT
- Diperbarui
- 2/11/2026
Komentar
- โฆ
Skill lain dari repositori ini
agent-launcher-orchestrator
29kMembantu agent Anda merencanakan, membangun, menguji, dan menjadwalkan agent Claude terkelola di akun Anda sendiri, langkah demi langkah.
grade-iterate
29kMembantu agent Anda menilai hasil kerja agent AI terkelola berdasarkan rubrik dan memperbaikinya dalam jumlah putaran tetap, agar tidak berputar tanpa henti.
interview
29kMembantu agent Anda mewawancarai Anda tentang ide agent AI dan mengubah jawaban Anda menjadi rencana pembangunan sederhana sebelum apa pun diluncurkan.
run-without-you
29kMembantu agent Anda disiapkan agar berjalan tanpa Anda sesuai jadwal atau saat sebuah peristiwa terjadi, dengan waktu cron diperiksa sebelum peluncuran.
Skill serupa
diffs
394kMemungkinkan agent Anda menghasilkan diff perubahan yang nyata dan dapat dibagikan sebagai tautan viewer atau file gambar, bukan ringkasan yang ditulis manual.
coding-agent
394kMembantu agent Anda menyerahkan pekerjaan pemrograman besar ke Codex, Claude Code, atau OpenCode di latar belakang, lalu memeriksa kemajuannya.
gh-issues
394kMembantu agent Anda menemukan issue GitHub, memilih yang dikerjakan, dan membuka pull request perbaikan, termasuk tindak lanjut komentar tinjauan.