Andrej Karpathy Skills
Behavioral guidelines to reduce common LLM coding mistakes. Use when writing, reviewing, or refactoring code to avoid overcomplication, make surgical changes... Skill: Andrej Karpathy Skills Owner: sg345662365-oss Summary: Behavioral guidelines to reduce common LLM coding mistakes. Use when writing, reviewing, or refactoring code to avoid overcomplication, make surgical changes... Tags: latest:1.0.0 Version history: v1.0.0 | 2026-06-08T05:53:11.421Z | auto - Initial release of Karpathy Guidelines for coding with LLMs. - Outlines behavioral principles to avoid common mistakes
Rank
62
Safety
84
Downloads
1.2k
Updated
Oct 11, 2026
Version
1.0.0
Source
CLAWHUB
About
What it does, and when to use it.
Capability contract not published. No trust telemetry is available yet. 1.2K downloads reported by the source. Last updated 10/11/2026.
Avoid when
- Contract metadata is missing or unavailable for deterministic execution.
Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing
Public facts
Every fact links back to the source it came from.
- Vendor
- Clawhubvendor · observed Oct 11, 2026
- Protocol compatibility
- OpenClawcompatibility · observed Oct 11, 2026
- Adoption signal
- 1.2K downloadsadoption · observed Oct 11, 2026
- Latest release
- 1.0.0release · observed Jun 8, 2026
- Handshake status
- UNKNOWNsecurity
Install and run
Setup complexity: low.
clawhub skill install s1767amm59pfp2m38fw70nts75886f6v:andrej-karpathy-skills- Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
- Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.
Contract: missing
curl -s "https://www.xpersona.co/api/v1/agents/clawhub-sg345662365-oss-andrej-karpathy-skills/snapshot"
Documentation
CLAWHUB
60,051 characters of source documentation, loaded on request.
Extracted files
5 files captured from the source.
SKILL.md
---
name: karpathy-guidelines
description: Behavioral guidelines to reduce common LLM coding mistakes. Use when writing, reviewing, or refactoring code to avoid overcomplication, make surgical changes, surface assumptions, and define verifiable success criteria.
---
# Karpathy Guidelines
Behavioral guidelines to reduce common LLM coding mistakes, derived from [Andrej Karpathy's observations](https://x.com/karpathy/status/2015883857489522876) on LLM coding pitfalls.
**Tradeoff:** These guidelines bias toward caution over speed. For trivial tasks, use judgment.
## 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.
Ask yourself: "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.README.md
# Karpathy-Inspired Agent Skills Karpathy-inspired coding-agent guidelines packaged for Claude Code, Codex, Cursor, Gemini CLI, OpenCode, Aider, GitHub Copilot, OpenClaw, Warp, Windsurf, Cline, and the wider SwarmVault/SwarmClaw agent matrix. The canonical source is [`skills/karpathy-guidelines/SKILL.md`](skills/karpathy-guidelines/SKILL.md). Agent-specific files are generated under [`adapters/`](adapters/) so the repository root stays readable while every supported tool receives the same behavioral guidance. English | [Simplified Chinese](./README.zh.md) ## What This Adds These guidelines address four common LLM coding failure modes described by Andrej Karpathy: | Principle | Prevents | | --- | --- | | Think Before Coding | Silent assumptions, hidden confusion, missing tradeoffs | | Simplicity First | Over-engineering, bloated abstractions, speculative features | | Surgical Changes | Drive-by rewrites, unrelated cleanup, accidental behavior changes | | Goal-Driven Execution | Vague completion criteria and unverified changes | The content is intentionally short. It is meant to merge with project-specific instructions, not replace them. ## Quick Install Install through npm and run the installer with `npx`: ```bash npx @swarmclawai/andrej-karpathy-skills --list npx @swarmclawai/andrej-karpathy-skills --agent codex --dest /path/to/project ``` Or install the CLI globally: ```bash npm install -g @swarmclawai/andrej-karpathy-skills andrej-karpathy-skills --agent cursor --dest /path/to/project ``` The CLI copies the right adapter from the npm package into the destination project. ## Clone Install Clone once, then copy the right adapter into any project. The installer reads [`install/targets.json`](install/targets.json), copies from `adapters/<agent-id>/...`, and writes to the real path your agent expects. ```bash git clone https://github.com/swarmclawai/andrej-karpathy-skills.git cd andrej-karpathy-skills node scripts/install.mjs --list node scripts/install.mjs --agent codex --dest /path/to/project ``` Use `--force` if you intentionally want to overwrite an existing instruction file: ```bash node scripts/install.mjs --agent claude --dest /path/to/project --force node scripts/install.mjs --agent openclaw --dest /path/to/project --force ``` Use `--global` for agents with supported user-level skill locations: ```bash node scripts/install.mjs --agent claude --global --force node scripts/install.mjs --agent hermes --global --force ``` ## Adapter Layout If you only need one file, copy the adapter source to the install target shown below: | Agent | Adapter source | Installs to | | --- | --- | | Codex | `adapters/codex/AGENTS.md` | `AGENTS.md` | | Claude Code | `adapters/claude/CLAUDE.md` | `CLAUDE.md` | | Cursor | `adapters/cursor/.cursor/rules/karpathy-guidelines.mdc` | `.cursor/rules/karpathy-guidelines.mdc` | | Gemini CLI | `adapters/gemini/GEMINI.md` | `GEMINI.m
_meta.json
{
"ownerId": "kn795jyrb7x5a08fmcczzxpwy1886a3m",
"slug": "andrej-karpathy-skills",
"version": "1.0.0",
"publishedAt": 1780897991421
}CURSOR.md
# Using These Guidelines With Cursor Cursor reads project rules from `.cursor/rules/`. This repository keeps the generated Cursor adapter under [`adapters/cursor/.cursor/rules/karpathy-guidelines.mdc`](adapters/cursor/.cursor/rules/karpathy-guidelines.mdc) so the repo root stays clean. Install it into another project with: ```bash node scripts/install.mjs --agent cursor --dest /path/to/project ``` That command copies the adapter to `.cursor/rules/karpathy-guidelines.mdc` in the destination project. The Cursor rule is generated from [`skills/karpathy-guidelines/SKILL.md`](skills/karpathy-guidelines/SKILL.md); edit the canonical skill and run `npm run generate` instead of editing the adapter directly.
EXAMPLES.md
# Examples
Real-world code examples demonstrating the four principles. Each example shows what LLMs commonly do wrong and how to fix it.
---
## 1. Think Before Coding
### Example 1: Hidden Assumptions
**User Request:** "Add a feature to export user data"
**❌ What LLMs Do (Wrong Assumptions)**
```python
def export_users(format='json'):
"""Export all users to a file."""
users = User.query.all()
if format == 'json':
with open('users.json', 'w') as f:
json.dump([u.to_dict() for u in users], f)
elif format == 'csv':
with open('users.csv', 'w') as f:
writer = csv.DictWriter(f, fieldnames=['id', 'email', 'name'])
writer.writeheader()
writer.writerows([u.to_dict() for u in users])
return f"Exported {len(users)} users"
```
**Problems:**
- Assumed it should export ALL users (what about pagination? privacy?)
- Assumed file location without asking
- Assumed which fields to include
- Assumed CSV fieldnames without checking actual data structure
**✅ What Should Happen (Surface Assumptions)**
```
Before implementing, I need to clarify:
1. **Scope**: Export all users or filtered subset? (privacy implications)
2. **Format**: You mentioned "export" - did you mean:
- Download file in browser?
- Background job with email notification?
- API endpoint returning data?
3. **Fields**: Which user fields? (some might be sensitive)
4. **Volume**: How many users typically? (affects approach)
Simplest approach: Add an API endpoint that returns paginated JSON.
Would need more info for file-based exports.
What's your preference?
```
### Example 2: Multiple Interpretations
**User Request:** "Make the search faster"
**❌ What LLMs Do (Pick Silently)**
```python
# Adds caching, database indexes, and async processing
# without asking which "faster" matters
@lru_cache(maxsize=1000)
async def search(query: str) -> List[Result]:
# ... 200 lines of optimization code
```
**✅ What Should Happen**
```
"Make the search faster" could mean:
1. **Faster response time** (< 100ms instead of 500ms)
- Add database indexes
- Cache frequent queries
- Estimated effort: 2 hours
2. **Handle more concurrent searches** (throughput)
- Add async/await
- Connection pooling
- Estimated effort: 4 hours
3. **Faster perceived speed** (UX)
- Show partial results immediately
- Progressive loading
- Estimated effort: 3 hours
Current search takes ~500ms for typical queries.
Which aspect matters most for your use case?
```
---
## 2. Simplicity First
### Example 1: Over-abstraction
**User Request:** "Add a function to calculate discount"
**❌ What LLMs Do (Overengineered)**
```python
from abc import ABC, abstractmethod
from enum import Enum
from typing import Protocol, Union
from dataclasses import dataclass
class DiscountStrategy(ABC):
@abstrAionUi
Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!
activepieces
AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
cherry-studio
AI productivity studio with smart chat, autonomous agents, and 300+ assistants.
CopilotKit
The Frontend for Agents & Generative UI. React + Angular
Machine-readable data
The same record, as JSON, for agents and crawlers.
{
"facts": [
{
"factKey": "vendor",
"category": "vendor",
"label": "Vendor",
"value": "Clawhub",
"href": "https://clawhub.ai/sg345662365-oss/skills/andrej-karpathy-skills",
"sourceUrl": "https://clawhub.ai/sg345662365-oss/skills/andrej-karpathy-skills",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-11T03:05:57.847Z",
"isPublic": true
},
{
"factKey": "protocols",
"category": "compatibility",
"label": "Protocol compatibility",
"value": "OpenClaw",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-sg345662365-oss-andrej-karpathy-skills/contract",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-sg345662365-oss-andrej-karpathy-skills/contract",
"sourceType": "contract",
"confidence": "medium",
"observedAt": "2026-10-11T03:05:57.847Z",
"isPublic": true
},
{
"factKey": "traction",
"category": "adoption",
"label": "Adoption signal",
"value": "1.2K downloads",
"href": "https://clawhub.ai/sg345662365-oss/andrej-karpathy-skills",
"sourceUrl": "https://clawhub.ai/sg345662365-oss/andrej-karpathy-skills",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-11T03:05:57.847Z",
"isPublic": true
},
{
"factKey": "latest_release",
"category": "release",
"label": "Latest release",
"value": "1.0.0",
"href": "https://clawhub.ai/sg345662365-oss/andrej-karpathy-skills",
"sourceUrl": "https://clawhub.ai/sg345662365-oss/andrej-karpathy-skills",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-06-08T05:53:11.421Z",
"isPublic": true
},
{
"factKey": "handshake_status",
"category": "security",
"label": "Handshake status",
"value": "UNKNOWN",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-sg345662365-oss-andrej-karpathy-skills/trust",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-sg345662365-oss-andrej-karpathy-skills/trust",
"sourceType": "trust",
"confidence": "medium",
"observedAt": null,
"isPublic": true
}
],
"events": [
{
"eventType": "release",
"title": "Release 1.0.0",
"description": "- Initial release of Karpathy Guidelines for coding with LLMs. - Outlines behavioral principles to avoid common mistakes: think before coding, prioritize simplicity, make surgical code changes, and define clear success criteria. - Emphasizes surfacing assumptions, reducing overcomplication, and verifying changes against explicit goals. - Includes practical rules for editing existing code without unnecessary refactoring or feature creep.",
"href": "https://clawhub.ai/sg345662365-oss/andrej-karpathy-skills",
"sourceUrl": "https://clawhub.ai/sg345662365-oss/andrej-karpathy-skills",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-06-08T05:53:11.421Z",
"isPublic": true
}
]
}Record generated Oct 11, 2026.
