Inspired by forrestchang/andrej-karpathy-skills.
Source: forrestchang/andrej-karpathy-skillsReverse-engineered from real GitHub workflow.
A single CLAUDE.md file to improve Claude Code behavior, derived from Andrej Karpathy's observations on LLM coding pitfalls.
No specific use case defined.
I want to create a comprehensive set of guidelines, similar to the `CLAUDE.md` file from the 'karpathy-inspired-claude-code-guidelines' repository, to improve how large language models (LLMs) like yourself approach and execute coding tasks. The goal is to generate a single markdown file that acts as an internal reference for coding agents, designed to mitigate common pitfalls observed in LLM coding behavior, drawing inspiration from Andrej Karpathy's observations.
The core purpose of this project is to foster more thoughtful, simpler, and precise code generation. The primary "tech stack" for this output is simply markdown, as it's the most direct and accessible format for these internal guidelines.
Please generate a `CLAUDE.md` file for me. This file should articulate and explain the following four core principles, providing actionable advice under each:
1. **Think Before Coding**: This principle should guide the agent to explicitly state any assumptions made, present multiple interpretations if ambiguity exists in a request, push back or suggest simpler alternatives when appropriate, and clearly articulate any confusion to seek clarification rather than proceeding on an uncertain path.
2. **Simplicity First**: This principle aims to combat over-engineering. It should instruct the agent to generate only the minimum code necessary to solve the problem, avoid speculative features or abstractions not explicitly requested, eschew unnecessary flexibility or configurability, and actively simplify code if it appears overcomplicated or bloated (e.g., rewriting 200 lines into 50 if possible).
3. **Surgical Changes**: When modifying existing code, this principle emphasizes making precise and contained edits. It should advise against "improving" adjacent code, comments, or formatting, refactoring components that are not directly broken, or deviating from existing code style. Furthermore, cleanup should be strictly limited to removing dead code or elements directly introduced by the agent's own changes, not pre-existing ones.
4. **Goal-Driven Execution**: This principle should encourage the agent to focus on verifiable success criteria. It implies a tests-first approach where applicable, ensuring that the generated code directly addresses the problem and meets clearly defined, measurable outcomes.
Please structure this `CLAUDE.md` file with these principles and their detailed explanations, making it a robust guide for coding agents.