karpathy-practice-environments

karpathy-practice-environments is a skill for Claude Code from LearnPrompt/andrej-karpathy-skills. It costs 110 tokens per session (2,122 once invoked), scanned A, original, MIT.

A method for building practice environments where AI agents can attempt tasks, receive automatic feedback, and try again. Like a student’s workbook, it combines explanations, solved examples, and exercises with checkable answers.

In plain words
What is it for?
Use it to create sandboxes for testing agents, evaluation systems for comparing results, and practice exercises for teaching an agent a specific skill.
Why use it?
It addresses the problem of judging an agent from one-off outputs without giving it a way to learn from mistakes. Automatic scoring makes progress easier to measure.

Skill for Claude Code

Written for Claude Code: disable-model-invocation in frontmatter.

Part of the karpathy-skills plugin — 15 skills shipped together

Good fit Use it to create sandboxes for testing agents, evaluation systems for comparing results, and practice exercises for teaching an agent a specific skill.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/learnprompt/andrej-karpathy-skills/karpathy-practice-environments
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 LearnPrompt/andrej-karpathy-skills --skill karpathy-practice-environments
Clone the repo
git clone --depth 1 https://github.com/LearnPrompt/andrej-karpathy-skills

Made for: Claude Code.

Or install karpathy-skills, the plugin that ships this one along with the rest of its 15 skills.

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-practice-environments

README.md
[![agentmods](https://agentmods.dev/badge/skills/learnprompt/andrej-karpathy-skills/karpathy-practice-environments/github.svg)](https://agentmods.dev/skills/learnprompt/andrej-karpathy-skills/karpathy-practice-environments)
Your own site
<a href="https://agentmods.dev/skills/learnprompt/andrej-karpathy-skills/karpathy-practice-environments"><img src="https://agentmods.dev/badge/skills/learnprompt/andrej-karpathy-skills/karpathy-practice-environments/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-practice-environments

Your own site · 80×15
<a href="https://agentmods.dev/skills/learnprompt/andrej-karpathy-skills/karpathy-practice-environments"><img src="https://agentmods.dev/badge/skills/learnprompt/andrej-karpathy-skills/karpathy-practice-environments.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 110 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,122 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00110 $0.02122
Opus 5 $0.00055 $0.01061
Sonnet 5 $0.00022 $0.00424
Haiku 4.5 $0.00011 $0.00212

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

Security

Grade A, and why

karpathy-practice-environments 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.

karpathy-practice-environments/SKILL.md · 267 lines

How it starts

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

Skill 14: LLM Textbook + Practice Environments(LLM教科书 + 练习环境)

Source: https://x.com/karpathy/status/1885026028428681698 | https://x.com/karpathy/status/1960803117689397543 "Take LLMs to school" | "Environments for RL" posts

Core Principle

LLMs learn like students. Give them textbooks, worked problems, and practice gyms.

Karpathy's insight: the missing ingredient in LLM training isn't more parameters — it's practice environments where agents can try → fail → see feedback → try again. Like a student who reads theory but also needs problem sets.

Apply this to your agents: build environments where they can practice a skill with automatic scoring, not just generate output into the void.

The Three Training Data Types

Every good learning environment needs all three:

1. EXPOSITION (pretrain equivalent)
   → Background knowledge, concepts, context
   → The "textbook chapter" the agent reads before practicing
   
2. WORKED EXAMPLES (SFT equivalent)
   → Complete input-output pairs with reasoning shown
   → "Here's a solved problem — learn the pattern"
   
3. PRACTICE PROBLEMS with feedback (RL equivalent)
   → Problems with verifiable correct answers
   → Automatic scoring so agent knows how it did
   → Enough variety that memorization doesn't work

Building a Practice Gym (General Template)

For any skill you want an agent to get better at:

#!/usr/bin/env python3
"""
Practice Gym for: [SKILL_NAME]
Karpathy-style RL environment for agent skill development
"""

import json
import random
from typing import Callable

class PracticeGym:
    """
    A practice environment where an agent can repeatedly attempt
    a task and receive automatic feedback.
    """
    
    def __init__(self, task_generator: Callable, scorer: Callable):
        self.task_generator = task_generator  # generates new practice problems
        self.scorer = scorer                   # returns 0.0-1.0 score for an attempt
        self.history = []
    
    def sample_task(self):
        """Generate a new practice problem."""
        return self.task_generator()
    
    def evaluate(self, task, attempt):
        """Score an agent's attempt. Returns dict with score + feedback."""
        score = self.scorer(task, attempt)
        result = {
            "task": task,
            "attempt": attempt,
            "score": score,
            "passed": score >= 0.8,
        }
        self.history.append(result)
        return result
    
    def summary(self):
        """Summarize performance across all attempts."""
        if not self.history:
            return "No attempts yet."
        scores = [r["score"] for r in self.history]
        return {
            "total_attempts": len(scores),
            "avg_score": sum(scores) / len(scores),
            "pass_rate": sum(1 for s in scores if s >= 0.8) / len(scores),
            "recent_trend": "improving" if scores[-1] > scores[0] else "declining"
        }

Read the full file on GitHub · 267 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 · 267 lines · 110 tokens per session scan A 87752c40657c

Subscribe to this mod's changes

karpathy-practice-environments is a skill published in the GitHub repository LearnPrompt/andrej-karpathy-skills (97 stars, last pushed 2mo ago), licensed MIT. It adds 110 tokens to every session and 2,122 once invoked, about $0.0006 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.

Related

Other skills, from other repositories

hr-onboarding

A new-hire onboarding plan as a single page — first week schedule, buddy + manager intro, learning track, equipment checklist, and "you're set when…" outcomes. Use when the brief mentions "onboarding", "new hire", "first week plan", or "入职".

nexu-io/open-design · 62 tokens

book-mirror

Take any book (EPUB/PDF), produce a personalized chapter-by-chapter analysis. Each chapter is preserved in detail (The Chapter) and mirrored back to the reader's actual life (The Mirror) using brain context. The mirror observes and resonates — a friend pointing out parallels, NOT a consultant rearranging the reader's…

garrytan/gbrain · 138 tokens

miniapp

Build a tiny interactive HTML playground only when someone asks to see, play with, or step through a mechanism.

yc-software/qm · 25 tokens

eli5

Explain research, papers, or technical ideas in plain English with minimal jargon, concrete analogies, and clear takeaways. Use when the user says "ELI5 this", asks for a simple explanation of a paper or research result, wants jargon removed, or asks what something technically dense actually means.

companion-inc/feynman · 63 tokens

deck-course-module

A course or workshop slide template with persistent learning goals, teaching pages, multiple-choice self-tests, and a wrap-up.

nexu-io/html-anything · 25 tokens

master-yinguang

A reference-based assistant for questions about Yinguang and Pure Land Buddhism, a Buddhist tradition focused on faith, ethical living, and practice connected with rebirth in the Pure Land. It can answer in Yinguang’s historical teaching style.

xr843/Master-skill · 274 tokens