developing-langgraph-js-agents
Build, audit, review, and update LangGraph.js agents. Use PROACTIVELY when working with LangGraph, @langchain/langgraph, agent graphs, state machines, or AI workflows in TypeScript/JavaScript. Covers creating new agents, adding features, debugging, testing, and optimizing. (user)
Best use case
developing-langgraph-js-agents is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Build, audit, review, and update LangGraph.js agents. Use PROACTIVELY when working with LangGraph, @langchain/langgraph, agent graphs, state machines, or AI workflows in TypeScript/JavaScript. Covers creating new agents, adding features, debugging, testing, and optimizing. (user)
Teams using developing-langgraph-js-agents should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/developing-langgraph-js-agents/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How developing-langgraph-js-agents Compares
| Feature / Agent | developing-langgraph-js-agents | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Build, audit, review, and update LangGraph.js agents. Use PROACTIVELY when working with LangGraph, @langchain/langgraph, agent graphs, state machines, or AI workflows in TypeScript/JavaScript. Covers creating new agents, adding features, debugging, testing, and optimizing. (user)
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Cursor vs Codex for AI Workflows
Compare Cursor and Codex for AI coding workflows, repository assistance, debugging, refactoring, and reusable developer skills.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
SKILL.md Source
<essential_principles>
## How LangGraph.js Agents Work
LangGraph decomposes agents into **discrete nodes** (functions) connected through **shared state**. Execution flows through a graph where nodes do work and edges determine what runs next.
### 1. State-First Design
State is the shared memory accessible to all nodes. Design state before nodes:
```typescript
import { Annotation, MessagesAnnotation } from "@langchain/langgraph";
const AgentState = Annotation.Root({
...MessagesAnnotation.spec,
// Add custom fields with reducers
context: Annotation<string[]>({
reducer: (x, y) => x.concat(y),
default: () => [],
}),
});
```
**Critical rules:**
- Store raw data, not formatted text (format in nodes)
- Use reducers for fields that accumulate (messages, lists)
- Keep state minimal - only persist what's needed across steps
### 2. Nodes Do Work, Edges Route
```typescript
// Node: receives state, returns partial update
async function callModel(state: typeof AgentState.State) {
const response = await model.invoke(state.messages);
return { messages: [response] };
}
// Edge: determines next node
function shouldContinue(state: typeof AgentState.State) {
const lastMessage = state.messages.at(-1);
if (lastMessage?.tool_calls?.length) return "tools";
return END;
}
```
### 3. Always Compile Before Use
```typescript
const graph = new StateGraph(AgentState)
.addNode("agent", callModel)
.addNode("tools", toolNode)
.addEdge(START, "agent")
.addConditionalEdges("agent", shouldContinue)
.addEdge("tools", "agent")
.compile(); // Required!
```
### 4. Checkpointers Enable Persistence
For conversation memory, human-in-the-loop, or fault tolerance:
```typescript
import { MemorySaver } from "@langchain/langgraph";
const graph = workflow.compile({
checkpointer: new MemorySaver()
});
// Invoke with thread_id
await graph.invoke(input, {
configurable: { thread_id: "user-123" }
});
```
</essential_principles>
<intake>
What would you like to do?
1. Build a new agent from scratch
2. Add a feature to an existing agent
3. Audit/review an agent's architecture
4. Debug an agent issue
5. Write tests for an agent
6. Optimize agent performance
7. Something else
**Wait for response, then read the matching workflow from `workflows/` and follow it.**
</intake>
<routing>
| Response | Workflow |
|----------|----------|
| 1, "new", "create", "build", "start", "scaffold" | `workflows/build-new-agent.md` |
| 2, "add", "feature", "implement", "extend" | `workflows/add-feature.md` |
| 3, "audit", "review", "check", "assess", "evaluate" | `workflows/audit-agent.md` |
| 4, "debug", "fix", "broken", "error", "bug", "issue" | `workflows/debug-agent.md` |
| 5, "test", "tests", "testing", "coverage" | `workflows/write-tests.md` |
| 6, "optimize", "performance", "slow", "fast", "improve" | `workflows/optimize-agent.md` |
| 7, other | Clarify intent, then select appropriate workflow |
</routing>
<verification_loop>
## After Every Change
```bash
# 1. TypeScript compiles?
npx tsc --noEmit
# 2. Tests pass?
npm test
# 3. Agent runs?
npx ts-node src/agent.ts
```
Report:
- "Build: ✓" or "Build: ✗ [error]"
- "Tests: X pass, Y fail"
- "Agent executed successfully" or "Runtime error: [details]"
</verification_loop>
<reference_index>
## Domain Knowledge
All in `references/`:
**LangChain Fundamentals:**
- langchain-fundamentals.md - Messages, chat models, structured output, retrieval, guardrails
**Architecture:**
- graph-api.md - StateGraph, nodes, edges, compilation
- functional-api.md - Tasks, entrypoints, when to use
- state-management.md - Annotations, reducers, state design
**Features:**
- tools.md - Creating and binding tools
- persistence.md - Checkpointers, memory, threads
- streaming.md - Real-time output modes
- interrupts.md - Human-in-the-loop patterns
- subgraphs.md - Composing multi-agent systems
- agent-chat-ui.md - Chat UI setup and integration
- agent-inbox.md - Inbox UI for interrupt management, ambient agents
- deployment.md - Local server, LangSmith Cloud, Studio, observability, time-travel
**Patterns:**
- common-patterns.md - ReAct, RAG, routing patterns
- multi-agent.md - Supervisor, hierarchical, network architectures
- agent-skills.md - Modular capabilities and skill loading
- anti-patterns.md - Common mistakes to avoid
</reference_index>
<workflows_index>
## Workflows
All in `workflows/`:
| File | Purpose |
|------|---------|
| build-new-agent.md | Create a new LangGraph.js agent from scratch |
| add-feature.md | Add capabilities to an existing agent |
| audit-agent.md | Review architecture and identify issues |
| debug-agent.md | Find and fix agent bugs |
| write-tests.md | Test nodes, graphs, and integrations |
| optimize-agent.md | Improve performance and reduce latency |
</workflows_index>
<templates_index>
## Templates
All in `templates/`:
| File | Purpose |
|------|---------|
| basic-agent.ts | Minimal ReAct agent scaffold |
| rag-agent.ts | Retrieval-augmented agent |
| multi-agent.ts | Multi-agent system with subgraphs |
</templates_index>
<external_docs>
## Official Documentation
For topics not fully covered here, consult:
- **LangGraph.js Docs**: https://docs.langchain.com/oss/javascript/langgraph/overview.md
- **API Reference**: https://langchain-ai.github.io/langgraphjs/reference/
- **GitHub Examples**: https://github.com/langchain-ai/langgraphjs/tree/main/examples
- **LangChain Tools**: https://docs.langchain.com/oss/javascript/langchain/tools.md
</external_docs>Related Skills
parallel-agents
Multi-agent orchestration patterns. Use when multiple independent tasks can run with different domain expertise or when comprehensive analysis requires multiple perspectives.
manage-agents
Create, modify, and manage Claude Code subagents with specialized expertise. Use when you need to "work with agents", "create an agent", "modify an agent", "set up a specialist", "I need an agent for [task]", or "agent to handle [domain]". Covers agent file format, YAML frontmatter, system prompts, tool restrictions, MCP integration, model selection, and testing.
langchain-agents
Expert guidance for building LangChain agents with proper tool binding, memory, and configuration. Use when creating agents, configuring models, or setting up tool integrations in LangConfig.
kramme:agents-md
This skill should be used when the user asks to "update AGENTS.md", "add to AGENTS.md", "maintain agent docs", or needs to add guidelines to agent instructions. Guides discovery of local skills and enforces structured, keyword-based documentation style.
git-commit-for-ai-agents
Commit changes to a git repository. Use whenever a git commit is to be executed.
dispatching-parallel-agents
Use when facing 3+ independent failures that can be investigated without shared state or dependencies. Dispatches multiple Claude agents to investigate and fix independent problems concurrently.
custom-sub-agents
Guidance for creating and organizing custom sub-agents in local repos, including folder conventions, per-agent structure, and AGENTS.md indexing. Use when asked where to store sub-agents or how to document them.
custom-agents
GitHub Custom Agent File Format
creating-agents
Create and review agent definition files (agents.md) that give AI coding agents a clear persona, project knowledge, executable commands, code style examples, and explicit boundaries. Use when a user asks to create an agent, define an agent persona, write an agents.md file, set up a custom Copilot agent, review an existing agent definition, or improve agent quality. Covers the six core areas: commands, testing, project structure, code style, git workflow, and boundaries.
create-agents-md
Create or rewrite AGENTS.md files for Open Mercato packages and modules. Use this skill when adding a new package, creating a new module, or when an existing AGENTS.md needs to be created or refactored. Ensures prescriptive tone, MUST rules, checklists, and consistent structure across all agent guidelines.
building-agents
Expert at creating and modifying Claude Code agents (subagents). Auto-invokes when the user wants to create, update, modify, enhance, validate, or standardize agents, or when modifying agent YAML frontmatter fields (especially 'model', 'tools', 'description'), needs help designing agent architecture, or wants to understand agent capabilities. Also auto-invokes proactively when Claude is about to write agent files (*/agents/*.md), create modular agent architectures, or implement tasks that involve creating agent components.
audit-agents-md
Audit AGENTS.md files for token efficiency, completeness, scope hygiene, and actionability. Also considers skills and Cursor rules for redundancy. Use when the user wants to review, optimize, or restructure project agent instructions.