
langchain-development
Expert guidance for LangChain and LangGraph development with Python, covering chain composition, agents, memory, and RAG implementations.
- Installs
- 684
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/mindrally/skills --skill langchain-development- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads langchain-development automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
LangChain Development
You are an expert in LangChain, LangGraph, and building LLM-powered applications with Python.
Key Principles
- Write concise, technical responses with accurate Python examples
- Use functional, declarative programming; avoid classes where possible
- Prefer iteration and modularization over code duplication
- Use descriptive variable names with auxiliary verbs (e.g., is_active, has_context)
- Follow PEP 8 style guidelines strictly
Code Organization
Directory Structure
Organize code into logical modules based on functionality:
project/
├── chains/ # LangChain chain definitions
├── agents/ # Agent configurations and tools
├── tools/ # Custom tool implementations
├── memory/ # Memory and state management
├── prompts/ # Prompt templates and management
├── retrievers/ # RAG and retrieval components
├── callbacks/ # Custom callback handlers
├── utils/ # Utility functions
├── tests/ # Test files
└── config/ # Configuration files
Naming Conventions
- Use snake_case for files, functions, and variables
- Use PascalCase for classes
- Prefix private functions with underscore
- Use descriptive names that indicate purpose (e.g.,
create_retrieval_chain,build_agent_executor)
LangChain Expression Language (LCEL)
Chain Composition
- Use LCEL for composing chains with the pipe operator (
|) - Prefer
RunnableSequenceandRunnableParallelfor complex workflows - Implement proper error handling with
RunnableLambda
from langchain_core.runnables import RunnableParallel, RunnablePassthrough
chain = (
RunnableParallel(
context=retriever,
question=RunnablePassthrough()
)
| prompt
| llm
| output_parser
)
Best Practices
- Always use
invoke()for single inputs,batch()for multiple inputs - Use
stream()for real-time token streaming - Implement
with_config()for runtime configuration - Use
bind()to attach tools or functions to runnables
Agents and Tools
Tool Development
- Define tools using the
@tooldecorator with clear docstrings - Include type hints for all tool parameters
- Implement proper input validation
- Return structured outputs when possible
from langchain_core.tools import tool
from pydantic import BaseModel, Field
class SearchInput(BaseModel):
query: str = Field(description="Search query string")
@tool(args_schema=SearchInput)
def search_database(query: str) -> str:
"""Search the database for relevant information."""
# Implementation
return results
Agent Configuration
- Use
create_react_agentorcreate_tool_calling_agentbased on model capabilities - Implement proper agent executors with max iterations
- Add callbacks for monitoring and debugging
- Use structured chat agents for complex tool interactions
Memory and State Management
Conversation Memory
- Use
ConversationBufferMemoryfor short conversations - Implement
ConversationSummaryMemoryfor long conversations - Consider
ConversationBufferWindowMemoryfor fixed-length history - Use persistent storage backends for production (Redis, PostgreSQL)
LangGraph State
- Define explicit state schemas using TypedDict
- Implement proper state reducers for complex state updates
- Use checkpointing for resumable workflows
- Handle state persistence across sessions
from typing import TypedDict, Annotated
from langgraph.graph import StateGraph
from operator import add
class AgentState(TypedDict):
messages: Annotated[list, add]
context: str
next_step: str
graph = StateGraph(AgentState)
RAG (Retrieval-Augmented Generation)
Document Processing
- Use appropriate text splitters (RecursiveCharacterTextSplitter, MarkdownTextSplitter)
- Implement proper chunk sizing with overlap
- Preserve metadata during splitting
- Use document loaders appropriate for file types
Vector Stores
- Choose vector stores based on scale requirements
- Implement proper embedding caching
- Use hybrid search when available (dense + sparse)
- Configure appropriate similarity metrics
Retrieval Strategies
- Implement multi-query retrieval for complex questions
- Use contextual compression to reduce noise
- Consider parent document retrieval for better context
- Implement re-ranking for improved relevance
LangSmith Integration
Monitoring
- Enable tracing with
LANGCHAIN_TRACING_V2=true - Add run names for easy identification
- Implement custom metadata for filtering
- Use tags for categorization
Debugging
- Review traces for performance bottlenecks
- Analyze token usage patterns
- Monitor latency across chain components
- Set up alerts for error rates
Error Handling
- Implement retry logic with exponential backoff
- Handle rate limits from LLM providers gracefully
- Use fallback chains for critical paths
- Log errors with sufficient context
from langchain_core.runnables import RunnableWithFallbacks
chain_with_fallback = primary_chain.with_fallbacks(
[fallback_chain],
exceptions_to_handle=(RateLimitError, TimeoutError)
)
Performance Optimization
- Use async methods (
ainvoke,abatch) for I/O-bound operations - Implement caching for expensive operations
- Batch requests when possible
- Use streaming for better user experience
Testing
- Write unit tests for individual chain components
- Implement integration tests for full chains
- Use mocking for LLM calls in unit tests
- Test edge cases and error conditions
Dependencies
- langchain
- langchain-core
- langchain-community
- langgraph
- langsmith
- python-dotenv
- pydantic
FAQ
What does the langchain-development skill do?
Expert guidance for LangChain and LangGraph development with Python, covering chain composition, agents, memory, and RAG implementations.
How do I install langchain-development?
Run npx skills add https://github.com/mindrally/skills --skill langchain-development in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/langchain-development/ (personal) or .claude/skills/langchain-development/ (project).
Which AI agents can use langchain-development?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is langchain-development safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains langchain-development?
It is published by mindrally in mindrally/skills. It has 684 recorded installs.
More from mindrally/skills
fastapi-python
mindrally/skills
Expert in FastAPI Python development with best practices for APIs and async operations
nextjs-react-typescript
mindrally/skills
Expert in TypeScript, Node.js, Next.js App Router, React, Shadcn UI, Radix UI and Tailwind
web-scraping
mindrally/skills
Expert in web scraping and data extraction with Python tools
computer-vision-opencv
mindrally/skills
Expert guidance for computer vision development using OpenCV, PyTorch, and modern deep learning techniques for image and video processing.
framer-motion
mindrally/skills
Expert guidelines for building performant animations with Framer Motion/Motion library in React applications
chrome-extension-development
mindrally/skills
Expert guidelines for Chrome extension development with Manifest V3, covering security, performance, and best practices. Use when building browser extensions, creating popup UIs, implementing content scripts, working with Chrome APIs, managing extension permissions, or publishing to Chrome Web Store.
Popular ai & agents skills
google-agents-cli-publish
google/agents-cli
This skill should be used when the user wants to "publish an agent", "publish my ADK agent", "register an agent with Gemini", "publish to Gemini" (formerly Gemini Enterprise), or needs guidance on the agents-cli publish gemini command. Also use when the user wants to "manage agents in Agent Registry", "list/update/delete registered agents", or "register an MCP server". Covers ADK vs A2A registration modes, programmatic and interactive usage, flag reference, auto-detection from deployment metadata, Agent Registry fleet management, and troubleshooting. Part of the agents-cli skills suite. Do NOT use for deployment (use google-agents-cli-deploy).
google-agents-cli-eval
google/agents-cli
This skill should be used when the user wants to "run an evaluation", "evaluate my agent", "evaluate my ADK agent", "write an eval dataset", "analyze eval failures", "compare eval results", "optimize agent", or needs guidance on the Gemini platform eval methodology and the Quality Flywheel. Covers eval metrics, dataset schema, LLM-as-judge scoring, and common failure causes. Applies to any agents-cli project, whatever framework the agent is written in. Do NOT use for agent API code patterns (ADK: use google-agents-cli-adk-code), deployment (use google-agents-cli-deploy), or project scaffolding (use google-agents-cli-scaffold).
skill-creator
anthropics/skills
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
codex-pet
prime-skills/runcomfy-agent-skills
Codex Pet generator on RunComfy. Build a Codex-compatible Codex Pet spritesheet.webp + pet.json from a single reference image, drop it into ${CODEXHOME:-$HOME/.codex}/pets/ / and Codex picks it up as a custom Codex Pet next to the 8 built-ins. This skill produces the exact Codex Pet atlas Codex expects (1536x1872 PNG/WebP, 8 cols x 9 rows, 192x208 cells, 9 animation states — idle, running-right, running-left, waving, jumping, failed, waiting, running, review). Calls OpenAI GPT Image 2 edit ONCE via the local RunComfy CLI as runcomfy run openai/gpt-image-2/edit to produce a canonical Codex Pet pose, then assembles all 9 animation rows programmatically with ImageMagick micro-transforms — no Codex Pro, no $imagegen, no OPENAIAPIKEY required, only RUNCOMFYTOKEN. Triggers on "codex pet", "create codex pet", "make codex pet", "hatch codex pet", "/hatch image", "desktop pet codex", "codex pets", "spritesheet.webp", or any explicit ask to build a custom pet for OpenAI Codex.
full-output-enforcement
leonxlnx/taste-skill
Overrides default LLM truncation behavior. Enforces complete code generation, bans placeholder patterns, and handles token-limit splits cleanly. Apply to any task requiring exhaustive, unabridged output.
executing-plans
obra/superpowers
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available