langchain-core-workflow-a

Build LangChain LCEL chains with prompts, parsers, and composition. Use when creating prompt templates, building RunnableSequence pipelines, parallel/branching chains, or multi-step processing workflows. Trigger: "langchain chains", "langchain prompts", "LCEL workflow", "langchain pipeline", "prompt template", "RunnableSequence".

1,868 stars

Best use case

langchain-core-workflow-a is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Build LangChain LCEL chains with prompts, parsers, and composition. Use when creating prompt templates, building RunnableSequence pipelines, parallel/branching chains, or multi-step processing workflows. Trigger: "langchain chains", "langchain prompts", "LCEL workflow", "langchain pipeline", "prompt template", "RunnableSequence".

Teams using langchain-core-workflow-a 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

$curl -o ~/.claude/skills/langchain-core-workflow-a/SKILL.md --create-dirs "https://raw.githubusercontent.com/jeremylongshore/claude-code-plugins-plus-skills/main/plugins/saas-packs/langchain-pack/skills/langchain-core-workflow-a/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/langchain-core-workflow-a/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How langchain-core-workflow-a Compares

Feature / Agentlangchain-core-workflow-aStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Build LangChain LCEL chains with prompts, parsers, and composition. Use when creating prompt templates, building RunnableSequence pipelines, parallel/branching chains, or multi-step processing workflows. Trigger: "langchain chains", "langchain prompts", "LCEL workflow", "langchain pipeline", "prompt template", "RunnableSequence".

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

SKILL.md Source

# LangChain Core Workflow A: Chains & Prompts

## Overview

Build production chains using LCEL (LangChain Expression Language). Covers prompt templates, output parsers, RunnableSequence, RunnableParallel, RunnableBranch, RunnablePassthrough, and chain composition patterns.

## Prerequisites

- `langchain-install-auth` completed
- `@langchain/core` and at least one provider installed

## Prompt Templates

### ChatPromptTemplate

```typescript
import { ChatPromptTemplate, MessagesPlaceholder } from "@langchain/core/prompts";

// Simple template
const simple = ChatPromptTemplate.fromTemplate(
  "Translate '{text}' to {language}"
);

// Multi-message template with chat history slot
const chat = ChatPromptTemplate.fromMessages([
  ["system", "You are a {role}. Respond in {style} style."],
  new MessagesPlaceholder("history"),  // dynamic message injection
  ["human", "{input}"],
]);

// Inspect required variables
console.log(chat.inputVariables);
// ["role", "style", "history", "input"]
```

### Partial Templates

```typescript
// Pre-fill some variables, leave others for later
const partial = await chat.partial({
  role: "senior engineer",
  style: "concise",
});

// Now only needs: history, input
const result = await partial.invoke({
  history: [],
  input: "Explain LCEL",
});
```

## Output Parsers

```typescript
import { StringOutputParser } from "@langchain/core/output_parsers";
import { JsonOutputParser } from "@langchain/core/output_parsers";
import { StructuredOutputParser } from "@langchain/core/output_parsers";
import { z } from "zod";

// String output (most common)
const strParser = new StringOutputParser();

// JSON output with Zod schema
const jsonParser = StructuredOutputParser.fromZodSchema(
  z.object({
    answer: z.string(),
    confidence: z.number(),
    sources: z.array(z.string()),
  })
);

// Get format instructions to inject into prompt
const instructions = jsonParser.getFormatInstructions();
```

## Chain Composition Patterns

### Sequential Chain (RunnableSequence)

```typescript
import { ChatOpenAI } from "@langchain/openai";
import { ChatPromptTemplate } from "@langchain/core/prompts";
import { StringOutputParser } from "@langchain/core/output_parsers";
import { RunnableSequence } from "@langchain/core/runnables";

const model = new ChatOpenAI({ model: "gpt-4o-mini" });

// Extract key points, then summarize
const extractPrompt = ChatPromptTemplate.fromTemplate(
  "Extract 3 key points from:\n{text}"
);
const summarizePrompt = ChatPromptTemplate.fromTemplate(
  "Summarize these points in one sentence:\n{points}"
);

const chain = RunnableSequence.from([
  // Step 1: extract points
  {
    points: extractPrompt
      .pipe(model)
      .pipe(new StringOutputParser()),
  },
  // Step 2: summarize
  summarizePrompt,
  model,
  new StringOutputParser(),
]);

const summary = await chain.invoke({
  text: "Long article text here...",
});
```

### Parallel Execution (RunnableParallel)

```typescript
import { RunnableParallel } from "@langchain/core/runnables";

// Run multiple chains simultaneously on the same input
const analysis = RunnableParallel.from({
  summary: ChatPromptTemplate.fromTemplate("Summarize: {text}")
    .pipe(model)
    .pipe(new StringOutputParser()),

  keywords: ChatPromptTemplate.fromTemplate("Extract 5 keywords from: {text}")
    .pipe(model)
    .pipe(new StringOutputParser()),

  sentiment: ChatPromptTemplate.fromTemplate("Sentiment of: {text}")
    .pipe(model)
    .pipe(new StringOutputParser()),
});

const results = await analysis.invoke({ text: "Your input text" });
// { summary: "...", keywords: "...", sentiment: "..." }
```

### Conditional Branching (RunnableBranch)

```typescript
import { RunnableBranch } from "@langchain/core/runnables";

const technicalChain = ChatPromptTemplate.fromTemplate(
  "Give a technical explanation: {input}"
).pipe(model).pipe(new StringOutputParser());

const simpleChain = ChatPromptTemplate.fromTemplate(
  "Explain like I'm 5: {input}"
).pipe(model).pipe(new StringOutputParser());

const router = RunnableBranch.from([
  [
    (input: { input: string; level: string }) => input.level === "expert",
    technicalChain,
  ],
  // Default fallback
  simpleChain,
]);

const answer = await router.invoke({ input: "What is LCEL?", level: "expert" });
```

### Context Injection (RunnablePassthrough)

```typescript
import { RunnablePassthrough } from "@langchain/core/runnables";

// Pass through original input while adding computed fields
const chain = RunnablePassthrough.assign({
  wordCount: (input: { text: string }) => input.text.split(" ").length,
  uppercase: (input: { text: string }) => input.text.toUpperCase(),
}).pipe(
  ChatPromptTemplate.fromTemplate(
    "The text has {wordCount} words. Summarize: {text}"
  )
).pipe(model).pipe(new StringOutputParser());
```

## Python Equivalent

```python
from langchain_openai import ChatOpenAI
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.output_parsers import StrOutputParser
from langchain_core.runnables import RunnableParallel, RunnablePassthrough

llm = ChatOpenAI(model="gpt-4o-mini")

# Sequential: prompt | model | parser
chain = ChatPromptTemplate.from_template("Summarize: {text}") | llm | StrOutputParser()

# Parallel
analysis = RunnableParallel(
    summary=ChatPromptTemplate.from_template("Summarize: {text}") | llm | StrOutputParser(),
    keywords=ChatPromptTemplate.from_template("Keywords: {text}") | llm | StrOutputParser(),
)

# Passthrough with computed fields
chain = (
    RunnablePassthrough.assign(context=lambda x: fetch_context(x["query"]))
    | prompt | llm | StrOutputParser()
)
```

## Error Handling

| Error | Cause | Fix |
|-------|-------|-----|
| `Missing value for input` | Template variable not provided | Check `inputVariables` on your prompt |
| `Expected mapping type` | Passing string instead of object | Use `{ input: "text" }` not `"text"` |
| `OutputParserException` | LLM output doesn't match schema | Use `.withStructuredOutput()` instead of manual parsing |
| Parallel timeout | One branch hangs | Add `timeout` to model config |

## Resources

- [LCEL Guide](https://js.langchain.com/docs/concepts/lcel/)
- [RunnableSequence API](https://v03.api.js.langchain.com/classes/_langchain_core.runnables.RunnableSequence.html)
- [Prompt Templates](https://js.langchain.com/docs/concepts/prompt_templates/)

## Next Steps

Proceed to `langchain-core-workflow-b` for agents and tool calling.

Related Skills

calendar-to-workflow

1868
from jeremylongshore/claude-code-plugins-plus-skills

Converts calendar events and schedules into Claude Code workflows, meeting prep documents, and standup notes. Use when the user mentions calendar events, meeting prep, standup generation, or scheduling workflows. Trigger with phrases like "prep for my meetings", "generate standup notes", "create workflow from calendar", or "summarize today's schedule".

workhuman-core-workflow-b

1868
from jeremylongshore/claude-code-plugins-plus-skills

Workhuman core workflow b for employee recognition and rewards API. Use when integrating Workhuman Social Recognition, or building recognition workflows with HRIS systems. Trigger: "workhuman core workflow b".

workhuman-core-workflow-a

1868
from jeremylongshore/claude-code-plugins-plus-skills

Workhuman core workflow a for employee recognition and rewards API. Use when integrating Workhuman Social Recognition, or building recognition workflows with HRIS systems. Trigger: "workhuman core workflow a".

wispr-core-workflow-b

1868
from jeremylongshore/claude-code-plugins-plus-skills

Wispr Flow core workflow b for voice-to-text API integration. Use when integrating Wispr Flow dictation, WebSocket streaming, or building voice-powered applications. Trigger: "wispr core workflow b".

wispr-core-workflow-a

1868
from jeremylongshore/claude-code-plugins-plus-skills

Wispr Flow core workflow a for voice-to-text API integration. Use when integrating Wispr Flow dictation, WebSocket streaming, or building voice-powered applications. Trigger: "wispr core workflow a".

windsurf-core-workflow-b

1868
from jeremylongshore/claude-code-plugins-plus-skills

Execute Windsurf's secondary workflow: Workflows, Memories, and reusable automation. Use when creating reusable Cascade workflows, managing persistent memories, or automating repetitive development tasks. Trigger with phrases like "windsurf workflow", "windsurf automation", "windsurf memories", "cascade workflow", "windsurf slash command".

windsurf-core-workflow-a

1868
from jeremylongshore/claude-code-plugins-plus-skills

Execute Windsurf's primary workflow: Cascade Write mode for multi-file agentic coding. Use when building features, refactoring across files, or performing complex code tasks. Trigger with phrases like "windsurf cascade write", "windsurf agentic coding", "windsurf multi-file edit", "cascade write mode", "windsurf build feature".

webflow-core-workflow-b

1868
from jeremylongshore/claude-code-plugins-plus-skills

Execute Webflow secondary workflows — Sites management, Pages API, Forms submissions, Ecommerce (products/orders/inventory), and Custom Code via the Data API v2. Use when managing sites, reading pages, handling form data, or working with Webflow Ecommerce products and orders. Trigger with phrases like "webflow sites", "webflow pages", "webflow forms", "webflow ecommerce", "webflow products", "webflow orders".

webflow-core-workflow-a

1868
from jeremylongshore/claude-code-plugins-plus-skills

Execute the primary Webflow workflow — CMS content management: list collections, CRUD items, publish items, and manage content lifecycle via the Data API v2. Use when working with Webflow CMS collections and items, managing blog posts, team members, or any dynamic content. Trigger with phrases like "webflow CMS", "webflow collections", "webflow items", "create webflow content", "manage webflow CMS", "webflow content management".

veeva-core-workflow-b

1868
from jeremylongshore/claude-code-plugins-plus-skills

Veeva Vault core workflow b for REST API and clinical operations. Use when working with Veeva Vault document management and CRM. Trigger: "veeva core workflow b".

veeva-core-workflow-a

1868
from jeremylongshore/claude-code-plugins-plus-skills

Veeva Vault core workflow a for REST API and clinical operations. Use when working with Veeva Vault document management and CRM. Trigger: "veeva core workflow a".

vastai-core-workflow-b

1868
from jeremylongshore/claude-code-plugins-plus-skills

Execute Vast.ai secondary workflow: multi-instance orchestration, spot recovery, and cost optimization. Use when running distributed training, handling spot preemption, or optimizing GPU spend across multiple instances. Trigger with phrases like "vastai distributed training", "vastai spot recovery", "vastai multi-gpu", "vastai cost optimization".