Agent skill · software engineering · jeremylongshore

langchain-langgraph-basics

Build a correct LangGraph 1.0 StateGraph \u2014 typed TypedDict state\

Why this skill is useful

Provides specific patterns and commands for building LangGraph StateGraphs that the AI wouldn't reliably generate on its own.

What it needs

Requires langchain-core, langgraph, langgraph-checkpoint-postgres, python installed locally. About 7k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.

What this skill does

LangChain LangGraph Basics (Python) Overview A conditional edge whose router returns a string that is not in pathmap halts the graph without reaching END. No exception. No log line. The invocation just returns whatever state existed at the halt point — pain-catalog entry P56, and the single most common reason a newly wired StateGraph "almost works." The sibling pain: Command(update={"messages": [msg]}) wipes the prior message history because messages was declared as a plain list[AnyMessage] instead of Annotated[list[AnyMessage], addmessages] — the reducer is what turns update into "append" instead of "replace" (P18). Two more gotchas this skill defuses: P55 — GraphRecursionError: Recursion limit of 25 reached fires on graphs that never loop, because recursionlimit counts supersteps (one step per synchronous batch of node executions), not loop iterations. A planner executor + validator + summarizer can hit 25 without any cycle. P20 — Upgrading langgraph silently reads old PostgresSaver checkpoints as empty state. Checkpoint schemas evolve; PostgresSaver.setup() must be rerun after every version bump before production traffic. This skill walks through a minimal StateGraph end to end: a TypedDict state with reducers on every list field, node functions that return partial-state dicts, edges and defensive conditional edges with END as a fallback in pathmap, compilation with a checkpointer, recursionlimit sizing, and invocation with an explicit threadid. Pin: langgraph 1.0.x, langchain-core 1.0.x. Pain-catalog anchors: P16, P18, P20, P55, P56. Prerequisites Python 3.10+ pip install langgraph>=1.0,<2.0 langchain-core>=1.0,<2.0 A chat model (see langchain-model-inference), or a pure-logic graph with no LLM For persistence beyond a single process: pip install langgraph-checkpoint-postgres and a Postgres 14+ instance Instructions Step 1 — Define state as a TypedDict with reducers on list fields Every list-shaped field in state needs a reducer. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills jeremylongshore/langchain-langgraph-basics--f6f629

View the source on GitHub

Browse the @skills marketplace