Langchain logo

Langchain

Community
Omar-Obando
langchain

Use when building LLM applications with LangChain, implementing chains, agents, tools, memory, prompts, and retrieval systems. Includes best practices for prompt engineering, tool integration, and agent development. Based on LangChain/LangGraph official documentation and agent development best practices.

Overview

PublisherOmar-Obando
Repositoryqwen-orchestrator
Skill namelangchain
Stars
53
Forks
13
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 Omar-Obando 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/Omar-Obando/qwen-orchestrator/tree/main/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/Omar-Obando/qwen-orchestrator.git /tmp/qwen-orchestrator
mkdir -p .claude/skills
cp -r /tmp/qwen-orchestrator/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 Skill — LLM Applications & Agent Engineering

Overview

This skill provides comprehensive guidance for building LLM applications with LangChain, implementing chains, agents, tools, memory, prompts, and retrieval systems. It includes best practices for prompt engineering, tool integration, and agent development. Based on LangChain/LangGraph official documentation and agent development best practices.

When to Use

Use this skill when:

  • Building LLM applications with LangChain
  • Implementing chains (LLMChain, SequentialChain, RouterChain)
  • Creating agents with tools and capabilities
  • Integrating tools and external APIs (search, calculators, databases)
  • Managing memory (ConversationBufferMemory, VectorStoreRetrieverMemory)
  • Creating prompts and templates (PromptTemplate, FewShotPromptTemplate)
  • Building retrieval-augmented generation (RAG) systems
  • Implementing document loaders and parsers
  • Using embeddings for semantic search
  • Building chat applications with conversation history
  • Implementing output parsers (StructuredOutputParser, JsonOutputParser)
  • Creating prompt engineering patterns (few-shot, chain-of-thought)
  • Building agents with tool calling capabilities
  • Implementing agent memory with vector stores
  • Creating agents with external knowledge sources
  • Building agents with multi-step reasoning
  • Using LangSmith for tracing and monitoring
  • Implementing LangChain expression language (LCEL)
  • Building agents with streaming output
  • Creating agents with context window management

Do NOT use this skill when:

  • Building stateful workflows with complex state (use langgraph skill)
  • Designing database schema (use database-design skill)
  • Creating UI components (use frontend-design skill)
  • Implementing simple LLM calls without chains (use llm-integrations skill)
  • Managing agent teams and coordination (use agent-task-coordinator skill)
  • Building Qwen-specific agents (use qwen-agent skill)
  • Implementing complex graph-based agent architectures (use langgraph skill)

Why avoid: LangChain is powerful but adds overhead. For simple LLM calls or stateful workflows, use more targeted skills.

Core Components

LLM Integration

python
from langchain_openai import ChatOpenAI
from langchain_google_genai import ChatGoogleGenerativeAI

# OpenAI
llm = ChatOpenAI(
    model="gpt-4o",
    temperature=0.7,
    max_tokens=1000
)

# Google Gemini
llm = ChatGoogleGenerativeAI(
    model="gemini-3.1-pro",
    temperature=0.7
)

# Custom provider
llm = ChatOpenAI(
    model="openrouter/meta-llama/llama-3-70b-instruct:free",
    base_url="https://openrouter.ai/api/v1",
    api_key="your-key"
)

Chains

python
from langchain.chains import LLMChain
from langchain.prompts import PromptTemplate

# Simple chain
prompt = PromptTemplate.from_template("What is the capital of {country}?")
chain = LLMChain(llm=llm, prompt=prompt)
result = chain.run("France")

# Sequential chain
from langchain.chains import SequentialChain

chain1 = LLMChain(llm=llm, prompt=prompt1, output_key="capital")
chain2 = LLMChain(llm=llm, prompt=prompt2, output_key="description")

sequential_chain = SequentialChain(
    chains=[chain1, chain2],
    input_variables=["country"],
    output_variables=["capital", "description"]
)

result = sequential_chain.run("France")

Agents

python
from langchain.agents import create_agent
from langchain.memory import InMemorySaver

# Simple agent
agent = create_agent(
    model="openai:gpt-4o",
    tools=[search_tool, calculator_tool],
    system_prompt="You are a helpful assistant.",
    checkpointer=InMemorySaver()
)

result = agent.invoke({"messages": [{"role": "user", "content": "What's the weather in Paris?"}]})

Tools

python
from langchain.tools import Tool
from langchain_community.tools import DuckDuckGoSearchRun

# Built-in tools
search_tool = DuckDuckGoSearchRun()

# Custom tool
def search_database(query: str) -> str:
    """Search the database for relevant information."""
    # Your database search logic
    return "Results"

search_db_tool = Tool(
    name="DatabaseSearch",
    func=search_database,
    description="Search the internal database for information"
)

tools = [search_tool, search_db_tool]

Memory

python
from langchain.memory import (
    ConversationBufferMemory,
    ConversationSummaryMemory,
    VectorStoreRetrieverMemory
)

# Buffer memory
memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True)

# Summary memory
memory = ConversationSummaryMemory(llm=llm, memory_key="chat_history")

# Vector store memory
retriever = vector_store.as_retriever()
memory = VectorStoreRetrieverMemory(retriever=retriever)

Prompts & Templates

Basic Prompt Template

python
from langchain.prompts import PromptTemplate

prompt = PromptTemplate.from_template(
    "Tell me a joke about {topic}. Make it funny."
)

result = llm.invoke(prompt.format(topic="dogs"))

Few-Shot Prompting

python
from langchain.prompts import FewShotPromptTemplate, PromptTemplate

examples = [
    {"input": "Hello", "output": "Hi there!"},
    {"input": "How are you?", "output": "I'm doing great, thanks!"},
]

example_prompt = PromptTemplate(
    input_variables=["input", "output"],
    template="Input: {input}\nOutput: {output}"
)

few_shot_prompt = FewShotPromptTemplate(
    examples=examples,
    example_prompt=example_prompt,
    suffix="Input: {input}\nOutput:",
    input_variables=["input"]
)

result = llm.invoke(few_shot_prompt.format(input="Good morning"))

Chat Prompt Template

python
from langchain.prompts import ChatPromptTemplate

prompt = ChatPromptTemplate.from_messages([
    ("system", "You are a helpful assistant."),
    ("human", "What is the capital of {country}?"),
])

chain = prompt | llm
result = chain.invoke({"country": "France"})

Prompt Engineering Best Practices

python
# ✅ GOOD: Clear instructions
prompt = PromptTemplate.from_template(
    """
    You are a data analyst. Analyze the following data and provide insights.

    Data: {data}

    Provide:
    1. Summary of key trends
    2. Anomalies detected
    3. Recommendations

    Keep your response concise and structured.
    """
)

# ❌ BAD: Vague instructions
prompt = PromptTemplate.from_template(
    "Analyze this data: {data}"
)

Retrieval-Augmented Generation (RAG)

Basic RAG

python
from langchain_community.vectorstores import Chroma
from langchain_openai import OpenAIEmbeddings
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.runnables import RunnablePassthrough

# Create vector store
embeddings = OpenAIEmbeddings()
vectorstore = Chroma.from_documents(
    documents=documents,
    embedding=embeddings
)

# RAG chain
template = """Answer the question based on the context:
Context: {context}
Question: {question}
Answer:"""

prompt = ChatPromptTemplate.from_template(template)

retriever = vectorstore.as_retriever()

def format_docs(docs):
    return "\n\n".join(doc.page_content for doc in docs)

rag_chain = (
    {"context": retriever | format_docs, "question": RunnablePassthrough()}
    | prompt
    | llm
    | StrOutputParser()
)

result = rag_chain.invoke("What is the main topic?")

Advanced RAG

python
from langchain.retrievers import ContextualCompressionRetriever
from langchain.retrievers.document_compressors import LLMChainExtractor

# Compression retriever
compressor = LLMChainExtractor.from_llm(llm)
compression_retriever = ContextualCompressionRetriever(
    base_compressor=compressor,
    base_retriever=vectorstore.as_retriever()
)

# RAG with compression
rag_chain = (
    {"context": compression_retriever | format_docs, "question": RunnablePassthrough()}
    | prompt
    | llm
    | StrOutputParser()
)

Best Practices

1. Use Specific Prompts

python
# ✅ GOOD: Specific instructions
prompt = PromptTemplate.from_template(
    """
    You are a Python expert. Explain the following concept clearly and concisely.
    Provide code examples when relevant.

    Concept: {concept}
    """
)

# ❌ BAD: Vague instructions
prompt = PromptTemplate.from_template("Explain {concept}")

2. Chain Composition

python
# ✅ GOOD: Composable chains
chain1 = LLMChain(llm=llm, prompt=prompt1, output_key="analysis")
chain2 = LLMChain(llm=llm, prompt=prompt2, output_key="summary")

sequential_chain = SequentialChain(
    chains=[chain1, chain2],
    input_variables=["text"],
    output_variables=["analysis", "summary"]
)

# ❌ BAD: Monolithic chain
# All logic in one chain - hard to test and maintain

3. Error Handling

python
# ✅ GOOD: Error handling
try:
    result = chain.run(input_text)
except Exception as e:
    logger.error(f"Error in chain: {e}")
    result = "An error occurred. Please try again."

4. Memory Management

python
# ✅ GOOD: Appropriate memory
# For short conversations
memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True)

# For long conversations
memory = ConversationSummaryMemory(llm=llm, memory_key="chat_history")

# For RAG-based memory
memory = VectorStoreRetrieverMemory(retriever=retriever)

Common Anti-Patterns

❌ Bad: No Prompt Engineering

python
# ❌ BAD: No prompt engineering
prompt = PromptTemplate.from_template("Generate text: {input}")

Problems:

  • Unpredictable outputs
  • No control over tone
  • Poor quality results

✅ Good: With Prompt Engineering

python
# ✅ GOOD: With prompt engineering
prompt = PromptTemplate.from_template(
    """
    You are a professional writer. Generate a blog post about {topic}.

    Requirements:
    - 500-700 words
    - Professional tone
    - Include 3 key points
    - Use bullet points for key points

    Topic: {topic}
    """
)

❌ Bad: No Error Handling

python
# ❌ BAD: No error handling
result = chain.run(input_text)  # Can crash

✅ Good: With Error Handling

python
# ✅ GOOD: With error handling
try:
    result = chain.run(input_text)
except Exception as e:
    logger.error(f"Error in chain: {e}")
    result = "An error occurred. Please try again."

Real-World Impact

Before this skill:

  • Unpredictable LLM outputs
  • No prompt engineering
  • Difficult to maintain chains
  • No memory management

After this skill:

  • Consistent LLM outputs
  • Effective prompt engineering
  • Maintainable chains
  • Proper memory management

Cross-References

  • langgraph - For stateful workflows
  • qwen-agent - For Qwen-specific agents
  • llm-integrations - For LLM provider configuration

References

Frequently asked questions

What does the Langchain AI skill do?

Use when building LLM applications with LangChain, implementing chains, agents, tools, memory, prompts, and retrieval systems. Includes best practices for prompt engineering, tool integration, and agent development. Based on LangChain/LangGraph official documentation and agent development best practices.

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/Omar-Obando/qwen-orchestrator/tree/main/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 Omar-Obando 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 👇