langchain-plugin/skills/langchain-init/SKILL.md
Initialize a new LangChain TypeScript project. Use when starting an LLM-powered app, scaffolding an AI agent project, or setting up LangChain from scratch.
npx skillsauth add laurigates/claude-plugins langchain-initInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Initialize a new LangChain TypeScript project with optimal configuration for building AI agents.
| Use this skill when... | Use a sibling skill instead when... |
|---|---|
| Scaffolding a brand-new LangChain TypeScript project from scratch | Adding LangChain to an existing project — use langchain-development |
| Generating boilerplate, dependencies, and starter config | Building stateful graph workflows — use langgraph-agents |
| Setting up the canonical project layout the other skills assume | Building hierarchical orchestrators — use deep-agents |
Detect the environment:
node --version - Node.js versionwhich bun - Check if Bun is available| Parameter | Description | Default |
|-----------|-------------|---------|
| project-name | Name of the project directory | Required |
mkdir -p $1 && cd $1
If Bun is available:
bun init -y
Otherwise:
npm init -y
Core packages:
# Package manager: bun or npm
bun add langchain @langchain/core @langchain/langgraph
bun add @langchain/openai # Default model provider
# Dev dependencies
bun add -d typescript @types/node tsx
Create tsconfig.json:
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true,
"outDir": "dist",
"declaration": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
mkdir -p src
Create src/agent.ts:
import { ChatOpenAI } from "@langchain/openai";
import { createReactAgent } from "@langchain/langgraph/prebuilt";
import { tool } from "@langchain/core/tools";
import { z } from "zod";
// Example tool
const greetTool = tool(
async ({ name }) => `Hello, ${name}!`,
{
name: "greet",
description: "Greet someone by name",
schema: z.object({
name: z.string().describe("The name to greet"),
}),
}
);
// Create the agent
const model = new ChatOpenAI({
model: "gpt-4o",
temperature: 0,
});
export const agent = createReactAgent({
llm: model,
tools: [greetTool],
});
// Run if executed directly
if (import.meta.url === `file://${process.argv[1]}`) {
const result = await agent.invoke({
messages: [{ role: "user", content: "Say hello to Claude" }],
});
console.log(result.messages[result.messages.length - 1].content);
}
Create .env.example:
# OpenAI (default)
OPENAI_API_KEY=sk-...
# Optional: Anthropic
# ANTHROPIC_API_KEY=sk-ant-...
# Optional: LangSmith tracing
# LANGCHAIN_TRACING_V2=true
# LANGCHAIN_API_KEY=ls__...
# LANGCHAIN_PROJECT=my-project
Add to package.json:
{
"scripts": {
"dev": "tsx watch src/agent.ts",
"start": "tsx src/agent.ts",
"build": "tsc",
"typecheck": "tsc --noEmit"
}
}
node_modules/
dist/
.env
*.log
Display success message with next steps:
.env.example to .env and add API keybun dev or npm run dev to startSuggest installing additional model providers if needed:
@langchain/anthropic for Claude@langchain/google-genai for Geminitesting
Verify accumulated bug claims at upstream HEAD and dedup against trackers before filing issues. Use when filing upstream reports from backlogs, audit docs, or git-history findings.
documentation
Gate outward-bound text (upstream issues, docs, PR bodies) through isolated haiku fresh-reader critique before publishing. Use when an artifact must survive a reader with zero project context.
tools
Suggest improvements to SKILL.md content, descriptions, or tool config from eval results. Use when raising pass rates, fixing triggering, or iterating on a skill after evaluation.
tools
deadbranch CLI for stale-branch cleanup — dry-run preview, TUI or non-interactive delete, protects main/develop/WIP. Use when asked to clean up branches, prune branches, or remove stale branches.