If you are using Claude Code, the CLAUDE.md file is a powerful lever to shape its behavior and prevent it from making silent assumptions or writing verbose, speculative code. Derived from the popular andrej-karpathy-skills framework, here is a minimal instruction block you can paste directly into your root CLAUDE.md to keep Claude surgical and grounded: Claude Code Behavior Rules
- Think Before Coding Never make assumptions about undocumented APIs or configurations. Ask clarifying questions if a task’s requirements are ambiguous.
- Surgical Changes Modify only the minimum necessary lines of code to achieve the goal. Avoid refactoring adjacent or unrelated files unless explicitly asked. Match existing style, even if you would write it differently.
- Simplicity First Do not write speculative helper functions or complex abstractions. Prioritize simple, readable code over clever or DRY patterns.
- Goal-Driven Execution Establish clear test or verification criteria before writing any code. Run local tests or build steps to verify your changes actually work before completion. Keeping these rules short is key to preventing prompt-drift. If you want to quickly generate and customize these rules for your specific stack, testing frameworks, and linting tools, I put together a simple compiler here: [Link] Would love to hear what rules or constraints you regularly use to keep your agents from drifting. submitted by /u/Ambitious_Voice_454
Originally posted by u/Ambitious_Voice_454 on r/ClaudeCode
You must log in or # to comment.
