Agent skill

Karpathy Principles

by KbWen in KbWen/agentic-os

Behavioral guidelines to reduce common LLM coding mistakes — Think Before Coding, Simplicity First, Surgical Changes, Goal-Driven Execution.

MITAuto-check passedAI & LLM Engineering

Install Karpathy Principles

skills CLI
$ npx skills add KbWen/agentic-os --skill karpathy-principles -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install KbWen/agentic-os karpathy-principles --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/KbWen/agentic-os.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/karpathy-principles .claude/skills/karpathy-principles && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
karpathy-principles
GitHub stars
207
Token cost
~1.5k tokens
SKILL.md length
719 words
Files
2
Skills in repo
12
Repo updated
First seen
Licence
MIT

At a glance

Behavioral guidelines to reduce common LLM coding mistakes — Think Before Coding, Simplicity First, Surgical Changes, Goal-Driven Execution.

  • Works in 4 steps: Think Before Coding → Simplicity First → Surgical Changes → …
  • AI & LLM Engineering work in your project
  • SKILL.md covers When to Apply, 1. Think Before Coding, 2. Simplicity First and 3. Surgical Changes, plus 7 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Karpathy Principles is an agent skill from KbWen/agentic-os. Behavioral guidelines to reduce common LLM coding mistakes — Think Before Coding, Simplicity First, Surgical Changes, Goal-Driven Execution.

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files (for example `agents/openai.yaml`).

It sits in AI & LLM Engineering. The repository describes itself as: Governance framework for AI coding agents. It runs them through a five-step workflow (plan, build, review, test, ship) where no step counts as done without evidence. Drop-in… The licence is MIT.

When your agent uses it

  • AI & LLM Engineering work in your project

Example prompts

  • “/karpathy-principles”

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Think Before Coding
  2. Simplicity First
  3. Surgical Changes
  4. Goal-Driven Execution

What it can do on your machine

Read from SKILL.md and the folder at commit 81a4034. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • github.com
    • x.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Karpathy Principles loads about 1.5k tokens when it runs. Until then it costs about 40 tokens; SKILL.md has 719 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~40
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from KbWen/agentic-os at commit 81a4034, republished under its MIT licence (© KbWen). 719 words, ~1,541 tokens.

Download SKILL.mdSave it as .claude/skills/karpathy-principles/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
karpathy-principles
description
Behavioral guidelines to reduce common LLM coding mistakes — Think Before Coding, Simplicity First, Surgical Changes, Goal-Driven Execution.

Karpathy Coding Principles

Derived from Andrej Karpathy's observations on LLM coding pitfalls.

Tradeoff: These guidelines bias toward caution over speed. For trivial tasks, use judgment.

When to Apply

  • Classification: quick-win, feature, architecture-change, hotfix
  • Phase: /plan (assumption surfacing), /implement (simplicity + surgical), /review (scope audit)
  • Trigger: All non-trivial coding tasks — this is a behavioral baseline, not a domain skill

1. Think Before Coding

Don't assume. Don't hide confusion. Surface tradeoffs.

Before implementing:

  • State your assumptions explicitly. If uncertain, ask.
  • If multiple interpretations exist, present them — don't pick silently.
  • If a simpler approach exists, say so. Push back when warranted.
  • If something is unclear, stop. Name what's confusing. Ask.

2. Simplicity First

Minimum code that solves the problem. Nothing speculative.

  • No features beyond what was asked.
  • No abstractions for single-use code.
  • No "flexibility" or "configurability" that wasn't requested.
  • No error handling for impossible scenarios.
  • If you write 200 lines and it could be 50, rewrite it.

Self-check: "Would a senior engineer say this is overcomplicated?" If yes, simplify.

3. Surgical Changes

Touch only what you must. Clean up only your own mess.

When editing existing code:

  • Don't "improve" adjacent code, comments, or formatting.
  • Don't refactor things that aren't broken.
  • Match existing style, even if you'd do it differently.
  • If you notice unrelated dead code, mention it — don't delete it.

When your changes create orphans:

  • Remove imports/variables/functions that YOUR changes made unused.
  • Don't remove pre-existing dead code unless asked.

The test: Every changed line should trace directly to the user's request.

4. Goal-Driven Execution

Define success criteria. Loop until verified.

Transform tasks into verifiable goals:

  • "Add validation" → "Write tests for invalid inputs, then make them pass"
  • "Fix the bug" → "Write a test that reproduces it, then make it pass"
  • "Refactor X" → "Ensure tests pass before and after"

For multi-step tasks, state a brief plan:

1. [Step] → verify: [check]
2. [Step] → verify: [check]
3. [Step] → verify: [check]

Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification.

Checklist

During /plan:

  • Assumptions stated explicitly before proposing solution
  • Ambiguities surfaced — multiple interpretations presented if they exist
  • Simplest viable approach chosen (justify if not the simplest)

During /implement:

  • No features beyond what was asked
  • No abstractions for single-use code
  • Every changed line traces to the user's request
  • Pre-existing code left alone unless directly required
  • Success criteria defined before implementation begins

During /review:

  • Diff contains only requested changes — no drive-by refactoring
  • Code is not overcomplicated — could a simpler version work?
  • Orphaned imports/variables from THIS change are cleaned up
  • Pre-existing dead code mentioned but not deleted
Show full SKILL.md (310 more words)Show less

Code Simplification Checklist

When reviewing or refactoring, apply Chesterton's Fence — understand WHY before removing:

  • Deep nesting (>3 levels) → extract to named functions
  • Long functions (>50 lines) → split by responsibility
  • Poor naming → rename to reveal intent
  • Speculative abstractions → remove if only one caller exists
  • Duplicate logic → extract only if 3+ occurrences (not 2)

Simplification rules:

  • Preserve behavior exactly — simplification is NOT a feature change
  • Fewer lines is not always simpler — a 1-line nested ternary is worse than a 5-line if/else
  • Separate simplification commits from feature commits — never mix

Heading-Scoped Read Note

For phase-entry loading, read only:

  • When to Apply
  • Checklist
  • Code Simplification Checklist

Load numbered principle sections (## 1–## 4), Common Rationalizations, Anti-Patterns, and References on full read or cache miss only.

Common Rationalizations

RationalizationReality
"It works, that's good enough"Working code that's unreadable or architecturally wrong creates debt that compounds.
"We'll clean it up later"Later never comes. The current phase is the quality gate — use it.
"I'm confident about this approach"Confidence is not evidence. State your assumptions explicitly or verify against docs.
"This abstraction might be useful later"Don't preserve speculative abstractions. If there's only one caller, inline it.
"I'll just quickly improve this unrelated code too"Unscoped changes create noisy diffs and obscure the actual intent. Touch only what you must.
"The tests pass, so it's good"Tests are necessary but not sufficient. They don't catch architecture problems, security issues, or readability.

Anti-Patterns

  • Silent assumption: Picking one interpretation without surfacing alternatives
  • Speculative flexibility: Adding config/abstraction layers "for the future"
  • Drive-by cleanup: "Improving" adjacent code that wasn't part of the request
  • Vague completion: Claiming "done" without verifiable success criteria
  • Rationalizing shortcuts: Using plausible-sounding excuses to skip verification steps

References

© KbWen, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in .agents/skills/karpathy-principles of KbWen/agentic-os.

  • SKILL.md
  • agents/openai.yaml

Open the folder on GitHubat commit 81a4034

Compare with similar skills

Karpathy Principles next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Karpathy Principles compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Karpathy Principles this skillKbWen/agentic-os207—~1.5kAutomated safety check: PassMIT
Agent BuildershareAI-lab/learn-claude-code78k4 repos~1.2kAutomated safety check: PassMIT
Planning With Filesjarrodwatts/claude-code-config1.1k5 repos~967Automated safety check: PassNone
Codebase Managementgiancarloerra/SocratiCode3.3k1 repos~1.8kAutomated safety check: PassAGPL-3.0
Context Compressionguanyang/open-agent-hub9772 repos~4.6kAutomated safety check: PassMIT
Looperksimback/looper710—~2.7kAutomated safety check: NotesMIT

Similar skills

  • Agent Builder

    shareAI-lab/learn-claude-code

    Design and build AI agents for any domain. An agent skill from shareAI-lab/learn-claude-code.

    78k GitHub starsUsed in 4 repos~1.2k tokens
    AI & LLM EngineeringAuto-check passed
  • Planning With Files

    jarrodwatts/claude-code-config

    Transforms workflow to use Manus-style persistent markdown files for planning, progress tracking, and knowledge storage.

    1.1k GitHub starsUsed in 5 repos~967 tokens
    AI & LLM EngineeringAuto-check passed
  • Codebase Management

    giancarloerra/SocratiCode

    Set up, index, and manage SocratiCode codebase indexing. An agent skill from giancarloerra/SocratiCode.

    3.3k GitHub starsUsed in 1 repo~1.8k tokens
    AI & LLM EngineeringAuto-check passed
  • Context Compression

    guanyang/open-agent-hub

    This skill should be used when long-running agent sessions need context compression, structured summarization, compaction, token-per-task optimization, or durable handoff summaries that preserve…

    977 GitHub starsUsed in 2 repos~4.6k tokens
    AI & LLM EngineeringAuto-check passed
  • Looper

    ksimback/looper

    Scaffold a well-designed agent loop with best-practice coaching and a cross-model review council.

    710 GitHub stars~2.7k tokensUpdated 2 mo ago
    AI & LLM EngineeringAuto-check: notes
  • Docs Planner

    strands-agents/harness-sdk

    Identify documentation gaps and prioritize the docs backlog.

    8.8k GitHub stars~821 tokensUpdated today
    AI & LLM EngineeringAuto-check passed

More from KbWen/agentic-os

All 12 skills in this repo
  • API Design

    KbWen/agentic-os

    Design or review REST/GraphQL APIs when endpoints or contracts change.

    207 GitHub stars~1k tokensUpdated 3 days ago
    Auto-check passed
  • Frontend Patterns

    KbWen/agentic-os

    Apply frontend conventions when components, pages, forms, or client state change.

    207 GitHub stars~1.2k tokensUpdated 3 days ago
    Auto-check passed
  • Production Readiness

    KbWen/agentic-os

    Use at review and ship, automatically for feature or architecture changes and on request for error handling, logging, crash reporting, or observability; verify errors reach production monitoring.

    207 GitHub stars~938 tokensUpdated 3 days ago
    Auto-check passed
  • Doc Lookup

    KbWen/agentic-os

    Check official docs when framework APIs or configuration may be version-sensitive.

    207 GitHub stars~2.6k tokensUpdated 3 days ago
    Auto-check: warnings
  • Systematic Debugging

    KbWen/agentic-os

    A skill your agent uses when investigating a bug, test failure, flaky test, unexpected behavior, or a hotfix, or an unexplained or failed fix; find the root cause first.

    207 GitHub stars~496 tokensUpdated 3 days ago
    Auto-check passed
  • Database Design

    KbWen/agentic-os

    Design schemas and migrations when persistent data structures change.

    207 GitHub stars~1.2k tokensUpdated 3 days ago
    Auto-check passed

Questions about Karpathy Principles

What does Karpathy Principles do?

Behavioral guidelines to reduce common LLM coding mistakes — Think Before Coding, Simplicity First, Surgical Changes, Goal-Driven Execution. Karpathy Principles is an agent skill from KbWen/agentic-os. Behavioral guidelines to reduce common LLM coding mistakes — Think Before Coding, Simplicity First, Surgical Changes, Goal-Driven Execution.

When should I use Karpathy Principles?

Karpathy Principles fits situations like: AI & LLM Engineering work in your project.

How do I install Karpathy Principles in Claude Code?

Run `npx skills add KbWen/agentic-os --skill karpathy-principles -a claude-code`. Or copy the skill folder (.agents/skills/karpathy-principles in KbWen/agentic-os) into .claude/skills/karpathy-principles in your project. Claude Code loads it when a task matches its description.

How do I install Karpathy Principles in Codex?

Run `npx skills add KbWen/agentic-os --skill karpathy-principles -a codex`. Or copy the skill folder (.agents/skills/karpathy-principles in KbWen/agentic-os) into .agents/skills/karpathy-principles in your project. Codex loads it when a task matches its description.

Can I use Karpathy Principles in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add KbWen/agentic-os --skill karpathy-principles -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/karpathy-principles, .gemini/skills/karpathy-principles, .github/skills/karpathy-principles and .opencode/skills/karpathy-principles in your project.

What does Karpathy Principles need to run?

SKILL.md names no scripts, command-line tools or credentials: Karpathy Principles is instructions for the agent only.

Does Karpathy Principles access the network?

SKILL.md names 2 domains. As links in the text: github.com and x.com. This is read from the text; nothing was executed.

Is Karpathy Principles safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Karpathy Principles use?

Karpathy Principles is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Karpathy Principles use?

About 1.5k tokens (SKILL.md is roughly 6.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Karpathy Principles?

Skills that share tags, products or a category with Karpathy Principles: Agent Builder (shareAI-lab/learn-claude-code, 78k stars), Planning With Files (jarrodwatts/claude-code-config, 1.1k stars), Codebase Management (giancarloerra/SocratiCode, 3.3k stars) and Context Compression (guanyang/open-agent-hub, 977 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Karpathy Principles?

KbWen (a GitHub user) maintains it in KbWen/agentic-os, which has 207 GitHub stars. The repository holds 12 skills in this directory. The repository was last updated on October 6, 2026.

Source: KbWen/agentic-os on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.