langchain-development
БесплатноБез исполняемых скриптовНе проверенExpert guidance for LangChain and LangGraph development with Python, covering chain composition, agents, memory, and RAG implementations.
от Mindrally★ 323 звезды на GitHubОб этом скилле
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 conte
Установить langchain-development в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл langchain-development?
Expert guidance for LangChain and LangGraph development with Python, covering chain composition, agents, memory, and RAG implementations.
Как установить скилл langchain-development?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл langchain-development запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic