Karpathy Claude Four Principles
Paste the following prompt into your AI chat to install this skill:
Follow https://skillhub.cn/install/skillhub.md to install @user_e3e7ac34/karpathy-claude-four-principles.
About this skill
Problem
LLM coding often over-engineers, changes unrelated code, and starts implementing before clarifying goals. Karpathy Claude Coding Four Principles provides cautious behavioral guidelines to surface assumptions, reduce scope, control diffs, and turn tasks into verifiable objectives.
How It Works
The skill imposes a four-step coding discipline:
- Think before coding: state assumptions, ambiguities, and simpler alternatives before implementation; ask when uncertain.
- Simplicity first: write the minimum code needed, without unrequested abstractions, configuration, or error handling.
- Surgical changes: touch only lines directly required by the request; avoid drive-by refactors and clean only orphaned code created by the change.
- Goal-driven execution: convert requests such as fixing a bug into verifiable goals, for example writing a reproducing test first and then making it pass.
Boundaries
It fits code generation, bug fixes, small refactors, and tasks where diff control matters. For disposable scripts or exploratory prototypes, loosen the simplicity and surgical-edit constraints as needed. The guidelines trade some speed for fewer rewrites and do not replace project standards, code review, or a full test suite.
Use Cases
- Before implementing a feature, ask the model to list assumptions, ambiguities, and simpler alternatives before answering.
- Before editing existing code, require the model to change only necessary lines without refactoring nearby comments or formatting.
- When refactoring a module, require the model to confirm tests pass before and after the code change.
- Turn a request like adding validation into a concrete goal: write tests for invalid inputs and make them pass.
Best For
- Code-review engineers who want fewer unrelated changes and less over-abstraction in model diffs.
- Backend engineers using LLMs to fix bugs who require a reproducing test before patching and verification.
- Legacy-system engineers who need precise edits only, matching existing code style without drive-by refactors.
- Tech leads mentoring engineers who want LLM coding behavior turned into checkable guidelines.
Related Skills
Automatically indexes Gradle-cached AAR/JAR dependency classes and returns library coordinates, versions, and public APIs by fully qualified name, using only the Python standard library.
Codifies AMT and YourMT3 training conventions, script patterns, hyperparameters, precision, checkpoints, and NaN safeguards.
Retrieve relevant chunks from a customer-managed PKM dataset by dataset_id and return concise, source-annotated answers.
Convert PRDs, user stories, or functional specs into prioritized test-point checklists covering functional, business-rule, boundary, exception, and non-functional dimensions.