Wink Pings

Add 4 Rules to AI Coding: Cut Rework by Half

This set of AI coding guidelines, summarized based on Andrej Karpathy's observations, has been turned into a directly reusable configuration file. Drop it into your project, and tools like Claude and Cursor will stop making up requirements out of nowhere, over-engineering solutions, and modifying irrelevant code. Many developers have tested it and found it cuts rework by at least 50%.

Developers who use AI to write code have almost certainly run into these frustrating issues: you only ask to change an API parameter, and AI goes and re-formats the entire file; a 100-line solution gets bloated into 500 lines of unnecessary abstraction and redundant configuration; AI adds a bunch of unrequested features out of the blue, and you spend half a day debugging just to find the extra logic it added on its own.

Andrej Karpathy previously summarized these common pitfalls of LLM-powered coding, and now someone has turned the corresponding solutions into a ready-to-use configuration hosted in the GitHub repository [multica-ai/andrej-karpathy-skills](https://github.com/multica-ai/andrej-karpathy-skills). Just drop the `CLAUDE.md` file into your project root, and you'll see a clear improvement in the consistency of AI-generated code.

The core of this system is four behavioral constraints that directly target the three most common problems with LLM coding: making unconfirmed assumptions, over-engineering, and uncontrolled change scope.

### Four Core Guidelines

#### 1. Think First, Code Later

Do not let AI guess requirements blindly. For any ambiguous requirement, AI must list all possible interpretations and confirm them before starting, instead of picking one at random and coding immediately; if a simpler implementation exists, it must be proposed proactively; stop immediately when hitting uncertain details, clearly state what the question is, and never push through blindly.

#### 2. Prioritize Simplicity

Only write exactly enough code to solve the requirement. Never add unrequested features, abstraction for one-off code, unmentioned configurable options, or error handling for impossible edge cases. If 200 lines of code can be compressed to 50, it must be rewritten. The rule of thumb is simple: would a senior engineer consider this over-engineered? If yes, simplify it.

#### 3. Make Precise Changes

When modifying existing code, only touch lines directly related to the requirement. Do not change nearby comments or formatting on a whim; do not refactor working code; match the existing project's code style even if it conflicts with AI's default preferences. Only remove unused variables, imports, and functions introduced by the current change. Do not touch dead code that already existed in the project, just mention it separately if needed. Every changed line must directly map to the user's requirement.

#### 4. Execute Goal-Oriented

When giving requirements to AI, convert vague instructions into verifiable goals. For example, instead of "add parameter validation", say "first write test cases for invalid inputs, then make the code pass all tests"; instead of "fix this bug", say "first write a test case that reproduces the bug, then make the test pass". For multi-step tasks, outline a plan first with clear acceptance criteria for each step.

### Installation and Usage

The fastest setup takes just 30 seconds: run the command below in your project root to pull the configuration file directly:

```bash

curl -o CLAUDE.md https://raw.githubusercontent.com/multica-ai/andrej-karpathy-skills/main/CLAUDE.md

```

Claude Code users can install the corresponding plugin directly to apply the rules globally across all projects. For Cursor users, a Cursor-adapted rule file is already provided in the repository, just import it following the documentation.

If you have project-specific specifications, you can append custom rules directly to the end of `CLAUDE.md`—for example, requiring TypeScript strict mode, mandatory tests for all API endpoints, or adherence to a specific error handling logic. No changes to the original rules are needed.

### Effect and Tradeoffs

You can tell the rules are working if you see four outcomes: almost no irrelevant changes in diffs, code is concise enough on the first try with no rewrites needed, AI asks for clarification when uncertain before implementing, and no offhand "optimizations" or refactors in pull requests.

This set of rules leans towards conservative practices, and works best for non-trivial development tasks. For simple work like fixing typos or adding a one-line configuration, you can adjust the requirements flexibly. The core goal is to reduce debugging and rework costs for complex tasks, not slow down simple work.

Many developers who tested it report that after adopting these rules, AI coding rework has dropped by at least half. The repository has already been starred and tested by many developers.

Repository link: [https://github.com/multica-ai/andrej-karpathy-skills](https://github.com/multica-ai/andrej-karpathy-skills)

发布时间: 2026-05-22 22:01