Automated summary
This skill provides study notes on the LangChain framework, covering core components, middleware, advanced usage, multi-agent patterns, and integrations, allowing quick lookup of concepts, code examples, and best practices.
Strengths
- Clear structure and easy navigation by topic
- Broad coverage of key subjects (agents, RAG, memory, etc.)
- Directly usable code examples
- Built-in best practice advice
Limitations
- Notes may be tied to a specific LangChain version
- Primarily Python-focused, limited for other languages
- May lack depth for very advanced cases
Use this skill when you need a quick reference to implement agents, RAG, multi-agent patterns, or any LangChain feature.
Do not use it if you are looking for in-depth theoretical training or working with a framework other than LangChain.
Security analysis
SafeThe skill only uses Read, Grep, and Glob tools to search and display learning notes. It contains no destructive commands, no external data exfiltration, and no obfuscated payloads. The examples are educational and do not instruct execution of dangerous operations.
No concerns found
How this analysis is madeExamples
How do I create a LangChain agent with custom tools?Show me how to implement Retrieval-Augmented Generation (RAG) using LangChain.Explain the different multi-agent patterns in LangChain, like supervisor and handoff.name: langchain-notes description: LangChain 框架学习笔记 - 快速查找概念、代码示例和最佳实践。包含 Core components、Middleware、Advanced usage、Multi-agent patterns、RAG retrieval、Long-term memory 等主题。当用户询问 LangChain、Agent、RAG、向量存储、工具使用、记忆系统时使用此 Skill。 allowed-tools:
- Read
- Grep
- Glob
LangChain 学习笔记 Skill
快速访问 LangChain 框架的学习资料、代码示例和最佳实践。
快速导航
核心组件 (Core Components)
- 01-models.md - 模型使用 (Chat、Completion、Streaming)
- 02-messages.md - 消息类型 (Human、AI、System、Tool、Custom)
- 03-tools.md - 工具定义和使用
- 04-memory.md - 短期记忆管理
- [05-structured-output.md - 结构化输出
- 06-streaming.md - 流式输出
- 07-agents.md - Agent 基础
中间件 (Middleware)
- 01-built-in.md - 内置中间件
- 02-custom.md - 自定义中间件
高级用法 (Advanced Usage)
- 01-guardrails.md - 输出验证和安全
- 02-runtime.md - 运行时配置
- 03-context-engineering.md - 提示工程
- 04-mcp.md - MCP 协议
- 05-human-in-the-loop.md - 人机协作
- 06-retrieval.md - RAG 检索增强生成
- 07-long-term-memory.md - 长期记忆存储
Multi-agent 模式
- 01-subagents.md - Supervisor 模式
- 02-handoffs.md - Handoff 模式
- 03-skills.md - Skills 模式
- 04-router.md - Router 模式
- 05-custom-workflow.md - 自定义工作流
集成笔记 (Integrations Notes)
- chroma.md - Chroma 向量数据库集成
使用指南
查找概念
使用 Grep 工具搜索特定概念:
# 搜索关键词
grep -r "关键词" langchain_notes/
# 示例:搜索 RAG 相关内容
grep -r "RAG\|retrieval\|向量存储" langchain_notes/
查找代码示例
笔记中包含大量可运行的代码示例,按以下格式组织:
- 概述 → 核心概念
- 基础实现 → 简单示例
- 完整实现 → 生产就绪代码
- 最佳实践 → 推荐做法
风格规范
所有笔记遵循以下风格:
- 简洁优先 - 避免冗余,突出重点
- 结构清晰 - 层级分明,易于查找
- 代码优先 - 用代码说明概念
- 格式统一 - 使用表格、列表、加粗
常见任务
创建 Agent
参考:07-agents.md
from langchain.agents import create_agent
from langchain.tools import tool
@tool
def my_tool(input: str) -> str:
"""工具描述."""
return f"处理: {input}"
agent = create_agent(
model="claude-sonnet-4-5-20250929",
tools=[my_tool],
system_prompt="你是一个有用的助手"
)
实现 RAG
2-Step RAG (简单快速):
@dynamic_prompt
def prompt_with_context(request: ModelRequest) -> str:
last_query = request.state["messages"][-1].text
docs = vector_store.similarity_search(last_query)
return f"Context: {docs}"
Agentic RAG (灵活):
@tool
def retrieve_context(query: str):
"""检索信息."""
return vector_store.similarity_search(query)
Multi-agent 模式
参考:multi-agent/
| 模式 | 适用场景 | 文件 | |-----|---------|------| | Supervisor | 中央协调多个子 Agent | 01-subagents.md | | Handoff | Agent 间协作转移 | 02-handoffs.md | | Skills | 专业化能力按需加载 | 03-skills.md | | Router | 分类路由到专门 Agent | 04-router.md | | Custom Workflow | 完全自定义执行流程 | 05-custom-workflow.md |
记忆管理
读取长期记忆:
@tool
def get_user_info(runtime: ToolRuntime[Context]) -> str:
store = runtime.store
user_id = runtime.context.user_id
return store.get(("users",), user_id)
写入长期记忆:
store.put(("users",), user_id, {"name": "John"})
搜索技巧
按主题搜索
# RAG 相关
grep -r "RAG\|检索\|向量存储\|similarity_search" langchain_notes/
# Agent 相关
grep -r "Agent\|create_agent\|tool" langchain_notes/
# Multi-agent 相关
grep -r "Supervisor\|Handoff\|Router\|Orchestrator" langchain_notes/
# 记忆相关
grep -r "memory\|store\|checkpointer" langchain_notes/
按文件类型搜索
# 查找所有 Markdown 文件
find langchain_notes/ -name "*.md"
# 查找特定目录
ls langchain_notes/core-components/
ls langchain_notes/advanced-usage/
参考资料位置
- 笔记根目录:
langchain_notes/ - 集成笔记:
integrations_notes/ - 官方文档:
oss_python_docs/ - 示例代码: 每个笔记文件中的代码块
官方文档结构
当笔记中找不到相关内容时,从 oss_python_docs/ 中查找官方文档。
一级目录结构
oss_python_docs/
├── langchain/ # LangChain 核心文档
├── langgraph/ # LangGraph 工作流文档
├── integrations/ # 第三方集成文档
│ ├── vectorstores/ # 向量存储集成 (Chroma, FAISS, Pinecone 等)
│ ├── retrievers/ # 检索器集成
│ └── ...
└── ...
搜索官方文档
# 搜索集成文档
grep -r "chroma\|faiss\|pinecone" oss_python_docs/integrations/vectorstores/
# 搜索核心概念
grep -r "agent\|retrieval\|memory" oss_python_docs/langchain/
# 查找特定文件
find oss_python_docs/ -name "*.md" | grep -i "rag"
注意: 官方文档为英文原始文档,用于深入查阅。笔记是提取的精华内容。
注意事项
-
环境配置:
conda activate ai_tools -
代码优先: 所有示例都包含完整可运行的代码
-
中英混合: 概念和描述使用中文,代码和 API 使用英文
-
状态标记: 每个笔记底部标记完成状态
获取帮助
当用户询问以下问题时使用此 Skill:
- "LangChain 如何实现 X?"
- "Agent/RAG/向量存储怎么用?"
- "有什么最佳实践?"
- "给我看代码示例"
- "Multi-agent 模式有哪些?"
搜索笔记目录找到相关文件,提取关键信息和代码示例。
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/langchain-learning-notes-mrx3xwzr/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/langchain-learning-notes-mrx3xwzr' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/langchain-learning-notes-mrx3xwzr/download' --output '.skill-downloads/langchain-learning-notes-mrx3xwzr/SKILL.md.part' && mv '.skill-downloads/langchain-learning-notes-mrx3xwzr/SKILL.md.part' '.skill-downloads/langchain-learning-notes-mrx3xwzr/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/langchain-learning-notes-mrx3xwzr/SKILL.md' && test -s '.skill-downloads/langchain-learning-notes-mrx3xwzr/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/langchain-notes' && cp -R '.skill-downloads/langchain-learning-notes-mrx3xwzr' '.claude/skills/langchain-notes'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/langchain-learning-notes-mrx3xwzr'openskills read 'langchain-learning-notes-mrx3xwzr'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/langchain-learning-notes-mrx3xwzr/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.