Skip to main content
langchain-development LangChain JS/TS framework for building LLM-powered apps. Use when working with chat models, prompt templates, LCEL chains, tool binding, or RAG pipelines.
Aller à l'installation Skills Marketplace Découvrez et explorez les compétences IA créées par la communauté.
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Copier le promptAfficher les détails du prompt Une commande directe contourne le prompt de vérification. Examinez la source avant de l'exécuter.
npx skills add https://github.com/laurigates/claude-plugins --skill langchain-developmentLa commande reste sur une seule ligne. Faites défiler horizontalement pour la vérifier avant de la copier.
Vous préférez une copie locale ? Téléchargez les fichiers actuellement disponibles dans SkillsMP.
Télécharger Zip Téléchargement... Plus depuis ce dépôt Install, configure and troubleshoot MCP servers. Use when adding/enabling servers, editing .mcp.json, fixing OAuth, or when a server runs stale code after an upstream fix.
FinOps snapshot — org billing, workflow stats, cache usage. Use when you want a high-level view of CI spending or workflow health before diving deeper.
GitHub Actions billing, workflow efficiency, and waste analysis at org or repo level. Use when investigating CI/CD costs, wasted runs, or optimizing triggers.
Métiers associés SOC
Basé sur la classification professionnelle SOC
name langchain-development description LangChain JS/TS framework for building LLM-powered apps. Use when working with chat models, prompt templates, LCEL chains, tool binding, or RAG pipelines. user-invocable false allowed-tools Bash(python *), Bash(uv *), BashOutput, Read, Write, Edit, Grep, Glob, TodoWrite created "2026-01-08T00:00:00.000Z" modified "2026-04-25T00:00:00.000Z" reviewed "2026-04-25T00:00:00.000Z"
LangChain Development
When to Use This Skill
Use this skill when... Use a sibling skill instead when... Building LCEL chains (prompt → model → parser) or RAG pipelines
You need stateful graph workflows — use langgraph-agents
Working with chat models, prompt templates, or tool binding You need hierarchical multi-agent orchestration — use deep-agents
Adding LangChain to an existing TypeScript project You are scaffolding a brand-new project — use langchain-init (/langchain:init)
Implementing document loaders and vector stores You only need a one-off SDK call without LangChain — use the provider SDK directly
Core Expertise LangChain JS/TS is a framework for building LLM applications:
Unified interface across model providers (OpenAI, Anthropic, Google, etc.)
Composable chains and agents
Built-in tool integration
RAG (Retrieval-Augmented Generation) support
LangSmith observability integration
Installation
Package Manager Setup
npm install langchain
pnpm add langchain
bun add langchain
npm install @langchain/openai
npm install @langchain/anthropic
npm install @langchain/google-genai
npm install @langchain/community
npm install @langchain/textsplitters
TypeScript Configuration {
"compilerOptions" : {
"target" : "ES2020" ,
"module" : "NodeNext" ,
"moduleResolution" : "NodeNext" ,
"esModuleInterop" : true ,
"strict" : true
}
}
Chat Models
Basic Usage import { ChatOpenAI } from "@langchain/openai" ;
import { ChatAnthropic } from "@langchain/anthropic" ;
import { HumanMessage , SystemMessage } from "@langchain/core/messages" ;
const openai = new ChatOpenAI ({
model : "gpt-4o" ,
temperature : 0 ,
});
const anthropic = new ChatAnthropic ({
model : "claude-haiku" ,
temperature : 0 ,
});
const response = await openai.invoke ([
new SystemMessage ("You are a helpful assistant." ),
new HumanMessage ("Hello!" ),
]);
Streaming const stream = await openai.stream ([new HumanMessage ("Tell me a story" )]);
for await (const chunk of stream) {
process.stdout .write (chunk.content as string );
}
Structured Output import { z } from "zod" ;
const schema = z.object ({
name : z.string ().describe ("The name" ),
age : z.number ().describe ("The age" ),
});
const structuredLlm = openai.withStructuredOutput (schema);
const result = await structuredLlm.invoke ("John is 30 years old" );
Prompt Templates
Basic Templates import { ChatPromptTemplate } from "@langchain/core/prompts" ;
const prompt = ChatPromptTemplate .fromMessages ([
["system" , "You are a {role}." ],
["human" , "{input}" ],
]);
const formatted = await prompt.invoke ({
role : "helpful assistant" ,
input : "Hello!" ,
});
Few-Shot Prompts import { FewShotChatMessagePromptTemplate } from "@langchain/core/prompts" ;
const examples = [
{ input : "2+2" , output : "4" },
{ input : "3+3" , output : "6" },
];
const fewShotPrompt = new FewShotChatMessagePromptTemplate ({
examplePrompt : ChatPromptTemplate .fromMessages ([
["human" , "{input}" ],
["ai" , "{output}" ],
]),
examples,
inputVariables : ["input" ],
});
Chains (LCEL)
Basic Chain import { ChatOpenAI } from "@langchain/openai" ;
import { ChatPromptTemplate } from "@langchain/core/prompts" ;
import { StringOutputParser } from "@langchain/core/output_parsers" ;
const prompt = ChatPromptTemplate .fromTemplate ("Tell me a joke about {topic}" );
const model = new ChatOpenAI ();
const parser = new StringOutputParser ();
const chain = prompt.pipe (model).pipe (parser);
const result = await chain.invoke ({ topic : "programming" });
Parallel Chains import { RunnableParallel } from "@langchain/core/runnables" ;
const parallel = RunnableParallel .from ({
joke : jokeChain,
poem : poemChain,
});
const results = await parallel.invoke ({ topic : "cats" });
Branching import { RunnableBranch } from "@langchain/core/runnables" ;
const branch = RunnableBranch .from ([
[(x ) => x.type === "math" , mathChain],
[(x ) => x.type === "code" , codeChain],
defaultChain,
]);
Tools
Defining Tools import { tool } from "@langchain/core/tools" ;
import { z } from "zod" ;
const calculatorTool = tool (
async ({ a, b, operation }) => {
switch (operation) {
case "add" :
return String (a + b);
case "subtract" :
return String (a - b);
case "multiply" :
return String (a * b);
case "divide" :
return String (a / b);
}
},
{
name : "calculator" ,
description : "Performs basic arithmetic" ,
schema : z.object ({
a : z.number (),
b : z.number (),
operation : z.enum (["add" , "subtract" , "multiply" , "divide" ]),
}),
},
);
Tool Binding const modelWithTools = model.bindTools ([calculatorTool]);
const response = await modelWithTools.invoke ("What is 25 * 4?" );
if (response.tool_calls ?.length ) {
const toolCall = response.tool_calls [0 ];
const result = await calculatorTool.invoke (toolCall.args );
}
RAG (Retrieval-Augmented Generation)
Document Loading import { TextLoader } from "langchain/document_loaders/fs/text" ;
import { PDFLoader } from "@langchain/community/document_loaders/fs/pdf" ;
import { RecursiveCharacterTextSplitter } from "@langchain/textsplitters" ;
const loader = new TextLoader ("./data/document.txt" );
const docs = await loader.load ();
const splitter = new RecursiveCharacterTextSplitter ({
chunkSize : 1000 ,
chunkOverlap : 200 ,
});
const splitDocs = await splitter.splitDocuments (docs);
Vector Store import { MemoryVectorStore } from "langchain/vectorstores/memory" ;
import { OpenAIEmbeddings } from "@langchain/openai" ;
const embeddings = new OpenAIEmbeddings ();
const vectorStore = await MemoryVectorStore .fromDocuments (
splitDocs,
embeddings,
);
const results = await vectorStore.similaritySearch ("query" , 4 );
RAG Chain import { createRetrievalChain } from "langchain/chains/retrieval" ;
import { createStuffDocumentsChain } from "langchain/chains/combine_documents" ;
const retriever = vectorStore.asRetriever ({ k : 4 });
const combineDocsChain = await createStuffDocumentsChain ({
llm : model,
prompt : ChatPromptTemplate .fromTemplate (`
Answer based on this context:
{context}
Question: {input}
` ),
});
const ragChain = await createRetrievalChain ({
retriever,
combineDocsChain,
});
const response = await ragChain.invoke ({
input : "What is the document about?" ,
});
Agents (ReAct)
Basic Agent import { createReactAgent } from "@langchain/langgraph/prebuilt" ;
const agent = createReactAgent ({
llm : model,
tools : [calculatorTool, searchTool],
});
const result = await agent.invoke ({
messages : [{ role : "user" , content : "Calculate 25 * 4" }],
});
Agentic Optimizations Context Command/Pattern Quick test npx tsx --test src/**/*.test.tsType check npx tsc --noEmitDebug traces Set LANGCHAIN_TRACING_V2=true Reduce tokens Use StringOutputParser for text-only Stream output Use .stream() instead of .invoke() Batch requests Use .batch([inputs]) for parallel Cache responses Use InMemoryCache for repeated calls
Quick Reference
Environment Variables Variable Description OPENAI_API_KEYOpenAI API key ANTHROPIC_API_KEYAnthropic API key LANGCHAIN_TRACING_V2Enable LangSmith tracing LANGCHAIN_API_KEYLangSmith API key LANGCHAIN_PROJECTLangSmith project name
Common Imports Import Package ChatOpenAI@langchain/openaiChatAnthropic@langchain/anthropicChatPromptTemplate@langchain/core/promptsStringOutputParser@langchain/core/output_parserstool@langchain/core/toolsRunnableSequence@langchain/core/runnables
Key Packages Package Purpose langchainCore framework @langchain/coreBase abstractions @langchain/openaiOpenAI integration @langchain/anthropicAnthropic integration @langchain/communityCommunity integrations @langchain/langgraphGraph-based agents