Karpathy Guidelines logo

Karpathy Guidelines

Community
interfluve-wav
karpathy-guidelines

Behavioral guidelines to reduce common LLM coding mistakes. Derived from Andrej Karpathy's observations. Use ALWAYS when writing, reviewing, or refactoring code. Covers assumption surfacing, simplicity, surgical edits, and goal-driven execution with verification.

Overview

Publisherinterfluve-wav
Repositoryandrej-karpathy-skills-hermes
Skill namekarpathy-guidelines
Stars
29
Forks
4
Bundled files
1
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by interfluve-wav on GitHub. Read the source before you install it.

Installation

Install the Karpathy Guidelines AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/interfluve-wav/andrej-karpathy-skills-hermes/tree/main/Karpathy-Hermes-Skill
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/interfluve-wav/andrej-karpathy-skills-hermes.git /tmp/andrej-karpathy-skills-hermes
mkdir -p .claude/skills
cp -r /tmp/andrej-karpathy-skills-hermes/Karpathy-Hermes-Skill .claude/skills/karpathy-guidelines
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Karpathy Guidelines in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Karpathy Guidelines on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Karpathy Guidelines is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Karpathy Guidelines for Hermes

Behavioral guidelines to reduce common LLM coding mistakes, derived from Andrej Karpathy's observations on LLM coding pitfalls.

Tradeoff: These guidelines bias toward caution over speed. For trivial tasks (typo fixes, obvious one-liners), use judgment — not every change needs full rigor.


When to Load This Skill

Always active when:

  • Writing new code
  • Editing existing code
  • Reviewing code
  • Refactoring code
  • Planning code changes

Skip only when:

  • User explicitly says "just do it fast"
  • Pure configuration files (YAML, JSON, env)
  • Throwaway prototypes user confirmed are throwaway

The Four Principles

1. Think Before Coding

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

Before implementing ANYTHING:

  1. State assumptions explicitly. If uncertain, ask.
  2. Multiple interpretations? Present them — don't pick silently.
  3. Simpler approach exists? Say so. Push back when warranted.
  4. Something unclear? Stop. Name what's confusing. Ask.

Bad:

"I'll implement the export feature now." [proceeds with assumptions]

Good:

"Before implementing, I need to clarify:

  1. Export all users or filtered? (privacy implications)
  2. File download, API endpoint, or background job?
  3. Which fields? Some might be sensitive. What's your preference?"

The test: If you're about to write code and haven't stated your assumptions, you're doing it wrong.


2. Simplicity First

Minimum code that solves the problem. Nothing speculative.

Rules:

  • 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

Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.

Bad:

python
# Strategy pattern, abstract base class, config system...
# for a single discount calculation
class DiscountStrategy(ABC):
    @abstractmethod
    def calculate(self, amount: float) -> float: pass
class PercentageDiscount(DiscountStrategy):
    # 50+ lines

Good:

python
def calculate_discount(amount: float, percent: float) -> float:
    return amount * (percent / 100)

When to add complexity: Only when you actually need it. Refactor later when requirements emerge.


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.

Bad:

diff
- def upload_file(file_path, destination):
+ def upload_file(file_path: str, destination: str) -> bool:
+     """Upload file to destination with logging."""
+     logger.info(f"Uploading {file_path} to {destination}")
      try:
-         with open(file_path, 'rb') as f:
+         with open(file_path, "rb") as f:

[Added type hints, docstring, changed quote style — none requested]

Good:

diff
+ import logging
+ logger = logging.getLogger(__name__)
+
  def upload_file(file_path, destination):
+     logger.info(f'Starting upload: {file_path}')
      try:
          with open(file_path, 'rb') as f:

[Only added what was requested: logging. Matched existing style.]


4. Goal-Driven Execution

Define success criteria. Loop until verified.

Transform imperative tasks into verifiable goals:

Instead of...Transform to...
"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"
"Make it work""Define what 'works' means, write test, verify"

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.

Bad:

"I'll review the authentication code and make improvements." [Proceeds to change things without clear criteria]

Good:

"To fix authentication, I need success criteria. Issue: users stay logged in after password change. Plan:

  1. Write test: change password → old session invalidated
  2. Implement fix
  3. Verify test passes + no regressions Starting with step 1."

Integration with Hermes

This skill works alongside other Hermes skills:

  • [[test-driven-development]] — Pair with Principle 4 (Goal-Driven). TDD is the verification loop.
  • [[systematic-debugging]] — Pair with Principle 1 (Think Before Coding). Debug first, fix second.
  • [[writing-plans]] — Pair with Principle 4. Multi-step tasks need plans with verification.
  • [[requesting-code-review]] — All four principles apply during review.

Anti-Patterns Quick Reference

PrincipleAnti-PatternFix
Think Before CodingSilently assumes format, fields, scopeList assumptions, ask for clarification
Simplicity FirstStrategy pattern for single functionOne function until complexity needed
Surgical ChangesReformats quotes while fixing bugOnly change lines that fix the issue
Goal-Driven"I'll review and improve""Write test → fix → verify"

Key Insight

From Karpathy:

"LLMs are exceptionally good at looping until they meet specific goals... Don't tell it what to do, give it success criteria and watch it go."

Good code solves today's problem simply, not tomorrow's problem prematurely.


How to Know It's Working

These guidelines are working if you see:

  • Fewer unnecessary changes in diffs — Only requested changes appear
  • Fewer rewrites due to overcomplication — Code is simple the first time
  • Clarifying questions come before implementation — Not after mistakes
  • Clean, minimal PRs — No drive-by refactoring or "improvements"

Full Examples

See references/EXAMPLES.md for detailed before/after examples of each principle.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Karpathy Guidelines AI skill do?

Behavioral guidelines to reduce common LLM coding mistakes. Derived from Andrej Karpathy's observations. Use ALWAYS when writing, reviewing, or refactoring code. Covers assumption surfacing, simplicity, surgical edits, and goal-driven execution with verification.

Why use Karpathy Guidelines on TypingMind?

Because you install it once and use it with any model. Karpathy Guidelines is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Karpathy Guidelines in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/interfluve-wav/andrej-karpathy-skills-hermes/tree/main/Karpathy-Hermes-Skill. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Karpathy Guidelines?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Karpathy Guidelines?

As many as you like. As long as a model supports skills, you can use Karpathy Guidelines with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Karpathy Guidelines AI skill free?

Yes. It is published on GitHub by interfluve-wav under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇