Karpathy guardrails

From hashgraph-online/awesome-codex-plugins · View interactive version

Karpathy guardrails is an AI agent skill from the GitHub repository hashgraph-online/awesome-codex-plugins. Behavioral guardrails for Cavekit agents. Four principles — think before coding, simplicity first, surgical changes, goal-driven execution — that prevent over-engineering, silent assumptions, scope creep, and unfocused work. Every task-builder, reviewer, planner, and inspector must internalize these

How to use this skill

Skill file

Karpathy Guardrails

Four rules. Load them into context at the start of every task. The reviewer

enforces them as a Pass-1 filter before it looks at code quality.

1. Think Before Coding

Before the first edit, write down:

unverified, flag NEEDS_CONTEXT and ask — do not guess.

test, check, or observable behaviour. If a criterion is not verifiable,

propose a sharpening via the revision skill (automated-trace subsection), not a vague attempt.

Refusing to produce code is allowed. A task with unknown scope is a spec bug,

not a coding task.

2. Simplicity First

The correct amount of code is the minimum that meets the acceptance criteria.

abstraction with two configuration knobs.

If the diff is larger than the acceptance criteria seem to demand, explain why

in the commit body. If you cannot, trim the diff.

3. Surgical Changes

Every line in the diff must trace back to an acceptance criterion. Touching

code outside the task's owned files is justified only when a requirement forces

it. Examples of violations:

If you see a real bug in adjacent code, log it to .cavekit/history/backprop-log.md

as a candidate kit item and keep it out of this task's diff.

4. Goal-Driven Execution

Transform vague tasks into verifiable success criteria before execution.

exact files to inspect. "Make sure it works" is not a plan.

Role-specific enforcement

each AC, the verification step, and the observed result.

any of: undeclared assumptions, diff lines unjustified by an AC, out-of-scope

edits, or unreachable verification steps.

bugs and block planning.

or hand-waved.

When you are tempted to break a rule

You are probably over-confident about a shortcut that will cost more than the

delay of asking. Stop and note the tension in the commit body or in the build

log so the reviewer can judge.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.