# langchain

Hands Claude runnable patterns for LangChain and LangGraph: LCEL pipes, retrieval over Chroma, tool-using agent graphs, typed output and per-session memory.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf (Devin Desktop), Claude.ai · ★ 301 repo stars
- Author: hoodini
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/hoodini/ai-agents-skills/tree/HEAD/skills/langchain/SKILL.md
- Updated: 2026-10-23
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/langchain

## What it does

The skill gives Claude short code samples for LLM apps. It walks through LCEL pipes, a retrieval chain backed by Chroma, a LangGraph state machine with tool nodes and conditional edges, output shaped by a pydantic model, chat history keyed by session, and token streaming. A resources list at the end points to the LangChain, LangGraph and LangSmith docs.

Install with `npx skills add hoodini/ai-agents-skills --skill langchain -a claude-code`, and the file lands at `~/.claude/skills/langchain/SKILL.md`. Python packages come separately: `pip install langchain langchain-openai langchain-anthropic langgraph`.

LangSmith tracing needs `LANGCHAIN_TRACING_V2`, `LANGCHAIN_API_KEY` and `LANGCHAIN_PROJECT` set in the environment; no key means nothing gets reported. Two spots in the samples age badly: the model is pinned to `claude-3-sonnet-20240229`, and structured output imports from `langchain_core.pydantic_v1` instead of `pydantic`. Check that import against the version you run.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add hoodini/ai-agents-skills --skill langchain -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/langchain/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/langchain/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add hoodini/ai-agents-skills --skill langchain -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/langchain/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add hoodini/ai-agents-skills --skill langchain -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/langchain/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install hoodini/ai-agents-skills skills/langchain
```

2. **Manually: put the files in place**
- File: `.github/skills/langchain/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add hoodini/ai-agents-skills --skill langchain -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/hoodini/ai-agents-skills --path skills/langchain
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/langchain/SKILL.md` — The legacy .windsurf/skills/ path still works

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/hoodini/ai-agents-skills/tree/HEAD/skills/langchain/SKILL.md

## When to use it
- wire a retrieval chain over Chroma with a retriever
- model an agent as a LangGraph state machine with tools
- get typed fields back from a model using a pydantic schema
- keep chat history per `session_id`
- trace chain runs in LangSmith

## Example prompts
- Build a LangChain RAG chain over Chroma that answers only from the retrieved context
- Turn this into a LangGraph agent with `search` and `calculator` tools and a stop condition
- Switch this call to streaming with `astream` and turn on LangSmith tracing

## Similar
- [langchain-development](https://affpapa.org/en/nevibecode/skills/langchain-development.md) — skill · 726 installs
- [langchain-fundamentals](https://affpapa.org/en/nevibecode/skills/langchain-fundamentals.md) — skill · 18500 installs
- [langchain-dependencies](https://affpapa.org/en/nevibecode/skills/langchain-dependencies.md) — skill · 17000 installs
- [migrating-langchain-to-pydantic-ai](https://affpapa.org/en/nevibecode/skills/migrating-langchain-to-pydantic-ai.md) — skill · 476 installs
- [langchain-webhooks-events](https://affpapa.org/en/nevibecode/skills/langchain-webhooks-events.md) — skill · 4 installs
- [langchain-architecture](https://affpapa.org/en/nevibecode/skills/langchain-architecture.md) — skill · 13150 installs

From the same set: [hoodini/ai-agents-skills](https://affpapa.org/en/nevibecode/by/hoodini/ai-agents-skills.md) — 34 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
