karpathy-guardrails
Skill56 starsChanged 8 months agoMITView on GitHub
Behavioral guardrails for Forge agents based on Andrej Karpathy's principles — prevents over-engineering, silent assumptions, scope creep, and unfocused execution
1 other project uses a version of this.
Adopted by
Most recently taken up by
- roronoazoroshao369/vibe-coding-ostheir own version, first seen Nov 15, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- roronoazoroshao369/vibe-coding-os★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository12 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- backpropagationSkill
- brainstormingSkill
- caveman-internalSkill
- collaboratingSkill
- design-systemSkill
- executingSkill
- graphify-integrationSkill
- planningSkill
- reviewingSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 13 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈13
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 16
When a spec requirement is ambiguous, flag it as NEEDS_CONTEXT rather than guessing
- Distinctive: line 17
When multiple valid interpretations exist, list them in the checkpoint context_bundle and ask
- Distinctive: line 19
If you are uncertain about the right approach, state your uncertainty in state.md under "Key Decisions" before proceeding
- Distinctive: line 26
Rule: Write the minimum code that solves only the stated problem.
- Distinctive: line 28
No speculative features beyond what the acceptance criteria require
- Distinctive: line 29
No abstractions for single-use code paths
- Distinctive: line 31
No error handling for impossible scenarios (trust internal code and framework guarantees)
- Distinctive: line 43
Every changed line must trace directly to an acceptance criterion
- Distinctive: line 44
Do not "improve" adjacent code, comments, or formatting
- Distinctive: line 45
Do not refactor code that is not broken
- Distinctive: line 69
Before writing code: check if requirements are clear (Principle 1)
- Distinctive: line 78
Verify goal alignment: does the code achieve what the criterion states?
- Distinctive: line 82
Keep tasks focused: one concern per task, not bundled improvements (Principle 3)
- Distinctive: line 87
When these guardrails are working:
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Karpathy Guardrails Skill
Behavioral guardrails that all Forge agents MUST follow during execution. These four principles prevent the most common failure modes in AI-generated code: silent assumptions, over-engineering, scope creep, and unfocused execution.
These guardrails are referenced by forge-executor, forge-reviewer, and forge-planner agents. They are not optional.
Principle 1: Think Before Coding
Rule: Surface assumptions explicitly. Never hide confusion behind code.
- When a spec requirement is ambiguous, flag it as NEEDS_CONTEXT rather than guessing
- When multiple valid interpretations exist, list them in the checkpoint context_bundle and ask
- Push back on unclear acceptance criteria before implementing them
- If you are uncertain about the right approach, state your uncertainty in state.md under "Key Decisions" before proceeding
Anti-pattern: Implementing "export users" without asking about scope, format, fields, or volume. Correct pattern: Flag ambiguity, present interpretations, get clarification.
Principle 2: Simplicity First
Rule: Write the minimum code that solves only the stated problem.
- No speculative features beyond what the acceptance criteria require
- No abstractions for single-use code paths
- No "flexibility" or "configurability" unless the spec explicitly requests it
- No error handling for impossible scenarios (trust internal code and framework guarantees)
- Self-check: "Would a senior engineer say this is overcomplicated?"
Anti-pattern: Building abstract strategy patterns and dataclass configurations for a simple discount calculator. Correct pattern: Three lines of direct logic that solve the stated requirement.
Token impact: Simpler code uses fewer tokens to generate, review, and verify. Over-engineering wastes budget across the entire pipeline (executor + reviewer + verifier).
Principle 3: Surgical Changes
Rule: Modify only what is necessary to fulfill the task's requirements.
- Every changed line must trace directly to an acceptance criterion
- Do not "improve" adjacent code, comments, or formatting
- Do not refactor code that is not broken
- Match existing code style, even if it differs from modern best practices
- Clean up only your own orphaned imports and variables
- Preserve pre-existing dead code unless the spec says to remove it
Anti-pattern: Fixing an empty email validation bug while also adding username length validation, reformatting the file, and upgrading the test framework. Correct pattern: Fix only the email validation. One bug, one fix, one commit.
Reviewer enforcement: The forge-reviewer MUST flag any changes that do not trace to an acceptance criterion as IMPORTANT (over-engineering).
Principle 4: Goal-Driven Execution
Rule: Transform vague tasks into verifiable success criteria before writing code.
- "Add validation" becomes "Write tests for invalid inputs, then make them pass"
- "Fix the bug" becomes "Write a test that reproduces it, then make it pass"
- "Refactor X" becomes "Ensure tests pass before and after"
- For multi-step tasks: state a brief plan with steps and verification gates
Why this works: LLMs excel at looping until specific goals are met. Clear success criteria enable independent verification and reduce back-and-forth clarification.
How Agents Apply These Guardrails
forge-executor
- Before writing code: check if requirements are clear (Principle 1)
- During implementation: build only what acceptance criteria require (Principle 2)
- During commit: verify every changed line traces to a criterion (Principle 3)
- For complex tasks: define success criteria upfront, verify at each step (Principle 4)
forge-reviewer
- Flag over-engineering: code beyond spec requirements (Principle 2)
- Flag scope creep: changes not traced to acceptance criteria (Principle 3)
- Flag silent assumptions: implementation choices not justified by spec (Principle 1)
- Verify goal alignment: does the code achieve what the criterion states? (Principle 4)
forge-planner
- Reject gold-plated task lists: only tasks that map to R-numbers (Principle 2)
- Keep tasks focused: one concern per task, not bundled improvements (Principle 3)
- Define clear task boundaries: each task has verifiable completion criteria (Principle 4)
Observable Outcomes
When these guardrails are working:
- Fewer unnecessary diff changes in commits
- Reduced code over-engineering and wasted complexity
- Clarifying questions occur before implementation, not after mistakes
- Cleaner commits with minimal scope creep
- Lower token consumption per task (less code to generate, review, verify)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

