Audits project dependencies for supply chain risks, detects compromised packages, and hardens requirements files. Based on Karpathy's approach to the litellm attack.
Ships in karpathy-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Source: https://x.com/karpathy/status/2036487306585268612 "Software horror: litellm PyPI supply chain attack" — ~28k likes
Every dependency is a door you didn't build, maintained by someone you don't know.
The litellm incident Karpathy flagged: a widely-used LLM library got compromised via its transitive dependencies. If your project pulled litellm, you were exposed — and you probably didn't even know litellm was in your stack until it was too late.
Karpathy's response: minimize deps, prefer simple implementations, audit everything.
Run this for any project before deployment or after any dependency update:
Perform a full supply chain security audit for this project.
Dependency file contents:
[PASTE requirements.txt / package.json / Gemfile / go.mod]
For each direct dependency, analyze:
1. Maintainer health: single maintainer? Last commit? GitHub stars?
2. Transitive depth: how many packages does it pull in?
3. Install-time code execution: does it run arbitrary code on install?
4. Network calls on import: does importing trigger outbound connections?
5. Version pinning: are we using exact versions or ranges?
Risk assessment per package:
- HIGH RISK: (list criteria)
- MEDIUM RISK: (list criteria)
- LOW RISK: (list criteria)
Priority actions: [what to fix first]
Before adding any new package:
Security pre-check for: [PACKAGE NAME] v[VERSION]
1. PyPI/npm stats: weekly downloads? Known? Established?
2. GitHub: https://github.com/[owner/repo] — stars, last commit, open issues?
3. Transitive deps: run `pip show [package]` or `npm ls [package]` — how deep does it go?
4. setup.py / postinstall: does it run code on install?
5. Import-time behavior: what does `import [package]` actually do?
Risk verdict: SAFE / VERIFY_FURTHER / AVOID
Alternative: if risky, what can I use instead or implement myself?
Transform a loose requirements file to a pinned, audited one:
Harden this requirements.txt / package.json for production security.
Current file:
[PASTE FILE]
Output a new version that:
1. Pins all packages to exact versions (== not ~=)
2. Adds a comment for each package: what it's used for, why we need it
3. Flags any packages that could be eliminated with minimal effort
4. Groups by category: core / dev / testing
5. Adds a header comment with: last audited date, total dep count, audit command to run
Also: what command should I run to check for known vulnerabilities?
For each feature you're about to add via a package:
I'm about to add [PACKAGE] to solve [PROBLEM].
Before I do: help me evaluate if I should implement this myself instead.
The function I need: [SPECIFIC FUNCTION/CAPABILITY]
Can this be implemented with:
- Python stdlib only (in < 50 lines)? YES/NO
- One simple function I can paste inline? YES/NO
If yes to either: write the minimal implementation I need.
If no: confirm the package is the right choice and suggest the safest way to import it.
For any project that pulls external dependencies:
# Dockerfile template — minimal, audited, isolated
FROM python:3.11-slim # pin exact base image
# Create non-root user
RUN useradd -m -u 1000 appuser
WORKDIR /app
# Copy ONLY requirements first (layer caching)
COPY requirements.txt .
# Install with hash verification
RUN pip install --no-cache-dir --require-hashes -r requirements.txt
# Copy application code
COPY --chown=appuser:appuser . .
USER appuser
CMD ["python", "app.py"]
# requirements.txt with hashes (generate with pip-compile --generate-hashes)
requests==2.31.0 \
--hash=sha256:58cd2187423839823... \
--hash=sha256:942c5a758f98d79...
If you discover a supply chain compromise:
IMMEDIATE (within 1 hour):
- [ ] Identify: which version of which package is compromised?
- [ ] Check: is this version in our requirements.txt / lock file?
- [ ] Check: is this version installed in any running service?
- [ ] Isolate: take affected services offline if credentials could be exposed
SHORT-TERM (within 24 hours):
- [ ] Rotate: any credentials, tokens, API keys that ran in the affected environment
- [ ] Audit: what data could have been accessed/exfiltrated?
- [ ] Update: pin to a safe version or remove the package
- [ ] Scan: check all other packages for similar issues
LONG-TERM:
- [ ] Add automated scanning (pip-audit, npm audit, Dependabot)
- [ ] Implement hash pinning for critical projects
- [ ] Consider: can we eliminate this dependency entirely?
# Python
pip-audit # check for known vulns
pip freeze | pip-audit --stdin # audit installed packages
safety check # alternative scanner
# Node.js
npm audit
npm audit fix # auto-fix where safe
# Check transitive deps
pip show [package] # see direct deps
pip-tree [package] # see full tree
# Generate hashed requirements
pip-compile --generate-hashes requirements.in
属于工作流:想法到上线(第4步)
| 位置 | 上游 | 下游 |
|---|---|---|
| 第4步(安全检查) | karpathy-minimalism(瘦身后) | karpathy-vibe-to-agentic(最终收尾) |
完整链路:idea-files → agentic-engineering → minimalism → supply-chain-hygiene → vibe-to-agentic
Audit this dependency before I install it: <PACKAGE_NAME> v<VERSION>. Produce: 1) Transitive dependency count and tree, 2) Maintainer activity (last commit, bus factor), 3) Known CVEs or security advisories, 4) Any postinstall hooks or network calls on import, 5) Safer minimal alternative (or "implement yourself in N lines"), 6) Pinned install command if approved. Risk score: LOW/MEDIUM/HIGH. Recommendation: USE/AVOID/IMPLEMENT_YOURSELF.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/karpathy-skills:karpathy-supply-chain-hygienefrom karpathy-skills
npx claudepluginhub learnprompt/andrej-karpathy-skills --plugin karpathy-skills15 skills in this plugin
/karpathy-agentic-engineeringApply Karpathy-style agentic engineering to any coding or building task. Use this skill when the user wants to set up an agent-driven workflow, needs to write a CLAUDE.md or AGENTS.md, wants to orchestrate agents with clear success criteria, or says things like "agent loop", "let the agent handle it", "agentic coding", "set up agent workflow". Includes the 7-step inner loop from Karpathy claude coding notes./karpathy-autoresearchSet up an autonomous research loop where an agent iterates on experiments, hypotheses, and code on git branches. Use this skill when the user wants to automate ML experiments, set up a research agent that self-improves, needs to run many variations of an experiment without manual intervention, or says "automate experiments", "agent research loop", "self-improving agent", "run hyperparameter search", "autoresearch". Based on Karpathy 28k-like AutoResearch post./karpathy-education-firstApply the education-first mindset — make everything you build teachable, create nano-project explanations, write for beginners. Use this skill when the user wants to explain a project to beginners, create a tutorial from code, write documentation that teaches (not just documents), make a concept accessible, or says "make this teachable", "explain like im a beginner", "nano project version", "teaching version", "explain from scratch", "blog post about this". Based on Karpathy 243-line GPT and Eureka Labs posts./karpathy-idea-filesCreate and share ideas as abstract Gist-style specs instead of code — letting agents or others implement. Use this skill when the user wants to capture a new idea quickly, needs to write a project spec for an agent to implement, wants to share a concept without building it first, or says "write up this idea", "create a spec", "gist this", "idea file", "agent can implement this", "brief for this project". Based on Karpathy 27k-like LLM Wiki Gist post and GitHub repo./karpathy-llm-simulatorUse LLM as a simulator of expert debates and opposing viewpoints instead of getting a single sycophantic answer. Use this skill when the user needs to make an important decision, wants to stress-test an idea, needs devil's advocate analysis, wants to avoid confirmation bias, or says "argue against this", "what are the counterarguments", "simulate experts", "debate this", "challenge my thinking". Based on Karpathy 31k-like post./karpathy-llm-wikiBuild and maintain an LLM-powered personal knowledge base or wiki. Use this skill when the user wants to organize research notes, build a second brain, set up an Obsidian vault with LLM compilation, ingest papers or articles automatically, or mentions "personal knowledge base", "LLM wiki", "second brain", "knowledge management", "ingest papers", "obsidian + LLM". Based on Karpathy Gist and 59k-like post.Other plugins' skills for the same job