langchain-sdk-patterns
Apply production-ready LangChain SDK patterns for chains, agents, and memory. Use when implementing LangChain integrations, refactoring code, or establishing team coding standards for LangChain applications. Trigger with phrases like "langchain SDK patterns", "langchain best practices", "langchain code patterns", "idiomatic langchain", "langchain architecture".
npx skills add majiayu000/claude-skill-registry --skill langchain-sdk-patterns-brmbobo-web2podcast --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# LangChain SDK Patterns ## Overview Production-ready patterns for LangChain applications including LCEL chains, structured output, and error handling. ## Prerequisites - Completed `langchain-install-auth` setup - Familiarity with async/await patterns - Understanding of error handling best practices ## Core Patterns ### Pattern 1: Type-Safe Chain with Pydantic ```python from pydantic import BaseModel, Field from langchain_openai import ChatOpenAI from langchain_core.prompts import ChatPromptTemplate class SentimentResult(BaseModel): """Structured output for sentiment analysis.""" sentiment: str = Field(description="positive, negative, or neutral") confidence: float = Field(description="Confidence score 0-1") reasoning: str = Field(description="Brief explanation") llm = ChatOpenAI(model="gpt-4o-mini") structured_llm = llm.with_structured_output(SentimentResult) prompt = ChatPromptTemplate.from_template( "Analyze the sentiment of: {text}" ) chain = prompt | structured_llm # Returns typed SentimentResult result: SentimentResult = chain.invoke({"text": "I love LangChain!"}) print(f"Sentiment: {result.sentiment} ({result.confidence})") ``` ### Pattern 2: Retry with Fallback ```python fr
- Overview
- Prerequisites
- Core Patterns
- Pattern 1: Type-Safe Chain with Pydantic
- Pattern 2: Retry with Fallback
- Pattern 3: Async Batch Processing
- Pattern 4: Streaming with Callbacks
- Pattern 5: Caching for Cost Reduction
- Output
- Error Handling
- Standard Error Pattern
- Resources
- Next Steps
What does the langchain-sdk-patterns skill do?
Apply production-ready LangChain SDK patterns for chains, agents, and memory. Use when implementing LangChain integrations, refactoring code, or establishing team coding standards for LangChain applications. Trigger with phrases like "langchain SDK patterns", "langchain best practices", "langchain code patterns", "idiomatic langchain", "langchain architecture".
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill langchain-sdk-patterns-brmbobo-web2podcast --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
