Agent skill · AI & Agents

langgraph-state

在 LangGraph 中管理状态:模式、reducer、通道和消息传递,用于协调 Agent 执行

majiayu000github.com/majiayu000GitHub ↗
claude-codeMIT
Install
npx skills add majiayu000/claude-skill-registry --skill langgraph-state-evanfang0054-cc-system-creator-sc --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 2
SKILL.md size: 7 KB
Bundled scripts: none
Path: skills/ai-llm/langgraph-state-evanfang0054-cc-system-creator-sc/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 534
Language: HTML

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# langgraph-state (JavaScript/TypeScript) --- name: langgraph-state description: 在 LangGraph 中管理状态 - 模式、reducer、通道和消息传递,用于协调 Agent 执行 --- ## 概述 状态是 LangGraph 中的核心数据结构,在整个图执行期间持久存在。正确的状态管理对于构建可靠的 Agent 至关重要。 **核心概念:** - **StateSchema**:定义状态结构和类型 - **Reducers**:控制如何应用状态更新(ReducedValue) - **通道(Channels)**:低级状态管理原语 - **消息传递**:节点如何通过状态更新进行通信 ## 决策表:状态更新策略 | 需求 | 解决方案 | 使用场景 | |------|----------|----------| | 覆盖值 | 普通 Zod 模式 | 简单字段如字符串 | | 追加到列表 | `ReducedValue` 与 concat | 日志、累积数据 | | 自定义逻辑 | 自定义 reducer 函数 | 复杂合并、验证 | | 消息 | `MessagesValue` | 聊天应用程序 | ## 代码示例 ### 基本状态管理 ```typescript import { StateGraph, StateSchema, START, END } from "@langchain/langgraph"; import { z } from "zod"; const State = new StateSchema({ input: z.string(), processed: z.string(), count: z.number(), }); const process = async (state: typeof State.State) => { return { processed: state.input.toUpperCase(), count: state.count + 1, }; }; const graph = new StateGraph(State) .addNode("process", process) .addEdge(START, "process") .addEdge("process", END) .compile(); const result = await graph.invoke({ input: "hello", count: 0 }); console.log(result); // { input: 'hello', processed: 'HELLO', count: 1 } ``` ### 带Reducer

What's inside
Steps it walks through
  1. 概述
  2. 决策表:状态更新策略
  3. 代码示例
  4. 基本状态管理
  5. 带Reducer 的消息
  6. 使用 ReducedValue 的自定义 Reducer
  7. 使用 ReducedValue 的列表累积
  8. 使用通道 API
  9. 部分状态更新
  10. 边界
  11. 您能够配置的
  12. 您不能配置的
  13. 注意事项
  14. 1. 忘记为 Arrays 添加 Reducer
Ships with 1 file
  • metadata.json
More from claude-skill-registry
All skills →
About this skill
What does the langgraph-state skill do?

在 LangGraph 中管理状态:模式、reducer、通道和消息传递,用于协调 Agent 执行

How do I install it?

Run `npx skills add majiayu000/claude-skill-registry --skill langgraph-state-evanfang0054-cc-system-creator-sc --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.

Keep going