# langgraph

Architecture guidelines and coding conventions for Python projects built on LangGraph, focusing on state schemas and graph structure.

- rule · `type=rule` · Claude Code, Cline, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop) · ★ 1054 repo stars
- Author: Bhartendu-Kumar
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/Bhartendu-Kumar/rules_template/tree/HEAD/specific_rule_files/langgraph.mdc
- Updated: 2025-07-17
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/rules/bhartendu-kumar-langgraph

## What it does

This rule establishes conventions for LangGraph workflows. It organizes Python repositories into dedicated modules, keeping custom tools in `src/components` and definitions in `src/schemas`. File and function names stay in `snake_case`, while classes follow `PascalCase`.

The guidelines detail key patterns like `StateGraph` transitions and retry mechanisms with exponential backoff. The rule advises against monolithic graphs and hardcoded parameters. Without disciplined state schemas, multi-step agent workflows break quickly.

## Install

### Cursor (native platform)

**Manually: put the files in place**
- File: `.cursor/rules/langgraph.mdc` — Frontmatter: description, globs, alwaysApply

### Claude Code

**Manually: put the files in place**
- File: `.claude/rules/langgraph.md` — The paths frontmatter field limits the files: move globs from the source into paths

### Codex

**AGENTS.md**
- Codex reads AGENTS.md: paste the rule text there

### GitHub Copilot

**Manually: put the files in place**
- File: `.github/instructions/langgraph.instructions.md` — The applyTo field sets which files it applies to: move globs from the source into applyTo

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/rules/langgraph.md`

### Cline

**Manually: put the files in place**
- File: `.clinerules/langgraph.md`

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/Bhartendu-Kumar/rules_template/tree/HEAD/specific_rule_files/langgraph.mdc

## When to use it
- Organize LangGraph nodes and schemas into modular directories
- Define structured agent states with immutable models
- Prevent infinite loops across conditional graph edges
- Add exponential backoff retries to network-dependent nodes

## Example prompts
- Generate a LangGraph repository layout following the standard directory pattern
- Implement a tool selection node with a dedicated state schema
- Refactor this monolithic graph into separate subgraphs

## Similar
- [langgraph-fundamentals](https://affpapa.org/en/nevibecode/skills/langgraph-fundamentals.md) — skill · 19300 installs
- [langgraph-python-quickstart](https://affpapa.org/en/nevibecode/skills/langgraph-python-quickstart.md) — skill · 6100 installs
- [options-analytics-agent-langgraph](https://affpapa.org/en/nevibecode/skills/options-analytics-agent-langgraph.md) — skill · 2100 installs
- [langgraph-code-review](https://affpapa.org/en/nevibecode/skills/langgraph-code-review.md) — skill · 890 installs
- [langgraph-implementation](https://affpapa.org/en/nevibecode/skills/langgraph-implementation.md) — skill · 161 installs
- [langgraph-testing-evaluation](https://affpapa.org/en/nevibecode/skills/langgraph-testing-evaluation.md) — skill · ★ 106 repo stars

## Other versions with the same name
- [langgraph · sanjeed5](https://affpapa.org/en/nevibecode/rules/langgraph.md) — ★ 3589 repo stars

From the same set: [bhartendu-kumar/rules_template](https://affpapa.org/en/nevibecode/by/bhartendu-kumar/rules_template.md) — 11 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
