karpathy-guardrails

karpathy-guardrails is a skill for Claude Code from LucasDuys/forge. It costs 37 tokens per session (999 once invoked), scanned A, original, MIT.

A set of working rules for Forge agents based on simple software-engineering principles. It emphasizes stating assumptions, keeping changes small, and staying within the requested scope.

In plain words
What is it for?
Use it when planning, implementing, or reviewing Forge tasks where requirements may be unclear or several solutions are possible.
Why use it?
It helps prevent guessed requirements, unnecessary complexity, silent decisions, and work that expands beyond the task.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the forge plugin — 10 skills, 13 commands, 9 agents, 3 hooks shipped together

Good fit Use it when planning, implementing, or reviewing Forge tasks where requirements may be unclear or several solutions are possible.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/lucasduys/forge/karpathy-guardrails
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add LucasDuys/forge --skill karpathy-guardrails
Clone the repo
git clone --depth 1 https://github.com/LucasDuys/forge

Made for: Claude Code.

Or install forge, the plugin that ships this one along with the rest of its 10 skills, 13 commands, 9 agents, 3 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for karpathy-guardrails

README.md
[![agentmods](https://agentmods.dev/badge/skills/lucasduys/forge/karpathy-guardrails/github.svg)](https://agentmods.dev/skills/lucasduys/forge/karpathy-guardrails)
Your own site
<a href="https://agentmods.dev/skills/lucasduys/forge/karpathy-guardrails"><img src="https://agentmods.dev/badge/skills/lucasduys/forge/karpathy-guardrails/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for karpathy-guardrails

Your own site · 80×15
<a href="https://agentmods.dev/skills/lucasduys/forge/karpathy-guardrails"><img src="https://agentmods.dev/badge/skills/lucasduys/forge/karpathy-guardrails.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 37 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 999 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00037 $0.00999
Opus 5 $0.00018 $0.00500
Sonnet 5 $0.00007 $0.00200
Haiku 4.5 $0.00004 $0.00100

Measured 11d ago against content hash 14a1ecca543a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

karpathy-guardrails scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/karpathy-guardrails/SKILL.md · 93 lines

How it starts

The opening of the file, as written. The whole thing — 93 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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

Read the full file on GitHub · 93 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 93 lines · 37 tokens per session scan A 14a1ecca543a

Subscribe to this mod's changes

karpathy-guardrails is a skill published in the GitHub repository LucasDuys/forge (55 stars, last pushed 1mo ago), licensed MIT. It adds 37 tokens to every session and 999 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.