sameeh07/agent-skills/langgraph-fundamentals
Claude Code and agent skill by sameeh07/agent-skills
- community
Checking that the SKILL.md file is still in the repository.
INVOKE THIS SKILL when writing ANY LangGraph code. Covers StateGraph, state schemas, nodes, edges, Command, Send, invoke, streaming, and error handling.
Install
npx vskill@latest install sameeh07/agent-skills/langgraph-fundamentalsSKILL.md
The same SKILL.md was published earlier as langchain-ai/skills-benchmarks/langgraph-fundamentals.
<overview> LangGraph models agent workflows as directed graphs:
- StateGraph: Main class for building stateful graphs
- Nodes: Functions that perform work and update state
- Edges: Define execution order (static or conditional)
- START/END: Special nodes marking entry and exit points
- State with Reducers: Control how state updates are merged
Graphs must be compile()d before execution. </overview>
<design-methodology>
Designing a LangGraph application
Follow these 5 steps when building a new graph:
- Map out discrete steps — sketch a flowchart of your workflow. Each step becomes a node.
- Identify what each step does — categorize nodes: LLM step, data step, action step, or user input step. For each, determine static context (prompt), dynamic context (from state), retry strategy, and desired outcome.
- Design your state — state is shared memory for all nodes. Store raw data, format prompts on-demand inside nodes.
- Build your nodes — implement each step as a function that takes state and returns partial updates.
- Wire it together — connect nodes with edges, add conditional routing, compile with a checkpointer if needed.
</design-methodology>
<when-to-use-langgraph>
| Use LangGraph When | Use Alternatives When | |
|---|---|---|
| Need fine-grained control over agent orchestration | Quick prototyping → LangChain agents | |
| Building complex workflows with branching/loops | Simple stateless workflows → LangChain direct | |
| Require human-in-the-loop, persistence | Batteries-included features → Deep Agents |
</when-to-use-langgraph>
State Management
<state-update-strategies>
| Need | Solution | Example | |
|---|---|---|---|
| Overwrite value | No reducer (default) | Simple fields like counters | |
| Append to list | Reducer (operator.add / concat) | Message history, logs | |
| Custom logic | Custom reducer function | Complex merging |
</state-update-strategies>
<ex-state-with-reducer> <python> Define state schema with reducers for accumulating lists and summing integers.
</python> <typescript> Use StateSchema with ReducedValue for accumulating arrays.
</typescript> </ex-state-with-reducer>
<fix-forgot-reducer-for-list> <python> Without a reducer, returning a list overwrites previous values.
</python> <typescript> Without ReducedValue, arrays are overwritten not appended.
</typescript> </fix-forgot-reducer-for-list>
<fix-state-must-return-dict> <python> Nodes must return partial updates, not mutate and return full state.
</python> <typescript> Return partial updates only, not the full state object.
</typescript> </fix-state-must-return-dict>
Nodes
<node-function-signatures>
Node functions accept these arguments:
<python>
| Signature | When to Use | |
|---|---|---|
def node(state: State) | Simple nodes that only need state | |
def node(state: State, config: RunnableConfig) | Need thread_id, tags, or configurable values | |
def node(state: State, runtime: Runtime[Context]) | Need runtime context, store, or stream_writer |
</python> <typescript>
| Signature | When to Use | |
|---|---|---|
(state) => {...} | Simple nodes that only need state | |
(state, config) => {...} | Need thread_id, tags, or configurable values |
</typescript>
</node-function-signatures>
Edges
<edge-type-selection>
| Need | Edge Type | When to Use | |
|---|---|---|---|
| Always go to same node | add_edge() | Fixed, deterministic flow | |
| Route based on state | add_conditional_edges() | Dynamic branching | |
| Update state AND route | Command | Combine logic in single node | |
| Fan-out to multiple nodes | Send | Parallel processing with dynamic inputs |
</edge-type-selection>
<ex-basic-graph> <python> Simple two-node graph with linear edges.
</python> <typescript> Chain nodes with addEdge and compile before invoking.
</typescript> </ex-basic-graph>
<ex-conditional-edges> <python> Route to different nodes based on state with conditional edges.
</python> <typescript> addConditionalEdges routes based on function return value.
</typescript> </ex-conditional-edges>
Command
Command combines state updates and routing in a single return value. Fields:
- `update`: State updates to apply (like returning a dict from a node)
- `goto`: Node name(s) to navigate to next
- `resume`: Value to resume after
interrupt()— see human-in-the-loop skill
<ex-command-state-and-routing> <python> Command lets you update state AND choose next node in one return.
</python> <typescript> Return Command with update and goto to combine state change with routing.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/langgraph-fundamentals/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/sameeh07/agent-skills/langgraph-fundamentals)