Karpathy Guidelinesのロゴ

Karpathy Guidelines

コミュニティ
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.

概要

公開者interfluve-wav
リポジトリandrej-karpathy-skills-hermes
スキル名karpathy-guidelines
スター
29
フォーク
4
同梱ファイル
1
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 1個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    interfluve-wavがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Karpathy Guidelines」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/interfluve-wav/andrej-karpathy-skills-hermes/tree/main/Karpathy-Hermes-Skill
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

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
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでKarpathy Guidelinesを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にKarpathy Guidelinesを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Karpathy Guidelinesは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

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.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「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.

TypingMindでKarpathy Guidelinesを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Karpathy Guidelinesはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにKarpathy Guidelinesをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/interfluve-wav/andrej-karpathy-skills-hermes/tree/main/Karpathy-Hermes-Skillを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Karpathy Guidelinesを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Karpathy Guidelinesで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもKarpathy Guidelinesを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Karpathy Guidelines」は無料ですか?

はい。interfluve-wavがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇