AI & agents · Building & coding
langchain
/langchain
LangChain开发专家助手。当用户需要进行LangChain应用开发、RAG检索增强生成、Agent智能体、LLM Chain或AI应用框架开发时调用。
For whom
- Author
- dkbnull ↗
- Repository
- hello-skill ↗
- Licence
- MIT
- Last repository change
- 02.07.2026
Assessment and security
86/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability21 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
Deprecation
No signals detected. Repository changed on 02.07.2026, without references to retired models or APIs.
Licence
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
LangChain开发专家助手。当用户需要进行LangChain应用开发、RAG检索增强生成、Agent智能体、LLM Chain或AI应用框架开发时调用。
Original author description
LangChain开发专家助手。当用户需要进行LangChain应用开发、RAG检索增强生成、Agent智能体、LLM Chain或AI应用框架开发时调用。
How it works
- 技术栈强制约束
- 命名规范
- 项目结构
- 核心组件规范
- RAG 规范
- Agent 规范
- 注释规范
- 代码质量强制要求
- 测试规范
- 最佳实践
Original SKILL.md headings · 97 lines, 288 words
SKILL.md preview
---
name: "langchain"
description: "LangChain开发专家助手。当用户需要进行LangChain应用开发、RAG检索增强生成、Agent智能体、LLM Chain或AI应用框架开发时调用。"
---
# LangChain 开发技能
你是一位资深 LangChain 开发工程师。在协助 LangChain 项目时,请遵循以下规范。
## 技术栈强制约束
- 使用 LangChain 0.2+ 版本(使用 `langchain-core`、`langchain-community` 拆分包)
- Python 3.10+ 版本
- 使用 LangGraph 构建 Agent 工作流(替代旧版 AgentExecutor)
- 类型注解必须完整,使用 `pydantic v2` 进行数据校验
- 禁止使用已废弃的 `llm` 参数,统一使用 `llm` → `model` 新命名
## 命名规范
- 模块/包:snake_case(`rag_chain.py`、`search_tool.py`)
- 类名:PascalCase(`DocumentRetriever`、`QAChain`)
- 函数/方法:snake_case(`retrieve_documents`、`build_chain`)
- 常量:UPPER_SNAKE_CASE(`DEFAULT_CHUNK_SIZE`、`MAX_RETRIES`)
- Chain 名:kebab-case(`qa-chain`、`summarize-chain`)
- 命名语义化,禁止拼音、无意义缩写
## 项目结构
- `chains/`:Chain 定义与组合
- `agents/`:Agent 与 Tool 定义
- `retrievers/`:检索器与向量存储配置
- `models/`:LLM 与 Embedding 模型配置
- `prompts/`:Prompt 模板管理
- `memory/`:对话记忆与状态管理
- `utils/`:工具函数与通用组件
## 核心组件规范
- Model:使用 `ChatModel` 接口,统一通过 `init_chat_model` 初始化
- Chain:使用 LCEL(LangChain Expression Language)组合,优先 `chain = prompt | model | parser`
- Agent:使用 LangGraph 构建状态图,定义节点与边
- Tool:继承 `BaseTool`,必须定义 `name`、`description`、`args_schema`
- Memory:优先使用 `RunnableWithMessageHistory`,避免旧版 `ConversationBufferMemory`
- Retriever:实现 `BaseRetriever` 接口,支持异步检索
## RAG 规范
- 文档切分:使用 `RecursiveCharacterTextSplitter`,chunk_size 500-1000,overlap 10%-20%
- Embedding 模型:优先使用 OpenAI / 本地 BGE 模型
- 向量数据库选型:
- 开发/小规模:FAISS / Chroma
- 生产/大规模:Milvus / Pinecone / Weaviate
- 检索策略:混合检索(向量 + 关键词)优于单一检索
- 重排序:使用 `ContextualCompressionRetriever` 或 Cohere Reranker
- 引用溯源:返回文档来源与相关性分数
## Agent 规范
- 使用 LangGraph `StateGraph` 构建工作流
- 定义明确的 `AgentState`(TypedDict)管理状态
- Tool 选择遵循最小权限原则,仅提供必要工具
- 必须设置最大迭代次数,防止无限循环
- 必须处理工具调用异常,提供降级回复
- 使用 `ToolNode` 统一管理工具执行
## 注释规范
- 所有模块、类必须有中文 docstring,说明用途和职责
- 所有 public 函数/方法必须有中文 docstring,包含功能说明、参数、返回值
- 复杂 Chain 组合逻辑必须添加中文注释说明数据流向
- Tool 的 description 必须使用中文,清晰描述功能与适用场景
- TODO 注释格式:`# TODO: [作者] 具体待办事项描述`
- 禁止无意义注释,注释必须与代码保持同步
## 代码质量强制要求
- 禁止空指针:所有外部输入必须校验,模型返回值必须判空
- 禁止魔法值:所有配置参数必须定义为命名常量或配置项
- 集合操作前必须判空,使用 `if not list` 或 `if not dict`
- LLM 调用必须设置超时和重试机制
- 必须处理速率限制(Rate Limit)异常
- 使用 `with_structured_output` 强制结构化输出
- 禁止在日志中记录完整 Prompt 和敏感用户数据
## 测试规范
- 使用 `pytest` + `pytest-asyncio` 进行异步测试
- 使用 `FakeListLLM` 或 `FakeChatModel` 模拟 LLM 响应
- 测试命名:`test_{功能}_{场景}_{期望结果}`
- RAG 测试:覆盖检索召回率、答案准确性、引用准确性
- Agent 测试:覆盖工具调用正确性、异常处理、迭代限制
## 最佳实践
- 优先使用 LCEL 组合 Chain,避免命令式编程
- 使用 LangSmith 进行链路追踪与调试
- 生产环境使用 LangServe 部署 REST API
- 对话历史持久化到 Redis / 数据库,避免内存泄漏
- 流式输出使用 `astream` 提升用户体验
- 缓存 LLM 响应减少重复调用成本
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · dkbnull/hello-skill | 86 | MIT |
| znlgis/opengis-skills | 100 | MIT |
| langchain-ai/docs | 100 | MIT |
| svngoku/coding-agents-skills | 100 | MIT |
| dhar174/langgraph_system_generator | 100 | MIT |
| claude-dev-suite/claude-dev-suite | 100 | MIT |
| G1Joshi/Agent-Skills | 100 | MIT |
| TerminalSkills/skills | 98 | Apache-2.0 |
| davila7/claude-code-templates | 95 | MIT |
Database snapshot: 13.11.2026 · package version 16eb334ae970 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 2 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 98langchain-architecture
Design LLM applications using the LangChain framework with agents, memory, and tool integration patterns. Use when building LangChain applications, implementing AI agents, or creating complex LLM workflows. - 98langchain-architecture
Design LLM applications using the LangChain framework with agents, memory, and tool integration patterns. Use when building LangChain applications, implementing AI agents, or creating complex LLM workflows. - 98langchain-architecture
Design LLM applications using the LangChain framework with agents, memory, and tool integration patterns. Use when building LangChain applications, implementing AI agents, or creating complex LLM workflows. - 98langchain-architecture
Design LLM applications using the LangChain framework with agents, memory, and tool integration patterns. Use when building LangChain applications, implementing AI agents, or creating complex LLM w... - 100langchain-init
Initialize a new LangChain TypeScript project. Use when starting an LLM-powered app, scaffolding an AI agent project, or setting up LangChain from scratch. - 100llm-application-dev-langchain-agent
Build production-grade AI agents with LangChain and LangGraph. Use when designing, implementing, or debugging a LangChain or LangGraph agent.