langchain-development
Skill275 starsChanged 52 days agoApache-2.0View on GitHub
Expert guidance for LangChain and LangGraph development with Python, covering chain composition, agents, memory, and RAG implementations.
In this repository264 other files it gives its agents.
- accessibility-a11ySkill
- alpine-jsSkill
- analytics-data-analysisSkill
- android-developmentSkill
- angular-developmentSkill
- angularSkill
- anime-jsSkill
- anthropic-claude-developmentSkill
- api-developmentSkill
- apollo-graphqlSkill
- aspnet-coreSkill
- astroSkill
- auth0-authenticationSkill
- autogen-developmentSkill
- automl-hyperparameter-optimizationSkill
- aws-developmentSkill
- azureSkill
- backend-developmentSkill
- bash-scriptingSkill
- beautifulsoup-parsingSkill
- bitbucket-workflowSkill
- blazorSkill
- blender-python-addonSkill
- blockchainSkill
- bootstrapSkill
- business-central-developmentSkill
- cheerio-parsingSkill
- chrome-extension-developmentSkill
- ci-cd-best-practicesSkill
- clean-architectureSkill
- clean-codeSkill
- clerk-authenticationSkill
- cloudflare-developmentSkill
- computer-vision-opencvSkill
- convexSkill
- cppSkill
- c-sharpSkill
- cssSkill
- cypressSkill
- data-analysis-jupyterSkill
- data-analystSkill
- data-jupyter-pythonSkill
- deep-learning-pythonSkill
- deep-learning-pytorchSkill
- deep-learningSkill
- deno-typescriptSkill
- design-systemsSkill
- devopsSkill
- django-pythonSkill
- django-rest-api-developmentSkill
- dockerSkill
- dotnetSkill
- drizzle-ormSkill
- drupal-developmentSkill
- elasticsearch-best-practicesSkill
- electron-developmentSkill
- elixirSkill
- embedded-stm32Skill
- esbuild-bundlerSkill
- ethereumSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
33 rules. About 0 are common, 23 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈23
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Write concise, technical responses with accurate Python examples
- Distinctive: line 16
Use functional, declarative programming.
- Distinctive: line 17
Prefer iteration and modularization over code duplication
- Distinctive: line 18
Use descriptive variable names with auxiliary verbs (e.g., is_active, has_context)
- Distinctive: line 19
Follow PEP 8 style guidelines strictly
- Distinctive: line 43
Use snake_case for files, functions, and variables
- Distinctive: line 44
Use PascalCase for classes
- Very specific: line 46
Use descriptive names that indicate purpose (e.g., create_retrieval_chain, build_agent_executor)
- Very specific: line 52
Use LCEL for composing chains with the pipe operator (|)
- Very specific: line 53
Prefer RunnableSequence and RunnableParallel for complex workflows
- Very specific: line 72
Always use invoke() for single inputs, batch() for multiple inputs
- Very specific: line 73
Use stream() for real-time token streaming
- Very specific: line 75
Use bind() to attach tools or functions to runnables
- Very specific: line 102
Use create_react_agent or create_tool_calling_agent based on model capabilities
- Distinctive: line 104
Add callbacks for monitoring and debugging
- Distinctive: line 105
Use structured chat agents for complex tool interactions
- Very specific: line 111
Use ConversationBufferMemory for short conversations
- Very specific: line 113
Consider ConversationBufferWindowMemory for fixed-length history
- Distinctive: line 114
Use persistent storage backends for production (Redis, PostgreSQL)
- Distinctive: line 120
Use checkpointing for resumable workflows
- Distinctive: line 140
Use appropriate text splitters (RecursiveCharacterTextSplitter, MarkdownTextSplitter)
- Distinctive: line 143
Use document loaders appropriate for file types
- Distinctive: line 149
Use hybrid search when available (dense + sparse)
- Distinctive: line 155
Use contextual compression to reduce noise
- Distinctive: line 156
Consider parent document retrieval for better context
- Distinctive: line 164
Add run names for easy identification
- Distinctive: line 166
Use tags for categorization
- Distinctive: line 179
Use fallback chains for critical paths
- Very specific: line 193
Use async methods (ainvoke, abatch) for I/O-bound operations
- Distinctive: line 196
Use streaming for better user experience
- Distinctive: line 200
Write unit tests for individual chain components
- Distinctive: line 202
Use mocking for LLM calls in unit tests
- Distinctive: line 203
Test edge cases and error conditions
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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 filesNaming 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 resultsAgent 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
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

