LangGraph state management
Designs LangGraph state, reducers and checkpoints and fixes state bugs, so your agent keeps the right memory.
What we improved
Replaced the thin debugging table with a debugging playbook: a short model of how state moves through super-steps, a symptom table with causes and fixes (including duplicated lists from returning the whole list to an append reducer, in-plac
Improved by YourAISkill from the original by soba-labs, under its MIT licence. The download includes the author's licence and a CHANGES.md listing every change. Both Claude reviews read the improved version.
Claude's review
8/10 Strong LangGraph state guide: super-step semantics, reducer pitfalls, Overwrite and RemoveMessage, checkpointer setup details and a symptom-to-fix debugging table, plus scripts and references.
We asked Claude the question you would ask: would I be glad I installed this? Two separate reviews, the second blind to the first, must both rate a skill 7 or higher before we sell it.
In detail
Design state schemas, implement reducers, configure persistence, and debug state issues for LangGraph applications. Use when users want to (1) design or define state schemas for LangGraph graphs, (2) implement reducer functions for state accumulation, (3) configure persistence with checkpointers (InMemorySaver/MemorySaver, SqliteSaver, PostgresSaver), (4) debug state update issues or unexpected state behavior, (5) migrate state schemas between versions, (6) validate state schema structure, (7) choose between TypedDict and MessagesState patterns, (8) implement custom reducers for lists, dicts, or sets, (9) use the Overwrite type to bypass reducers, (10) set up thread-based persistence for multi-turn conversations, or (11) inspect checkpoints for debugging.
How you use it
- Add it to your pack, then download your pack (1 credit).
- In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
- Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide
Safety check
Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.
An automated scan lowers risk but cannot promise zero risk. How we check skills
Preview
The first lines of SKILL.md
---
name: langgraph-state-management
description: "Design state schemas, write reducers, configure checkpointer persistence, and debug state bugs in LangGraph applications (Python and TypeScript). Use when someone wants to (1) design or review a state schema (TypedDict, MessagesState, Pydantic, dataclass, or StateSchema with Zod in JS), (2) write or test reducers for lists, dicts, sets or messages, (3) reset accumulated state with Overwrite or RemoveMessage, (4) set up InMemorySaver, SqliteSaver, PostgresSaver or RedisSaver and thread_id-based memory, (5) debug state that is not updating, is overwritten, duplicates, leaks between threads or grows without bound, or errors such as InvalidUpdateError, GraphRecursionError, KeyError on state or a missing thread_id, (6) inspect, edit, replay or migrate checkpoints, or (7) validate a state schema with the included scripts."
---
<!-- Modified by YourAISkill (youraiskill.com) on 2 December 2026 from the original by soba-labs. See CHANGES.md. -->
# LangGraph State Management
## State design workflow
1. **Identify data requirements:** what flows through the graph, who writes each key, and which keys several nodes write.
2. **Choose a schema pattern:** match the use case to a template below.
3. **Define reducers:** every key written by more than one node in the same step, or meant to accumulate, needs one.
4. **Configure persistence:** pick a checkpointer and a thread id scheme.
5. **Validate and test:** run the schema validator, unit-test reducers, run the graph once with `stream_mode="updates"`.
## How state moves (read this before debugging)
- The graph runs in **super-steps**. All nodes scheduled in a step see the same state; their returned updates are applied together at the end of the step.
- A key **without** a reducer keeps the last value and accepts **one** write per step. A key **with** a reducer combines writes: `reducer(current, update)`.
- **Only returned values are updates.** Mutating `state[...]` in place is not recorded and can leak between branches.
- **Graph input is an update too.** It passes through the reducers, so a second `invoke` on the same thread **appends** to stored lists and messages.
- With a checkpointer, a checkpoint is saved after every step under the `thread_id`.
## Quick start
### Python: chat state
```python
from langgraph.graph import StateGraph, START, END, MessagesState
from langchain_core.messages import AIMessage
class State(MessagesState): # `messages` with the add_messages reducer built in
documents: list[str]
query: str
def chat_node(state: State):
return {"messages": [AIMessage(content="Hello!")]} # return only the new message
graph = StateGraph(State).add_node("chat", chat_node)
...From soba-labs's repository, MIT licence.
Related skills
-
Checked
Neuron PHP AI Agents
Builds and configures AI agents in PHP with the Neuron framework, covering tools, memory and streaming.
7/101 credit -
Checked
RAG evaluation
Measures how well a RAG system retrieves and answers, with test questions, metrics and chunking advice.
7/101 credit -
Checked
LangSmith Agent Testing
Sets up LangSmith datasets, scorers and experiments so you can prove an AI agent change is better before release.
7/101 credit -
Checked
Test and Fix Loop
Sets up a coding agent to run tests, read failures and fix them until green, with a safe point to stop.
8/101 credit -
Checked
AI Failure Analysis
Sorts real chatbot or agent logs into named failure types with counts, so you know which tests to write first.
7/101 credit -
Checked
AI Agent Eval Rubric
Writes pass or fail checks that define good behaviour for your AI agent, plus release targets for the PRD.
7/101 credit