new-chain

new-chain is a command for Claude Code from Codeblockz/langchain-community-plugin. It costs 15 tokens per session (2,309 once invoked), scanned A, original, Apache-2.0.

A code generator for LangChain LCEL chains, which connect language-model steps together. It provides starting templates for summarizing, extracting data, classifying text, and translating.

In plain words
What is it for?
Use it to create a Python chain file from a selected pattern, then customize the model, prompts, and output behavior.
Why use it?
It removes the repetitive setup needed to begin a common language-processing workflow.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: names the AskUserQuestion tool; positional $N argument.

Part of the langchain-community plugin — 3 skills, 5 commands, 2 agents, 1 MCP server shipped together

Good fit Use it to create a Python chain file from a selected pattern, then customize the model, prompts, and output behavior.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/codeblockz/langchain-community-plugin/new-chain
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/Codeblockz/langchain-community-plugin

Made for: Claude Code.

Or install langchain-community, the plugin that ships this one along with the rest of its 3 skills, 5 commands, 2 agents, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for new-chain

README.md
[![agentmods](https://agentmods.dev/badge/commands/codeblockz/langchain-community-plugin/new-chain/github.svg)](https://agentmods.dev/commands/codeblockz/langchain-community-plugin/new-chain)
Your own site
<a href="https://agentmods.dev/commands/codeblockz/langchain-community-plugin/new-chain"><img src="https://agentmods.dev/badge/commands/codeblockz/langchain-community-plugin/new-chain/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for new-chain

Your own site · 80×15
<a href="https://agentmods.dev/commands/codeblockz/langchain-community-plugin/new-chain"><img src="https://agentmods.dev/badge/commands/codeblockz/langchain-community-plugin/new-chain.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 15 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,309 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00015 $0.02309
Opus 5.5 $0.00006 $0.00924
Sonnet 5.5 $0.00003 $0.00462
Haiku 4.5 $0.00002 $0.00231

Measured 2mo ago against content hash ca386e6f0718, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

new-chain scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/new-chain.md · 396 lines

How it starts

The opening of the file, as written. The whole thing — 396 lines — stays where its author put it; the contents beside it link to each section on GitHub.

New Chain Command

Create a new LCEL chain file for common patterns.

Workflow

  1. Ask the user which chain type they want:

    • summarization - Summarize documents or text
    • extraction - Extract structured data
    • classification - Classify text into categories
    • translation - Translate between languages
  2. Get filename from argument or ask user (default: chain.py)

  3. Generate the chain file using the appropriate template below

  4. Inform user about customization options

Templates

Summarization Template

"""
Summarization Chain

Install: pip install langchain langchain-openai
"""
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.output_parsers import StrOutputParser
from langchain_openai import ChatOpenAI


def create_summarization_chain(
    model: str = "gpt-4o",
    style: str = "concise",
    max_points: int = 5,
):
    """
    Create a summarization chain.

    Args:
        model: The model to use
        style: Summary style (concise, detailed, bullet_points)
        max_points: Maximum bullet points for bullet_points style
    """
    style_instructions = {
        "concise": "Provide a brief, 2-3 sentence summary.",
        "detailed": "Provide a comprehensive summary covering all main points.",
        "bullet_points": f"Provide a summary as {max_points} bullet points.",
    }

    prompt = ChatPromptTemplate.from_template("""
Summarize the following text.

{style_instruction}

Text:
{text}

Summary:
""")

    llm = ChatOpenAI(model=model, temperature=0)

    chain = (
        prompt.partial(style_instruction=style_instructions.get(style, style_instructions["concise"]))
        | llm
        | StrOutputParser()
    )

    return chain


def main():
    # Create chain
    chain = create_summarization_chain(style="bullet_points", max_points=5)

    # Example usage
    text = """
    Artificial intelligence (AI) is transforming industries across the globe.
    From healthcare to finance, AI applications are improving efficiency and
    enabling new capabilities. Machine learning, a subset of AI, allows systems
    to learn from data without explicit programming. Deep learning, using neural
    networks, has achieved remarkable results in image and speech recognition.
    However, challenges remain around bias, interpretability, and ethical use.
    """

    summary = chain.invoke({"text": text})
    print(summary)


if __name__ == "__main__":
    main()

Read the full file on GitHub · 396 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 396 lines · 15 tokens per session scan A ca386e6f0718

Subscribe to this mod's changes

new-chain is a command published in the GitHub repository Codeblockz/langchain-community-plugin (3 stars, last pushed 9mo ago), licensed Apache-2.0. It adds 15 tokens to every session and 2,309 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

new-chain compared with commands from other repositories

new-chain next to 6 commands from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
new-chainCodeblockz/langchain-community-pluginCommand39mo agoApache-2.0A15Claude Code
expectyonatangross/orchestkitCommand299yesterdayMITA51Claude Code, Cursor
carefulyonatangross/orchestkitCommand299yesterdayMITC84Claude Code, Cursor
pm-roadmapVandanaAjayDubey111/great-pmCommand31mo agoMITA28Claude Code
remembermajor7apps/pensyveCommand99yesterdaynoneA11Claude Code
model-cardHabitat-Thinking/ai-literacy-superpowersCommand12018d agononeA44Claude Code
pm-review-user-01-happyevb87-tech/corpusCommand16mo agoMITA0Claude Code