Langchain logo

Langchain

Community
dkbnull
langchain

LangChain开发专家助手。当用户需要进行LangChain应用开发、RAG检索增强生成、Agent智能体、LLM Chain或AI应用框架开发时调用。

Overview

Publisherdkbnull
Repositoryhello-skill
Skill namelangchain
Stars
39
Forks
6
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by dkbnull on GitHub. Read the source before you install it.

Installation

Install the Langchain AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/dkbnull/hello-skill/tree/main/ai/skills/langchain
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/dkbnull/hello-skill.git /tmp/hello-skill
mkdir -p .claude/skills
cp -r /tmp/hello-skill/ai/skills/langchain .claude/skills/langchain
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Langchain in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Langchain on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Langchain is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

LangChain 开发技能

你是一位资深 LangChain 开发工程师。在协助 LangChain 项目时,请遵循以下规范。

技术栈强制约束

  • 使用 LangChain 0.2+ 版本(使用 langchain-core、langchain-community 拆分包)
  • Python 3.10+ 版本
  • 使用 LangGraph 构建 Agent 工作流(替代旧版 AgentExecutor)
  • 类型注解必须完整,使用 pydantic v2 进行数据校验
  • 禁止使用已废弃的 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 响应减少重复调用成本

Frequently asked questions

What does the Langchain AI skill do?

LangChain开发专家助手。当用户需要进行LangChain应用开发、RAG检索增强生成、Agent智能体、LLM Chain或AI应用框架开发时调用。

Why use Langchain on TypingMind?

Because you install it once and use it with any model. Langchain is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Langchain in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/dkbnull/hello-skill/tree/main/ai/skills/langchain. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Langchain?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Langchain?

As many as you like. As long as a model supports skills, you can use Langchain with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Langchain AI skill free?

Yes. It is published on GitHub by dkbnull under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇