karpathy-system-prompt-learning
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "karpathy-system-prompt-learning":https://skillpi.com/zh/skills/deepskill-19accd6753af991fe04312c37baa6083bd918368ca37f91f6aff84ccccd9b863。安装前核对上游来源和版本:https://github.com/LearnPrompt/andrej-karpathy-skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
将明确的策略写入系统提示,作为学习机制:通过“提示即教科书”的方法,把策略或工作流程编码进系统提示,以提高大语言模型在特定任务上的可预测性与可教性。适用于希望改进模型或智能体表现、需要在提示中固定策略或寻求一致行为的场景;基于 Karpathy 关于系统提示学习的观点。
介绍来源: third_party · LearnPrompt · 0.0.1 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 适合谁
- 来源文档未说明。
- 输入和输出
- 来源文档未说明。
- 软件、账号及付费要求
- 来源文档未说明。
- 限制与区别
- 来源文档未说明。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: karpathy-system-prompt-learning
description: 'Write explicit strategy into system prompts as a learning mechanism — making LLM behavior more predictable and teachable through prompt-as-textbook approach. Use this skill when the user wants to improve an agent or LLM''s performance on a specific task through system prompts, needs to encode a strategy or workflow into a prompt, wants consistent LLM behavior, or says "improve system prompt", "encode this strategy", "prompt engineering", "make agent follow this workflow", "prompt as textbook". Based on Karpathy system prompt learning post.'
disable-model-invocation: false
user-invocable: true
related_skills:
- karpathy-understanding-first
- karpathy-llm-simulator
- karpathy-agentic-engineering
- karpathy-practice-environmentsSkill 13: System Prompt Learning(系统提示学习范式)
Source: https://x.com/karpathy/status/1921368644069765486 "System prompt learning — missing LLM learning paradigm"
Core Principle
The system prompt is a textbook. Write it like one.
Karpathy's insight: there are three learning modes for LLMs (pretrain, finetune, RL) — but there's a fourth that's massively underused: system prompt learning. Explicitly encoding strategy into the system prompt is more sample-efficient than retraining and more reliable than hoping the model figures it out.
Think of it as writing a textbook for the LLM before each task. Not just instructions — strategy with reasoning.
The System Prompt Learning Framework
Good system prompts have three layers (mirroring how humans learn):
Layer 1: EXPOSITION (pretrain equivalent)
→ Background knowledge the model needs
→ Relevant concepts, terminology, context
→ "Here's what you need to know about [domain]"
Layer 2: WORKED EXAMPLES (SFT equivalent)
→ Step-by-step demonstration of correct behavior
→ Explicit reasoning traces
→ "Here's exactly how to handle [situation]"
Layer 3: STRATEGY (RL equivalent)
→ Explicit decision rules
→ Error patterns to avoid
→ "When you see X, do Y because Z"
Building a System Prompt from Scratch
Build a system prompt that teaches an LLM to [TASK] reliably.
Task description: [WHAT THE LLM SHOULD DO]
Current failure mode: [HOW IT CURRENTLY GOES WRONG]
Desired behavior: [EXACTLY WHAT GOOD LOOKS LIKE]
Structure the system prompt with all three learning layers:
Layer 1 — Exposition:
Write 2-3 paragraphs of background knowledge the LLM needs.
Include: key concepts, relevant context, domain vocabulary.
Layer 2 — Worked Examples:
Write 2 complete examples of the task done correctly.
Format: INPUT → [step-by-step reasoning] → OUTPUT
Show the thinking, not just the answer.
Layer 3 — Strategy:
Write explicit decision rules as IF/THEN/BECAUSE statements.
Include: common mistakes to avoid, edge cases to handle, quality checks.
End with: "Before responding, verify: [checklist of 3-5 quality checks]"
Improving an Existing System Prompt
When your current system prompt isn't working well:
Diagnose and improve this system prompt.
Current system prompt:
[PASTE CURRENT PROMPT]
Failure mode I'm seeing:
[DESCRIBE HOW IT'S GOING WRONG]
Example of bad output:
[PASTE BAD EXAMPLE]
Example of good output:
[PASTE GOOD EXAMPLE]
Analysis:
1. What's missing from the exposition layer? (background knowledge gaps)
2. What worked examples should I add?
3. What explicit rules would prevent this failure mode?
4. Is the prompt too restrictive? Too vague? Wrong framing?
Output: improved version of the system prompt with changes annotated.
Strategy Encoding Templates
For coding tasks
SYSTEM PROMPT: [CODING TASK]
You are an expert [LANGUAGE] developer. Follow this exact strategy:
UNDERSTANDING PHASE (always do this first):
- Restate the task in your own words
- List all edge cases you can think of
- Identify the one tricky part
IMPLEMENTATION PHASE:
- Start with the simplest working version
- Add complexity only when simple version fails
- Comment every non-obvious line with WHY
VERIFICATION PHASE (always do this last):
- Trace through your code with one concrete example
- Check: does it handle empty input? Large input? Wrong type?
- Confirm: could a junior dev maintain this?
NEVER:
- Assume the input is well-formed without checking
- Add dependencies without saying why
- Write clever code when simple code works
For analysis tasks
SYSTEM PROMPT: [ANALYSIS TASK]
You are an analytical expert. Follow this strategy:
GROUNDING:
- Always cite specific evidence before making claims
- Confidence levels: CERTAIN / LIKELY / SPECULATIVE — always label which
- If you don't know something, say so explicitly
STRUCTURE:
- Lead with the conclusion, then the evidence
- One claim per paragraph
- Maximum 3 levels of nesting
QUALITY CHECKS before responding:
- [ ] Every claim has evidence?
- [ ] Confidence levels labeled?
- [ ] Would an expert in this field agree with this framing?
- [ ] Am I answering the actual question or a related easier one?
For creative/writing tasks
SYSTEM PROMPT: [WRITING TASK]
Writing strategy for this task:
VOICE:
[Describe the tone, style, what to avoid]
STRUCTURE:
[Describe the expected output format]
QUALITY STANDARD:
A response is good when [describe what success looks like].
A response is bad when [describe common failure modes].
EXAMPLE OF GOOD OUTPUT:
[Paste one example]
EXAMPLE OF BAD OUTPUT (and why):
[Paste one example with annotation]
Prompt Version Control
Track your system prompt iterations like code:
# [PROMPT NAME] — Version History
## v3 (current) — [DATE]
Change: Added explicit "verification phase" checklist
Reason: v2 was skipping edge case checking
Result: Failure rate dropped from ~30% to ~5%
## v2 — [DATE]
Change: Added worked examples section
Reason: v1 was too abstract; model wasn't following the strategy
Result: Moderate improvement
## v1 — [DATE]
Initial version: [PASTE]
The Meta-Prompt (write prompts with an LLM)
Help me write a system prompt for this agent.
Agent task: [WHAT IT SHOULD DO]
I'll be using this with: [CLAUDE / GPT-4 / etc.]
Critical behavior: [WHAT MUST ALWAYS HAPPEN]
Failure modes to prevent: [WHAT GOES WRONG WITHOUT GOOD PROMPTING]
Apply the three-layer system prompt learning framework:
1. Exposition (what the model needs to know)
2. Worked examples (demonstrate correct behavior)
3. Strategy rules (explicit IF/THEN/BECAUSE)
Then: suggest 3 variations I could test to find the best version.
Workflow
属于工作流:反偏见决策(第3步/终点)
| 位置 | 上游 | 下游 |
|---|---|---|
| 第3步(沉淀) | karpathy-understanding-first(验证后) | 沉淀完成,可复用 |
完整链路:llm-simulator → understanding-first → system-prompt-learning
也在日常开发中独立使用——任何时候 Agent 反复犯同一类错,都应该触发本 Skill。
Prompt Contract
Extract a system prompt lesson from this failure/pattern: <DESCRIBE_THE_RECURRING_ERROR>. Produce: 1) Trigger condition — when does this error occur, 2) Correct strategy — step-by-step what the agent should do instead, 3) Anti-patterns — what specifically to avoid, 4) Worked example — a before/after showing the improvement, 5) Concise instruction block (< 200 words) ready to paste into system prompt or SKILL.md.
Verification Checklist
- [ ] 触发条件描述具体(不是「有时候」)
- [ ] 策略是 step-by-step 的(不是模糊建议)
- [ ] 反模式列出了具体的错误做法
- [ ] 有 before/after 对比示例
- [ ] 指令块 < 200 words,可直接粘贴
- [ ] 在新的测试 case 上验证过指令块有效
当前收录版本
0.0.1
安全与评测信息
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供系统提示学习的完整框架,解决LLM行为可预测性和可教性问题
- 包含多个实用模板和具体示例,适用于编码、分析、创意等多种任务场景
- 基于Karpathy权威观点,具有理论支撑和实践价值
亮点
- 触发词覆盖全面,包括'优化系统提示'、'将策略编码进提示'、'提示工程'等核心关键词
- 边界清晰,明确指出了适用场景和用户需求
亮点
- 结构清晰,包含核心原则、框架、构建方法、改进流程等多个完整章节
- 提供了多个端到端示例和模板,便于用户理解和应用
- frontmatter完整,包含相关技能链接
亮点
- 提供了系统化的构建和改进流程,覆盖主要异常情况
- 包含验证清单和版本控制建议,确保执行质量
- 策略编码模板具体明确,可直接应用
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
文档引用的域名或地址
这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。
- x.com
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
来源文档未说明。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。