npx skills add majiayu000/claude-skill-registry --skill langchain-tools-evanfang0054-cc-system-creator-sc --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# langchain-tools (JavaScript/TypeScript) ## 概述 工具是代理可以执行的函数,用于执行获取数据、运行代码或查询数据库等操作。工具具有描述其用途和参数的模式,帮助模型理解何时以及如何使用它们。 **核心概念:** - **tool()**:从函数创建工具的装饰器 - **模式**:定义工具参数的 Zod 模式 - **描述**:帮助模型理解何时使用工具 - **内置工具**:用于常见任务的预制工具 ## 何时定义自定义工具 | 场景 | 创建自定义工具? | 原因 | |----------|---------------------|------| | 特定领域的逻辑 | ✅ 是 | 对您的应用来说是独特的 | | 第三方 API 集成 | ✅ 是 | 需要自定义集成 | | 数据库查询 | ✅ 是 | 您的模式/数据 | | 通用工具(搜索、计算) | ⚠️ 可能 | 先检查现有工具 | | 文件操作 | ⚠️ 可能 | 存在内置文件系统工具 | ## 决策表 ### 工具定义方法 | 方法 | 使用时机 | 示例 | |--------|-------------|---------| | `tool()` 配合函数 | 简单工具 | 基本转换 | | `tool()` 配合模式 | 复杂参数 | 多个类型化字段 | | `StructuredTool` | 完全控制 | 自定义错误处理 | | 内置工具 | 常见操作 | 搜索、代码执行 | ## 代码示例 ### 基本工具定义 ```typescript import { tool } from "langchain"; import { z } from "zod"; // 简单工具 const calculator = tool( async ({ operation, a, b }: { operation: string; a: number; b: number }) => { if (operation === "add") return a + b; if (operation === "multiply") return a * b; throw new Error(`未知操作:${operation}`); }, { name: "calculator", description: "执行数学计算。当您需要计算数字时使用此工具。", schema: z.object({ operation: z.enum(["add", "subtract", "multiply", "divide"]).describe("数学运算"), a: z.number().describe("第一个数字"), b: z.number().describe("第
- 概述
- 何时定义自定义工具
- 决策表
- 工具定义方法
- 代码示例
- 基本工具定义
- 带详细模式的工具
- 异步工具
- 带错误处理的工具
- 带副作用的工具
- 带外部依赖的工具
- 带复杂返回类型的工具
- 带运行时配置的工具
- 多个相关工具
What does the langchain-tools skill do?
在 LangChain 中定义和使用工具 - 包括工具装饰器、自定义工具、内置工具和工具模式
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill langchain-tools-evanfang0054-cc-system-creator-sc --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
