langgraph-fundamentals
INVOKE THIS SKILL when writing ANY LangGraph code. Covers StateGraph, state schemas, nodes, edges, Command, Send, invoke, streaming, and error handling.
npx skills add majiayu000/claude-skill-registry --skill langgraph-fundamentals-harmeet10000-skills --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
Instructs the agent to work with LangGraph to build directed graphs that represent agent workflows. It defines a StateGraph as the main class for stateful graphs, with nodes as functions that perform work and update state, and edges that determine execution order (static or conditional). It references START and END as entry/exit points and explains reducers for state updates (overwrite, append, or custom logic). The skill emphasizes that graphs must be compile()d before execution and provides guidance on graph design, state management, node signatures, edge types, and usage of Command and Send for combined state updates and routing or fan-out parallel tasks.
It includes concrete examples in Python and TypeScript for basic graph construction, conditional edges, command-based routing, and Send-based parallelism, showing how to define state schemas, node functions, and graph wiring, and how to invoke the graph to obtain results.
The skill also documents how to annotate return types for Command in Python and how to specify valid goto destinations in TypeScript, as well as cautions about static vs dynamic edges when using Command.
How it works
- Define a State schema and node functions that accept state (and optionally config or runtime) and return partial updates or Commands.
- Use add_node(s) to register nodes and add_edge or addEdge to set deterministic flow; use add_conditional_edges for routing based on state through a route function.
- Use reducers (via Annotated with operator.add or ReducedValue) to control how updates accumulate in state across nodes.
- Return partial updates from nodes rather than mutating and returning the full state.
- For complex routing, return a Command with update and goto to combine state changes with navigation; for parallel tasks use Send to fan out work and aggregate results with a reducer.
- Compile graphs with .compile() before invoking, then call graph.invoke(initial_state).
When to use it
- When you need fine-grained control over agent orchestration with branching or loops.
- When building complex workflows requiring persistence or human-in-the-loop routing.
- When you want explicit state sharing across nodes and conditional routing based on state.
What it can touch
- Graph construction APIs: StateGraph, START, END, add_node, add_edge, add_conditional_edges, compile, invoke.
- Node signatures and state updates: Python: def node(state: State) or def node(state: State, config: RunnableConfig) or def node(state: State, runtime: Runtime[Context]); TypeScript: (state) => {...} or (state, config) => {...}.
- State schemas and reducers: Python TypedDict with Annotated and operator.add; TypeScript StateSchema with ReducedValue.
- Command and Send usage for routing and parallelism; annotations for Command return types; and edge behavior warnings.
Caveats
- Command adds dynamic edges; static edges defined with add_edge/addEdge still run, so both paths may execute if both are configured.
- Nodes must return partial updates, not mutate and return full state.
- Graphs must be compile()d before execution; runtime relies on proper state reducers to accumulate lists and values.
- The skill description notes how to declare valid goto destinations for Command or addNode, and emphasizes not overwriting arrays without reducers.
<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: 1. **Map out discrete steps** — sketch a flowchart of your workflow. Each step becomes a node. 2. **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. 3. **Design your state** — state is shared memory for all nodes. Store raw data, format prompts on-demand inside nodes. 4. **Build your nodes** — implement each step as a function that takes state and returns partial updates. 5. **Wire it together** — connect nodes with edges, add conditional routing, compile with a checkpointer if needed. </desig
- Designing a LangGraph application
- State Management
- Nodes
- Edges
- Command
- Send API
- Running Graphs: Invoke and Stream
- Error Handling
- Common Fixes
- What You Should NOT Do
What does the langgraph-fundamentals skill do?
INVOKE THIS SKILL when writing ANY LangGraph code. Covers StateGraph, state schemas, nodes, edges, Command, Send, invoke, streaming, and error handling.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill langgraph-fundamentals-harmeet10000-skills --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
