LangGraph Code Review
When reviewing LangGraph code, check for these categories of issues.
Anti-confabulation (gate 0 — runs before every other gate)
Before issuing any finding — flag a bug, anti-pattern, or improvement — you MUST echo the exact artifact you are judging, quoted from a source you read in this turn:
- The code finding: its
file:lineplus the cited code, read freshly now. - The graph/state code under review: the
StateGraph, node, edge, or state-schema snippet your finding depends on, quoted from the file you just read.
The artifact is the only source of truth. Never infer what you are reviewing from the branch name, the working directory, surrounding files, or recollection. If your mental model differs from the freshly read source, the source wins. A finding issued without a same-turn echo of its target is invalid — emit the echo first, or do not emit the finding.
This gate exists because an LLM under contextual priming will confidently flag code that is not in the file. It runs before the gates below.
Review gates (sequenced)
Complete in order. Each step has an objective pass condition before moving on.
-
Locate graph code — Search the review scope for
StateGraph,compile(,invoke,ainvoke,add_node,add_edge,add_conditional_edges. Pass: a short list of file paths (or explicit “none in scope” after searching). -
Map state schema — For each graph state type (
TypedDict,BaseModel, etc.), list fields that hold lists, dicts, or messages and whetherAnnotated+ reducers (add_messages,operator.add, …) are present. Pass: every such field is either covered by a reducer pattern below or explicitly flagged as intentional overwrite. -
Trace persistence — If interrupts,
thread_id, or checkpoint APIs appear, follow them tocompile(..., checkpointer=...)and invocationconfig. Pass: behavior matches the interrupt/checkpointer/thread_id guidance below—or you document a concrete mismatch with file:line. -
Report with evidence — For each finding you will deliver, record file path and line number(s) (or a minimal quoted snippet). Pass: no critical or high-severity issue is stated without that citation.
-
Run the checklist — Use the checklist at the end of this skill; each item is satisfied, not applicable (with reason), or open with evidence. Pass: no item left silently unchecked.
Critical Issues
1. State Mutation Instead of Return
2. Missing Reducer for List Fields
3. Wrong Return Type from Conditional Edge
4. Missing Checkpointer for Interrupts
5. Forgetting Thread ID with Checkpointer
State Schema Issues
6. Using add_messages Without Message Types
7. Returning Full State Instead of Partial
8. Pydantic State Without Annotations
Graph Structure Issues
9. Missing Entry Point
10. Unreachable Nodes
11. Conditional Edge Without All Paths
12. Command Without destinations
Async Issues
13. Mixing Sync/Async Incorrectly
14. Blocking Calls in Async Context
Tool Integration Issues
15. Tool Calls Without Corresponding ToolMessage
16. Parallel Tool Calls Before Interrupt
Checkpointing Issues
17. InMemorySaver in Production
18. Subgraph Checkpointer Confusion
Performance Issues
19. Large State in Every Update
20. Missing Recursion Limit Handling
Code Review Checklist
- State schema uses Annotated with reducers for collections
- Nodes return partial state updates, not mutations
- Conditional edges return valid node names or END
- Graph has path from START to all nodes
- Checkpointer provided if using interrupts
- Thread ID provided in config when using checkpointer
- Tool calls paired with ToolMessages
- Async nodes use async operations
- Production uses persistent checkpointer
- Recursion limits considered for loops


