LangChain
Builds and debugs LangChain apps in Python: LCEL chains, agents, tools, retrievers, streaming, and structured output. Use when writing or reviewing a chain…
от clawic★ 23 звезды на GitHub
Установить LangChain в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
User preferences and memory live in ~/Clawic/data/langchain/ (see setup.md on first use, memory-template.md for the file format). If you have data at an old location (~/langchain/ or ~/clawic/langchain/), move it to ~/Clawic/data/langchain/, and say in one line that you moved it and from where.
When To Use
- Writing or reviewing LCEL chains, agents, tools, prompt templates, retrievers, or LangGraph graphs
- Debugging a running app: empty streams, silent parser failures, agents that loop, history that vanishes, traces that never appear
- Choosing the abstraction: plain model call vs chain vs prebuilt agent vs hand-built graph
- Hardening for production: retries, rate limits, timeouts, caching, concurrency, cost ceilings, secret hygiene in traces
- Upgrading across versions: moved imports,
langchain-classic, deprecated memory classes, pydantic v1→v2 - Not for framework-agnostic agent architecture (
agents), retrieval strategy (rag), chunk-size tuning (rag-chunking), or provider API reference — this covers how all of those land in LangChain code
Quick Reference
| Situation | Play |
|---|---|
Input to ChatPromptTemplate is missing variables |
Name mismatch or a literal { in the template — double it to {{ → debug.md |
| A key I need later disappears mid-chain, or I am composing branches, fallbacks, or a configurable model | RunnablePassthrough.assign keeps what RunnablePassthrough() replaces; RunnableBranch, .with_fallbacks, configurable_fields → lcel.md |
| Building a prompt with few-shot examples, history, or partials | Templates, placeholders, and example selectors → prompts.md |
| Chain returns nothing useful and you cannot see why | chain.get_graph().print_ascii() for shape, then astream_events(version="v2") for the actual step I/O → debug.md |
| Streaming arrives as one blob at the end | A non-transform step buffers the stream; find the least streamable link → streaming.md |
astream_events empty inside a custom function |
Async config not propagated (Python ≤3.10 threads config by hand) → streaming.md |
Agent never stops / GraphRecursionError |
recursion_limit reached (Core Rule 5); bound the loop and handle the failure branch → agent-loop.md |
| Model ignores a tool, or calls the wrong one | The tool description is the whole prompt the model sees for it → tools.md |
| Provider 400: assistant tool_calls not followed by tool messages | History trimming split an AIMessage from its ToolMessage → chat-history.md |
| History resets on restart | InMemorySaver dies with the process; move to Sqlite/Postgres checkpointer → chat-history.md |
with_structured_output returns None or raises |
Use include_raw=True and read parsing_error before blaming the model → structured-output.md |
| Retrieval returns plausible-but-wrong chunks | Check k, splitter settings, and whether the score is distance or similarity → retrieval.md |
| Re-ingesting documents duplicates the index | Deterministic ids or the record-manager indexing API, not a second add_documents → retrieval.md |
ImportError after upgrading |
Moved to a partner package or langchain-classic → migration.md |
| 429s, cost spikes, or a hung request | Rate limiter, timeouts, caching, and concurrency caps → production.md |
| Traces empty or tokens unaccounted | Tracing env vars, usage_metadata, request-time vs constructor callbacks → observability.md |
| Tests hit the real API, or are flaky | Deterministic fake models and cached fixtures → testing.md |
| Untrusted documents reach the model, a tool can spend money or delete, or users share an index | Injection defense, approval gates, tenant isolation, trace privacy → security.md |
| Need branching, cycles, human approval, or shared state | The prebuilt agent loop is the wrong shape — build a graph → langgraph.md |
| Provider-specific parameter or multimodal input | init_chat_model, standard content blocks, per-provider differences → models.md |
| Anything else | Reproduce with the smallest runnable that fails (prompt | model alone), then add one link at a time until it breaks |
Depth on demand: lcel.md composition · prompts.md templates and few-shot · streaming.md tokens and events · models.md providers and parameters · chat-history.md sessions and persistence · retrieval.md loaders, splitters, retrievers · tools.md tool definition and errors · agent-loop.md loop control and middleware · langgraph.md custom graphs · structured-output.md schemas and parsers · debug.md symptom→cause · observability.md tracing and token accounting · security.md injection, blast radius, isolation · production.md limits, caching, deployment · testing.md deterministic tests · migration.md version boundaries.
Core Rules
- Every Runnable takes exactly one argument; a bare dict is a
RunnableParalleland a bare function is aRunnableLambda. `{"context": retriever, "
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- _meta.json
- agent-loop.md
- chat-history.md
- debug.md
- langgraph.md
- lcel.md
- memory-template.md
- migration.md
- models.md
- observability.md
- production.md
- prompts.md
- retrieval.md
- security.md
- setup.md
- streaming.md
- structured-output.md
- testing.md
- tools.md
FAQ
Что делает скилл LangChain?
Builds and debugs LangChain apps in Python: LCEL chains, agents, tools, retrievers, streaming, and structured output. Use when writing or reviewing a chain, agent, tool, retriever, or prompt template; when a prompt raises KeyError or "missing variables"; when streaming arrives as one blob or astream_events yields nothing; when an agent loops until GraphRecursionError or repeats a tool; when tool calls fail validation or the provider rejects a tool_call_id; when chat history disappears or the context window overflows; when with_structured_output returns None or a parser crashes on valid JSON; when retrieval returns the wrong chunks; when LangSmith traces are empty; when retries, rate limits, or token cost need bounding; or when imports break after an upgrade. Covers LangGraph state, checkpointers, and middleware. Not for framework-agnostic agent architecture (agents), retrieval design (rag), or chunk tuning (rag-chunking).
Как установить скилл LangChain?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл LangChain запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
AnthropicGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
academy-guide
AnthropicStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
internal-comms
AnthropicA set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
skill-development
AnthropicThis skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…