整理文件路径:Technical→AI/
This commit is contained in:
106
raw/Agent/Google-5个Agent-Skill设计模式-2026-03-19.md
Normal file
106
raw/Agent/Google-5个Agent-Skill设计模式-2026-03-19.md
Normal file
@@ -0,0 +1,106 @@
|
||||
---
|
||||
title: 继Anthropic后,Google放出5个常用的Agent Skill设计模式
|
||||
source:
|
||||
author: shenwei
|
||||
published:
|
||||
created:
|
||||
description:
|
||||
tags: []
|
||||
---
|
||||
|
||||
# 继Anthropic后,Google放出5个常用的Agent Skill设计模式
|
||||
|
||||
**作者:** winkrun
|
||||
**来源:** https://mp.weixin.qq.com/s/yu120tW0l4DJAJfWmbJYxg
|
||||
**公众号:** AI工程化
|
||||
**日期:** 2026年3月19日 06:12
|
||||
**标签:** Agent、Skill、设计模式、Google、Anthropic
|
||||
|
||||
---
|
||||
|
||||
如果你也在写Agent Skills,应该会发现一个尴尬的事实:SKILL.md的格式已经标准化了,三十多个主流工具(Claude Code、Gemini CLI、Cursor……)都支持同一种写法。格式不再是问题,但很多人写着写着就发现——同样格式的skill,执行效果天差地别。
|
||||
|
||||
问题出在内容设计上。同样是一个skill,包装FastAPI规范和实现一个四步文档流水线,内部的逻辑结构完全不同,但外在看起来一模一样。Google Cloud最新发布的这份指南,由Saboo_Shubham_和lavinigam撰写,就是专门解决这个问题的。
|
||||
|
||||
这份指南总结了**五种经过验证的设计模式**,每种都有完整的ADK代码示例。
|
||||
|
||||
---
|
||||
|
||||
## Tool Wrapper:让agent快速成为某个领域的专家
|
||||
|
||||
这是最容易上手的模式。简单说,就是把某个库或框架的规范文档打包成一个skill,agent只有在真正用到这个技术时才会加载相关文档。
|
||||
|
||||
比如一个写FastAPI的skill,不需要把所有的API约定都塞进system prompt,而是让SKILL.md监听特定的库关键词,当用户开始写FastAPI代码时才动态加载references/目录下的conventions.md,把这些规则当作绝对真理来执行。
|
||||
|
||||
这特别适合分发团队内部的编码规范或者特定框架的最佳实践。
|
||||
|
||||
---
|
||||
|
||||
## Generator:从模板生成结构化输出
|
||||
|
||||
如果Tool Wrapper是应用知识,Generator则是强制一致的输出格式。很多agent每次运行生成的文档结构都不一样,Generator通过一个"填空"流程解决这个问题。
|
||||
|
||||
它利用两个可选目录:assets/存放输出模板,references/存放样式指南。SKILL.md扮演项目经理的角色,指示agent加载模板、读取样式指南、向用户询问缺失的变量、然后填充文档。
|
||||
|
||||
这对于生成统一的API文档、标准化commit信息或者脚手架项目结构都非常实用。
|
||||
|
||||
---
|
||||
|
||||
## Reviewer:把检查清单和检查逻辑分开
|
||||
|
||||
非常实用的模式之一。传统的代码审查会把所有规则都写进system prompt,结果越写越长。Reviewer模式把"检查什么"和"怎么检查"完全分开。
|
||||
|
||||
审查标准存放在references/review-checklist.md里,可以是Python风格检查,也可以换成OWASP安全检查——同样的skill基础设施,换个清单就是完全不同的专项审计。
|
||||
|
||||
代码示例展示了一个Python代码审查skill的结构。指令保持静态,但agent会动态加载特定的审查标准,并强制输出按严重程度分组的结构化结果。
|
||||
|
||||
---
|
||||
|
||||
## Inversion:agent先问你再做
|
||||
|
||||
这是最反直觉的模式。Agent天生喜欢直接猜测和生成,Inversion把这个流程完全反过来——agent变成面试官,先问你一系列问题,等你回答完再行动。
|
||||
|
||||
关键在于明确、不可协商的门控指令(比如"不到所有阶段完成就不开始构建")。Agent会逐个阶段提问,等待你的答案,然后才进入下一个阶段。
|
||||
|
||||
一个项目规划skill的示例展示了这一点:必须等用户回答完所有问题,agent才会加载plan-template.md并生成最终计划。
|
||||
|
||||
---
|
||||
|
||||
## Pipeline:带硬性检查点的严格工作流
|
||||
|
||||
对于复杂任务,你承受不起跳过步骤或者忽略指令的情况。Pipeline模式强制执行严格的顺序工作流,并在关键节点设置硬性检查点。
|
||||
|
||||
指令本身定义了工作流。通过实现明确的门控条件(比如要求用户在进入下一步之前确认生成的文档字符串),Pipeline确保agent无法绕过复杂任务直接给出未验证的最终结果。
|
||||
|
||||
一个文档流水线的例子展示了四个步骤:解析和清点、生成文档字符串、组装文档、质量检查。每一步都有明确的前置条件,用户必须在进入下一步之前确认。
|
||||
|
||||
---
|
||||
|
||||
## 选择合适的模式
|
||||
|
||||
每个模型都有其应用场景,可以根据下图来判断使用合适的模式。
|
||||
|
||||
---
|
||||
|
||||
## 这些模式可以组合使用
|
||||
|
||||
这是容易被忽视的一点。这五种模式并非互斥,而是可以组合。Pipeline可以在最后包含一个Reviewer步骤来 double-check 自己的成果;Generator可以在最开始依赖Inversion来收集必要的变量。
|
||||
|
||||
多亏了ADK的SkillToolset和渐进式披露机制,agent只在运行时需要时才消耗上下文token来加载特定的模式。
|
||||
|
||||
别再把所有复杂又脆弱的指令塞进一个system prompt了。把工作流拆分开,应用正确的结构模式,才能构建出真正可靠的agent。
|
||||
|
||||
---
|
||||
|
||||
## 相关链接
|
||||
|
||||
- 原文:https://x.com/i/article/2033941492633362432
|
||||
- awesome-agent-skills:https://github.com/skillmatic-ai/awesome-agent-skills
|
||||
|
||||
---
|
||||
|
||||
## 附录:Anthropic 的 Skill 实践
|
||||
|
||||
> Anthropic 把内部几百个 Skills 用了个遍,发现最好的 Skill 不是写得好的提示词,而是一个「工具箱」。他们把 Skills 分成九类,从参考手册到故障排查,每类都有明确的场景。写好 Skill 的三条铁律:只写 Agent 不知道的东西、重点写踩坑清单、给工具不给指令。
|
||||
|
||||
- Anthropic工程师分享的Claude Code技能设计指南:9种类型与实战技巧 https://wink.run/pings/content/111668?from=wx
|
||||
78
raw/Agent/MCP在Cursor中的集成与应用详解.md
Normal file
78
raw/Agent/MCP在Cursor中的集成与应用详解.md
Normal file
@@ -0,0 +1,78 @@
|
||||
---
|
||||
title:
|
||||
source:
|
||||
author: shenwei
|
||||
published:
|
||||
created:
|
||||
description:
|
||||
tags: [ai, ai-agent, cursor, mcp]
|
||||
---
|
||||
|
||||
|
||||
#ai #mcp #cursor #ai-agent
|
||||
|
||||
## MCP在Cursor中的集成与应用详解🛠️
|
||||
|
||||
### 视频概述🌟
|
||||
本视频由鱼凤老师带来,围绕如何在Cursor中集成和使用MCP(Modal Context Protocol)展开讲解。视频首先介绍了MCP的定义、架构及其功能,随后结合实操演示了如何配置Cursor以接入MCP服务,重点讲解了命令行与服务端模式的差异及配置技巧。通过对热点新闻服务和序列化思考(Sequential Thinking)工具的实例展示,讲解了MCP工具链调用的实际效果及优势。视频风格通俗易懂,配合实例贯穿讲解,强调理解MCP架构及其在AI大模型对话中的应用。
|
||||
|
||||
### 核心知识点总结📚
|
||||
- **00:00 - 01:18 MCP定义与架构介绍**
|
||||
MCP是Modal Context Protocol的缩写,是一种基于Client-Server架构的协议,旨在实现大模型与外围服务的高效集成。MCP Server提供三种功能接口:资源获取(类似HTTP的GET)、工具调用(类似POST请求)、以及Promise提示词,用于多样化的交互与扩展。
|
||||
- **01:18 - 02:17 MCP热点新闻服务实例**
|
||||
介绍了smisery网站的热点新闻MCP Server,支持九个新闻来源。演示如何生成集成命令,将多个新闻来源一次性集成到Cursor中,为后续调用提供数据源接口。
|
||||
- **02:17 - 04:41 Cursor中新版及MCP配置流程**
|
||||
讲解如何下载支持MCP功能的Cursor最新版,并在Cursor设置中新增MCP Server。介绍两种接入方式:SSE服务方式和本地执行命令(command)方式。演示粘贴命令并处理“no tools found”错误的调试过程,强调社区尚在完善阶段及网络访问限制可能导致的问题。
|
||||
- **04:41 - 07:10 使用Composer的Agent模式调用MCP**
|
||||
展示在Cursor的Composer模块如何切换到Agent模式,使用MCP Server的工具链调用,自动执行命令并返回结果。介绍Agent模式与Normal模式的区别,强调Agent模式实现命令的链路打通,减少手动操作的步骤。并介绍“enable yolo mode”自动执行命令的功能及潜在风险,建议推荐用户谨慎使用。
|
||||
- **07:10 - 10:36 MCP Sequential Thinking工具应用**
|
||||
介绍了“Sequential Thinking”工具,强调其逻辑推理分步拆解任务的特点,能够提升AI沟通效率。演示了通过提示词触发该工具,工具与热点新闻服务相互调用、协同工作,最终返回处理后的精准结果。分析说明该工具受欢迎的原因及实际应用场景。
|
||||
- **10:36 - 11:04 视频总结**
|
||||
视频结尾简要总结,感谢观看,鼓励学习者掌握MCP的使用思路。
|
||||
|
||||
### 关键术语及定义📖
|
||||
- **MCP (Modal Context Protocol)**:一种协议,支持AI大模型与外围服务基于Client-Server架构进行高效的数据和工具接口交互。
|
||||
- **Server (服务端)**:MCP协议体系中的服务提供方,负责对外提供资源和工具接口。
|
||||
- **Client (客户端)**:MCP协议体系中的服务调用方,通常指集成了MCP的应用程序或大模型对话客户端。
|
||||
- **SSE (Server-Sent Events)**:一种服务器向客户端推送实时事件的技术,这里指一种MCP接入方式。
|
||||
- **Command (命令行方式)**:通过本地执行命令的方式与MCP Server交互,适用于命令驱动的接口调用。
|
||||
- **Composer**:Cursor中的一个对话构建模块,支持Agent模式与Normal模式两种交互模式。
|
||||
- **Agent模式**:Cursor中的交互方式,自动执行内嵌命令并处理工具调用,提升用户体验和操作效率。
|
||||
- **Sequential Thinking**:MCP工具之一,支持逻辑推理与分步执行任务,优化AI模型的思考与响应过程。
|
||||
|
||||
### 推理结构🧠
|
||||
1. **需求提出 →** 需要实现大模型与外围工具服务无缝集成。
|
||||
2. **协议设计 →** MCP基于CS架构,定义资源访问(GET)、工具调用(POST)、提示词三种接口。
|
||||
3. **系统实现 →** 通过MCP Server与Client实现功能开放与调用。
|
||||
4. **集成流程 →** 在Cursor新增MCP Server配置,用命令行或SSE接入MCP服务。
|
||||
5. **使用流程 →** 在Composer中打开Agent模式,执行MCP工具链,自动触发并完成任务。
|
||||
6. **优化建议 →** 开启“enable yolo mode”风险较高,建议默认关闭以避免误操作。
|
||||
|
||||
### 典型案例📊
|
||||
- **热点新闻服务集成**:将九个新闻来源接入Cursor,通过MCP即时调用获取最新新闻,实现了大模型对外部数据源的实时访问。
|
||||
- **Sequential Thinking应用示例**:演示模型通过逐步逻辑拆解,实现复杂任务的系统思考,工具链间互相调用彰显协同能力,提升AI决策质量和效率。
|
||||
|
||||
### 易错点提醒⚠️
|
||||
- **无工具发现(No tools found)错误**:可能因MCP服务路径填写不正确或网络代理问题导致,解决方案是直接填写MCP原始地址,绕过代理层。
|
||||
- **自动执行命令风险**:enable yolo mode开启后会自动执行所有命令,可能造成误操作如误删文件,官方默认关闭,建议用户谨慎选择。
|
||||
- **Agent模式与Normal模式混淆**:Agent模式能实现自动运行工具命令,Normal模式需要用户手动复制命令执行,理解区别尤为关键。
|
||||
|
||||
### 复习要点与测试题🎓
|
||||
- **复习要点(无答案)**
|
||||
1. MCP协议包含哪三种核心功能接口?
|
||||
2. Cursor中如何新增一个MCP Server?
|
||||
3. Agent模式与Normal模式的最大区别是什么?
|
||||
4. 为什么建议默认关闭“enable yolo mode”?
|
||||
|
||||
- **自测练习(含答案)**
|
||||
1. 什么是MCP?它的作用是?
|
||||
- 答:Modal Context Protocol,基于CS架构的协议,用于AI大模型与外围工具的集成交互。
|
||||
2. MCP Server提供哪三类功能?
|
||||
- 答:资源读取(GET接口)、工具调用(POST接口)、Promise提示词。
|
||||
3. 在Cursor中,MCP Server接入方式有哪些?
|
||||
- 答:通过SSE服务和本地Command两种方式。
|
||||
4. 如何判断Cursor当前处于Agent模式?
|
||||
- 答:对话界面下方会显示“agent”标识。
|
||||
|
||||
### 总结回顾🔍
|
||||
本视频系统讲解了MCP协议的核心理念及其在Cursor中的集成方法。通过详细的配置教程和案例演示,清晰展示了如何实现大模型与多样外部工具的无缝链接,提升AI应用的扩展能力和交互效率。重点说明了Agent模式的优势及风险管理,帮助用户快速上手MCP生态。掌握这些内容,有助于深入理解和运用现代大模型与服务集成的最新技术。
|
||||
37
raw/Agent/n8n configure telegram trigger.md
Normal file
37
raw/Agent/n8n configure telegram trigger.md
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
title:
|
||||
source:
|
||||
author: shenwei
|
||||
published:
|
||||
created:
|
||||
description:
|
||||
tags: [n8n, telegram]
|
||||
---
|
||||
|
||||
|
||||
#n8n #telegram
|
||||
## Summary:
|
||||
- When I configure Telegram Trigger, I got an error message: **Telegram Trigger: Bad Request: bad webhook: An HTTPS URL must be provided for webhook**
|
||||
- I search ChatGPT and got solved by this solution:
|
||||
- **Steps to Resolve:**
|
||||
|
||||
1. **Ensure HTTPS Accessibility:**
|
||||
|
||||
- Verify that your **n8n** instance is accessible via an HTTPS URL. If you're running **n8n** locally or without HTTPS, Telegram's webhook setup will fail.
|
||||
2. **Configure Environment Variables:**
|
||||
|
||||
- Set the `WEBHOOK_URL` environment variable to your HTTPS URL. For example:
|
||||
|
||||
ini
|
||||
|
||||
CopyEdit
|
||||
|
||||
`WEBHOOK_URL=https://your-domain.com/`
|
||||
|
||||
- This informs **n8n** to generate webhook URLs using HTTPS.
|
||||
|
||||
I added environment variable in Docker Desktop:
|
||||
WEBHOOK_URL https://n8n.cpolar.top
|
||||
|
||||
After then to check the webhook URL in Telegram Trigger:
|
||||

|
||||
193
raw/Agent/n8n docker install & update.md
Normal file
193
raw/Agent/n8n docker install & update.md
Normal file
@@ -0,0 +1,193 @@
|
||||
|
||||
#n8n #docker #workflow
|
||||
|
||||
|
||||
|
||||
## n8n Docker install
|
||||
### n8n Docker Compose file
|
||||
``` bash
|
||||
cd /home/shenwei/Docker/n8n
|
||||
```
|
||||
|
||||
create **docker-compose.yml** file
|
||||
``` yaml
|
||||
|
||||
version: '3.8'
|
||||
services:
|
||||
n8n:
|
||||
build: .
|
||||
image: docker.n8n.io/n8nio/n8n
|
||||
container_name: n8n
|
||||
ports:
|
||||
- "5678:5678" # 只绑定到本地,通过 Caddy 访问
|
||||
volumes:
|
||||
- n8n_data:/home/node/.n8n
|
||||
environment:
|
||||
- N8N_PROTOCOL=https
|
||||
- N8N_HOST=n8n.ishenwei.online
|
||||
- WEBHOOK_URL=https://n8n.ishenwei.online/
|
||||
- N8N_TRUST_PROXY=true
|
||||
- N8N_SECURE_COOKIE=true # 建议设为 true,因为使用 HTTPS
|
||||
- N8N_PROXY_HOPS=1
|
||||
- ALL_PROXY=socks5://172.21.0.1:10808 #配置容器内网络代理
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
n8n_data:
|
||||
|
||||
networks:
|
||||
n8n_default:
|
||||
external: true
|
||||
|
||||
```
|
||||
|
||||
Dockerfile
|
||||
```
|
||||
FROM n8nio/n8n:latest
|
||||
USER root
|
||||
|
||||
# 安装 curl 和 wget
|
||||
RUN apk update && apk add --no-cache curl wget
|
||||
|
||||
USER node
|
||||
```
|
||||
|
||||
### Updating Docker Compose
|
||||
[Doc](https://docs.n8n.io/hosting/installation/docker/#updating-docker-compose "Permanent link")
|
||||
|
||||
If you run n8n using a Docker Compose file, follow these steps to update n8n:
|
||||
|
||||
``` bash---
|
||||
title: 安装 curl 和 wget
|
||||
author: shenwei
|
||||
tags: [docker, n8n, workflow]
|
||||
---
|
||||
---
|
||||
title: 安装 curl 和 wget
|
||||
source:
|
||||
author: shenwei
|
||||
published:
|
||||
created:
|
||||
description:
|
||||
tags: [docker, n8n, workflow]
|
||||
---
|
||||
|
||||
# Navigate to the directory containing your docker compose file
|
||||
cd </path/to/your/compose/file/directory>
|
||||
|
||||
# Pull latest version
|
||||
docker compose pull
|
||||
|
||||
# Stop and remove older version
|
||||
docker compose down
|
||||
|
||||
# Start the container
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
### Config n8n network proxy
|
||||
|
||||
#### 1️⃣ 前提条件
|
||||
|
||||
1. V2Ray/Tuic 已安装在宿主机并正常运行。
|
||||
2. V2Ray/Tuic 配置中 **本地监听地址改为 `0.0.0.0`**,端口假设为 `10808`:
|
||||
在V2rayN GUI里需要打开如下配置:
|
||||
![[IMG-20251230094029556.png]]
|
||||
|
||||
3. Docker 网络 `n8n_default` 已存在(由 docker-compose 自动创建即可)
|
||||
4. 宿主机防火墙允许 Docker 网桥访问代理端口:
|
||||
```
|
||||
sudo ufw allow from 172.18.0.0/16 to any port 10808
|
||||
```
|
||||
#### 2️⃣ Dockerfile(扩展官方 n8n 镜像,安装 curl/wget)
|
||||
|
||||
创建 `Dockerfile`:
|
||||
``` bash
|
||||
FROM n8nio/n8n:latest
|
||||
|
||||
USER root
|
||||
|
||||
# 安装 curl 和 wget
|
||||
RUN apk update && apk add --no-cache curl wget
|
||||
|
||||
USER node
|
||||
```
|
||||
- 保持 n8n 默认用户 `node`,安全性高。
|
||||
- 容器内可以直接使用 `curl`、`wget` 测试代理。
|
||||
|
||||
---
|
||||
#### 3️⃣ docker-compose.yml 示例
|
||||
``` yaml
|
||||
|
||||
version: '3.8'
|
||||
services:
|
||||
n8n:
|
||||
build: .
|
||||
image: docker.n8n.io/n8nio/n8n
|
||||
container_name: n8n
|
||||
ports:
|
||||
- "5678:5678" # 只绑定到本地,通过 Caddy 访问
|
||||
volumes:
|
||||
- n8n_data:/home/node/.n8n
|
||||
environment:
|
||||
- N8N_PROTOCOL=https
|
||||
- N8N_HOST=n8n.ishenwei.online
|
||||
- WEBHOOK_URL=https://n8n.ishenwei.online/
|
||||
- N8N_TRUST_PROXY=true
|
||||
- N8N_SECURE_COOKIE=true # 建议设为 true,因为使用 HTTPS
|
||||
- N8N_PROXY_HOPS=1
|
||||
- ALL_PROXY=socks5://172.21.0.1:10808 #配置容器内网络代理
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
n8n_data:
|
||||
|
||||
networks:
|
||||
n8n_default:
|
||||
external: true
|
||||
```
|
||||
|
||||
说明:
|
||||
|
||||
- `ALL_PROXY` 指向宿主机 Docker 网桥 IP + Tuic SOCKS5 端口
|
||||
- 容器内 HTTP/HTTPS 流量和 n8n 请求都会走 SOCKS5
|
||||
- 端口 5678 映射宿主机,便于访问 n8n UI
|
||||
|
||||
> [!注意]
|
||||
注意:`172.21.0.1` 需替换为以下命令输出的网桥 IP(Gateway)。
|
||||
``` bash
|
||||
|
||||
docker network inspect n8n_default
|
||||
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### 4️⃣ 在容器内测试科学上网
|
||||
|
||||
进入容器:
|
||||
```
|
||||
docker exec -it n8n /bin/sh
|
||||
```
|
||||
测试:
|
||||
```
|
||||
# 测试 IP
|
||||
curl --socks5 172.18.0.1:10808 https://ifconfig.me
|
||||
|
||||
# 或者使用全局代理环境变量
|
||||
curl https://ifconfig.me
|
||||
wget -qO- https://ifconfig.me
|
||||
```
|
||||
|
||||
如果返回国外 IP,说明代理生效。
|
||||
|
||||
---
|
||||
#### 5️⃣ 可选优化
|
||||
|
||||
- **Dockerfile 内设置环境变量**:可直接在镜像内定义 `ALL_PROXY`,启动容器无需手动设置。
|
||||
- **安全防护**:宿主机防火墙限制仅 Docker 网桥访问 10808,避免局域网被访问。
|
||||
- **升级 n8n**:定期 rebuild 镜像即可。
|
||||
|
||||
## Reference
|
||||
|
||||
[[n8n configure telegram trigger|n8n configure telegram trigger]]
|
||||
@@ -0,0 +1,47 @@
|
||||
---
|
||||
title: N8N Full Tutorial Building AI Agents in 2025 for Beginners!
|
||||
source: https://www.youtube.com/watch?v=ZbIVOy_GPyQ&t=12s
|
||||
author: shenwei
|
||||
published:
|
||||
created: 2025-03-06
|
||||
description:
|
||||
tags: [ai, ai-agent, n8n, tutorial]
|
||||
link:
|
||||
kanban-plugin:
|
||||
aliases:
|
||||
cssclasses:
|
||||
---
|
||||
|
||||
|
||||
#n8n #ai #ai-agent #tutorial
|
||||
|
||||
**Summary**
|
||||
|
||||
In this comprehensive tutorial, the speaker provides a detailed guide on building AI agents using the N8N platform, aimed primarily at beginners. The video begins by defining agentic systems, explaining the distinction between workflows and agents. Workflows are predefined automations that yield consistent outputs, while agents utilize large language models (LLMs) to dynamically determine the necessary tools and outputs based on user input. The tutorial then introduces N8N’s user interface, focusing on creating workflows and utilizing various node types. The speaker emphasizes the significance of understanding node categories—triggers, action nodes, utility nodes, code nodes, and advanced AI agent nodes—in building effective AI agents. Moving through the steps, the tutorial illustrates how to add tools, manage memory for context retention, and interact with databases like Airtable for inventory management. The video culminates with a call to join the AI Foundations community for further learning and collaboration, highlighting the value of community engagement in mastering AI technologies.
|
||||
|
||||
**Highlights**
|
||||
🤖 Understanding Agentic Systems: Agentic systems consist of agents and workflows, where agents dynamically select tools for user requests.
|
||||
🎛️ Creating Workflows in N8N: The N8N interface is intuitive, allowing users to create workflows easily by choosing triggers and actions.
|
||||
🔑 Node Types Explained: The five categories of nodes (trigger, action, utility, code, and advanced AI) are crucial for building robust automations.
|
||||
💡 Dynamic Memory Usage: Incorporating memory into agents allows for context retention, enhancing user interaction and conversation flow.
|
||||
📊 Integrating Airtable: Using Airtable as a tool enables agents to manage inventory seamlessly, responding to user queries and updates effectively.
|
||||
🌐 Community Learning: Joining the AI Foundations community offers additional resources, courses, and opportunities for collaboration among AI enthusiasts.
|
||||
🎓 Advanced Techniques: The tutorial hints at more complex functionalities, including chaining workflows and utilizing multiple agents for sophisticated automation systems.
|
||||
|
||||
**Key Insights**
|
||||
|
||||
🌍 Agentic Systems Are Essential: Understanding agentic systems is crucial for modern automation. They combine the predictability of workflows with the flexibility of agents, enabling systems that can adapt to user needs dynamically. This adaptability is vital for applications requiring user interaction, such as customer support and personalized services.
|
||||
|
||||
📈 N8N’s User-Friendly Interface: The N8N platform is designed for ease of use, offering a visual interface that simplifies the workflow creation process. The ability to categorize nodes enhances user experience, making it accessible even for beginners. This user-centric design reduces the learning curve associated with complex automation tasks.
|
||||
|
||||
🔍 Importance of Node Types: The categorization of nodes into triggers, actions, utilities, codes, and advanced AI nodes allows for structured and efficient automation. Each node type serves a distinct function, and understanding these roles is crucial in designing effective workflows that meet specific needs.
|
||||
|
||||
🧠 Contextual Memory Enhances Interaction: Implementing memory within AI agents is a game-changer for user interaction. By retaining context from previous interactions, agents can provide more coherent and relevant responses. This capability significantly improves user satisfaction and engagement, making conversations feel more natural.
|
||||
|
||||
🔗 Tool Integration is Key: Integrating external tools like Airtable into the N8N workflows vastly expands the capabilities of AI agents. By allowing agents to pull and update data from databases, users can manage resources efficiently, turning the agent into a powerful tool for real-world applications.
|
||||
|
||||
👥 Community Engagement Accelerates Learning: The AI Foundations community serves as a valuable resource for individuals looking to deepen their knowledge of AI and automation. Collaboration and shared learning experiences within a community can enhance understanding and foster innovation, making it a cornerstone for aspiring AI developers.
|
||||
|
||||
🚀 Potential for Advanced Applications: The tutorial foreshadows the potential for building complex systems by combining multiple agents and workflows. As users become more comfortable with the basics, they can explore advanced techniques, such as chaining workflows, to create highly sophisticated automation solutions that address diverse use cases.
|
||||
|
||||
In conclusion, the video tutorial serves
|
||||
21
raw/Agent/n8n+Claude 通过自然语言自动化工作流.md
Normal file
21
raw/Agent/n8n+Claude 通过自然语言自动化工作流.md
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
title: 安装Claude Desktop
|
||||
source:
|
||||
author: shenwei
|
||||
published:
|
||||
created:
|
||||
description:
|
||||
tags: [claude, n8n, nodjs]
|
||||
---
|
||||
|
||||
|
||||
#nodjs #n8n #claude
|
||||
|
||||
```table-of-contents
|
||||
```
|
||||
|
||||
|
||||
# 安装Claude Desktop
|
||||
https://claude.com/download
|
||||
|
||||
|
||||
217
raw/Agent/使用Claude自动生成N8N工作流的实操教程.md
Normal file
217
raw/Agent/使用Claude自动生成N8N工作流的实操教程.md
Normal file
@@ -0,0 +1,217 @@
|
||||
|
||||
```table-of-contents
|
||||
```
|
||||
# 标题:使用Claude自动生成N8N工作流的实操教程
|
||||
|
||||
## 概述📚
|
||||
本视频主要介绍如何借助AI助手Claude自动创建n8n工作流,解决新手在架构设计和节点选择中遇到的困惑。作者从零开始手把手演示环境搭建、配置连接、输入提示词,让Claude根据指令自动为我们完成复杂的工作流设计和代码生成,极大提高制作效率。视频内容通俗易懂,重点突出自动化流程创建的实用技巧,适合无编码基础的N8N初学者。
|
||||
|
||||
## Youtube
|
||||
https://www.youtube.com/watch?v=AosTiLQaZc4
|
||||
|
||||
## 核心知识点总结⏰
|
||||
|
||||
### n8n工作流创建难点及Claude介入**
|
||||
新手在建立N8N工作流时常常无从下手,不晓得节点使用和架构设计。作者介绍了一个开源的N8N MCP(多功能控制面板)项目,可嫁接到Claude,通过输入自然语言提示直接生成工作流,免去繁琐操作。
|
||||
|
||||
### n8n-mcp 项目
|
||||
https://github.com/czlonkowski/n8n-mcp
|
||||
n8n-MCP serves as a bridge between n8n's workflow automation platform and AI models, enabling them to understand and work with n8n nodes effectively. It provides structured access to:
|
||||
|
||||
- 📚 **543 n8n nodes** from both n8n-nodes-base and @n8n/n8n-nodes-langchain
|
||||
- 🔧 **Node properties** - 99% coverage with detailed schemas
|
||||
- ⚡ **Node operations** - 63.6% coverage of available actions
|
||||
- 📄 **Documentation** - 87% coverage from official n8n docs (including AI nodes)
|
||||
- 🤖 **AI tools** - 271 AI-capable nodes detected with full documentation
|
||||
- 💡 **Real-world examples** - 2,646 pre-extracted configurations from popular templates
|
||||
- 🎯 **Template library** - 2,709 workflow templates with 100% metadata coverage
|
||||
|
||||
### 环境搭建:Node.js安装与启动n8n-mcp**
|
||||
演示如何下载Node.js安装包(根据操作系统选择),并在Windows的Terminal中运行命令完成安装,确保环境支持后续工作流自动化操作。
|
||||
#### 安装node.js
|
||||
https://nodejs.org/en/download
|
||||
|
||||
``` shell---
|
||||
title: 标题:使用Claude自动生成N8N工作流的实操教程
|
||||
author: shenwei
|
||||
---
|
||||
---
|
||||
title: 标题:使用Claude自动生成N8N工作流的实操教程
|
||||
source:
|
||||
author: shenwei
|
||||
published:
|
||||
created:
|
||||
description:
|
||||
tags: []
|
||||
---
|
||||
|
||||
# Docker has specific installation instructions for each operating system.
|
||||
# Please refer to the official documentation at https://docker.com/get-started/
|
||||
|
||||
# Pull the Node.js Docker image:
|
||||
docker pull node:24-alpine
|
||||
|
||||
# Create a Node.js container and start a Shell session:
|
||||
docker run -it --rm --entrypoint sh node:24-alpine
|
||||
|
||||
# Verify the Node.js version:
|
||||
node -v # Should print "v24.12.0".
|
||||
|
||||
# Verify npm version:
|
||||
npm -v # Should print "11.6.2".
|
||||
|
||||
```
|
||||
|
||||
#### 启动n8n-mcp
|
||||
|
||||
在之前node.js的terminal里直接输入以下命令
|
||||
|
||||
``` shell
|
||||
# Run directly with npx (no installation needed!)
|
||||
npx n8n-mcp
|
||||
```
|
||||
|
||||
看到以下log,说明安装成功:
|
||||
```
|
||||
/ # npx n8n-mcp
|
||||
Need to install the following packages:
|
||||
n8n-mcp@2.31.3
|
||||
Ok to proceed? (y) y
|
||||
|
||||
|
||||
╔════════════════════════════════════════════════════════════╗
|
||||
║ Anonymous Usage Statistics ║
|
||||
╠════════════════════════════════════════════════════════════╣
|
||||
║ ║
|
||||
║ n8n-mcp collects anonymous usage data to improve the ║
|
||||
║ tool and understand how it's being used. ║
|
||||
║ ║
|
||||
║ We track: ║
|
||||
║ • Which MCP tools are used (no parameters) ║
|
||||
║ • Workflow structures (sanitized, no sensitive data) ║
|
||||
║ • Error patterns (hashed, no details) ║
|
||||
║ • Performance metrics (timing, success rates) ║
|
||||
║ ║
|
||||
║ We NEVER collect: ║
|
||||
║ • URLs, API keys, or credentials ║
|
||||
║ • Workflow content or actual data ║
|
||||
║ • Personal or identifiable information ║
|
||||
║ • n8n instance details or locations ║
|
||||
║ ║
|
||||
║ Your anonymous ID: 17c0ba5830754999 ║
|
||||
║ ║
|
||||
║ This helps me understand usage patterns and improve ║
|
||||
║ n8n-mcp for everyone. Thank you for your support! ║
|
||||
║ ║
|
||||
║ To opt-out at any time: ║
|
||||
║ npx n8n-mcp telemetry disable ║
|
||||
║ ║
|
||||
║ Data deletion requests: ║
|
||||
║ Email romuald@n8n-mcp.com with your anonymous ID ║
|
||||
║ ║
|
||||
║ Learn more: ║
|
||||
║ https://github.com/czlonkowski/n8n-mcp/blob/main/PRIVACY.md ║
|
||||
║ ║
|
||||
╚════════════════════════════════════════════════════════════╝
|
||||
|
||||
[2025-12-31T05:40:02.650Z] [n8n-mcp] [INFO] Node.js version: v24.12.0
|
||||
[2025-12-31T05:40:02.650Z] [n8n-mcp] [INFO] Platform: linux x64
|
||||
[2025-12-31T05:40:02.650Z] [n8n-mcp] [INFO] Attempting to use better-sqlite3...
|
||||
[2025-12-31T05:40:02.651Z] [n8n-mcp] [INFO] Initializing n8n Documentation MCP server
|
||||
[2025-12-31T05:40:02.652Z] [n8n-mcp] [WARN] Failed to initialize better-sqlite3, falling back to sql.js Error: Failed to create better-sqlite3 adapter: Error: Cannot find module 'better-sqlite3'
|
||||
Require stack:
|
||||
- /root/.npm/_npx/b6a381d62ce0fe56/node_modules/n8n-mcp/dist/database/database-adapter.js
|
||||
- /root/.npm/_npx/b6a381d62ce0fe56/node_modules/n8n-mcp/dist/mcp/server.js
|
||||
- /root/.npm/_npx/b6a381d62ce0fe56/node_modules/n8n-mcp/dist/mcp/index.js
|
||||
at createBetterSQLiteAdapter (/root/.npm/_npx/b6a381d62ce0fe56/node_modules/n8n-mcp/dist/database/database-adapter.js:96:15)
|
||||
at createDatabaseAdapter (/root/.npm/_npx/b6a381d62ce0fe56/node_modules/n8n-mcp/dist/database/database-adapter.js:55:31)
|
||||
at N8NDocumentationMCPServer.initializeDatabase (/root/.npm/_npx/b6a381d62ce0fe56/node_modules/n8n-mcp/dist/mcp/server.js:180:74)
|
||||
at new N8NDocumentationMCPServer (/root/.npm/_npx/b6a381d62ce0fe56/node_modules/n8n-mcp/dist/mcp/server.js:109:33)
|
||||
at main (/root/.npm/_npx/b6a381d62ce0fe56/node_modules/n8n-mcp/dist/mcp/index.js:143:32)
|
||||
at Object.<anonymous> (/root/.npm/_npx/b6a381d62ce0fe56/node_modules/n8n-mcp/dist/mcp/index.js:217:5)
|
||||
at Module._compile (node:internal/modules/cjs/loader:1761:14)
|
||||
at Object..js (node:internal/modules/cjs/loader:1893:10)
|
||||
at Module.load (node:internal/modules/cjs/loader:1481:32)
|
||||
at Module._load (node:internal/modules/cjs/loader:1300:12)
|
||||
[2025-12-31T05:40:02.854Z] [n8n-mcp] [INFO] Loaded existing database from /root/.npm/_npx/b6a381d62ce0fe56/node_modules/n8n-mcp/data/nodes.db
|
||||
[2025-12-31T05:40:02.855Z] [n8n-mcp] [INFO] Successfully initialized sql.js adapter (pure JavaScript, no native dependencies)
|
||||
[2025-12-31T05:40:02.885Z] [n8n-mcp] [INFO] FTS5 not available, using LIKE search for templates
|
||||
[2025-12-31T05:40:02.886Z] [n8n-mcp] [INFO] Database initialized successfully from: /root/.npm/_npx/b6a381d62ce0fe56/node_modules/n8n-mcp/data/nodes.db
|
||||
[2025-12-31T05:40:02.887Z] [n8n-mcp] [INFO] MCP server initialized with 7 tools (n8n API: not configured)
|
||||
[2025-12-31T05:40:02.891Z] [n8n-mcp] [WARN] FTS5 not available - using fallback search. For better performance, ensure better-sqlite3 is properly installed.
|
||||
[2025-12-31T05:40:02.891Z] [n8n-mcp] [INFO] Database health check passed: 802 nodes loaded
|
||||
[2025-12-31T05:40:02.892Z] [n8n-mcp] [INFO] n8n Documentation MCP Server running on stdio transport
|
||||
[2025-12-31T05:40:02.892Z] [n8n-mcp] [INFO] Server startup completed in 246ms (6 checkpoints passed)
|
||||
```
|
||||
|
||||
#### Claude客户端下载安装及开发者配置**
|
||||
指导下载安装Claude桌面版,进入“Developer”设置页编辑配置文件,将N8N服务地址和API密钥填入,确保Claude连接N8N MCP功能正常。
|
||||
[[🟠如何用指纹浏览器安全注册并订阅Claude Pro会员全攻略]]
|
||||
#### 高级prompt配置与项目初始化**
|
||||
介绍用于指导Claude理解N8N所有功能的复杂prompt,粘贴到Claude项目的指令区,激活39个集成工具,丰富Claude的工作流构建能力。
|
||||
|
||||
#### 优化Claude设置及自动生成实际案例演示**
|
||||
调整模型为Opensea、开启extended thinking,尝试命令让Claude创建定时爬取新闻、更新到Google表格的N8N工作流。Claude自动选节点、写代码实现工作流逻辑。
|
||||
|
||||
#### 运行结果调试及问题反馈**
|
||||
实际运行中出现节点无输出错误,反馈给Claude让其检查API问题并修复流程。演示如何通过迭代让Claude改进脚本,节省手工调试成本。
|
||||
|
||||
#### Claude自动生成工作流优缺点分析**
|
||||
Claude能实现约80%-90%正确的工作流布局和逻辑,尽管有细节错误仍需人工二次修正,但对新手尤其友好,显著降低学习门槛和工作时间。未来随着AI模型迭代,期待更完善的自动化解决方案。
|
||||
|
||||
|
||||
## 重要术语与定义📖
|
||||
|
||||
- **N8N**:一款开源的工作流自动化工具,支持节点连接执行任务。
|
||||
- **工作流(Workflow)**:由多个任务节点按照一定顺序执行的自动化流程。
|
||||
- **节点(Node)**:工作流中的单个操作单元,如触发器、数据处理、API调用等。
|
||||
- **Claude**:基于人工智能的助手工具,可读取指令并自动生成代码或工作流。
|
||||
- **MCP**:此处指代N8N的功能扩展模块,允许外部工具调用其所有节点功能。
|
||||
- **Prompt**:向AI模型输入的描述性文本,用以引导其执行特定任务。
|
||||
- **API Key**:用于认证访问服务的密钥,保证接口调用的安全。
|
||||
- **extended thinking**:Claude的一种运行模式,支持更深层次逻辑推理。
|
||||
- **Opensea模型**:为代码生成优化的Claude子模型,适合自动编程任务。
|
||||
|
||||
## 推理结构🧩
|
||||
|
||||
1. **提出难题**:新手不知如何设计和搭建N8N工作流架构 →
|
||||
2. **引入方案**:利用Claude与N8N MCP结合,输入自然语言创建工作流 →
|
||||
3. **搭建环境**:安装Node.js、下载Claude桌面端,配置API连接 →
|
||||
4. **激活功能**:导入高级prompt学习全部N8N节点功能 →
|
||||
5. **执行任务**:Claude根据提示自动寻找节点并编码,生成工作流 →
|
||||
6. **反馈修正**:发现错误交由Claude检查修复代码 →
|
||||
7. **总结成效**:Claude可完成大部分工作流规划,减轻人力负担,未来发展空间大。
|
||||
|
||||
## 实例讲解🛠️
|
||||
|
||||
- **新闻爬取上传Google表格案例**
|
||||
指令:每小时爬取最新新闻,更新至Google表格。Claude查找爬取节点、设置触发器、写入Google Sheets节点,无需用户编码。此示例充分展示了Claude智能串联节点、实现自动化流程的能力,并帮助用户解决了选节点和写代码的难题。
|
||||
|
||||
## 容易出错点⚠️
|
||||
|
||||
- **环境安装步骤遗漏**:未正确安装Node.js会导致后续命令无法执行,确保版本号显示正确。
|
||||
- **API Key配置错误**:API Key格式或权限错误会导致Claude无法连接N8N服务器,需在N8N后台正确生成并复制。
|
||||
- **第一次运行弹窗授权忽视**:首次运行需确认弹窗授权,否则功能不全。
|
||||
- **自动生成工作流的不完美**:Claude生成的脚本约有10%-20%的错误率,需用户反复修正。误以为可“一劳永逸”是误区。
|
||||
- **模型选择失误**:没有切换到Opensea模型时,代码生成效果差强人意。
|
||||
|
||||
## 快速复习提示/自测题📝
|
||||
|
||||
**提示(无答案)**
|
||||
- Claude是如何帮助自动创建N8N工作流的?
|
||||
- 设置Claude连接N8N需要填写哪些关键配置数据?
|
||||
- 为什么要选择Opensea模型和开启extended thinking模式?
|
||||
- 遇到工作流节点无输出时应该如何排查处理?
|
||||
|
||||
**练习(含答案)**
|
||||
1. N8N MCP是什么?
|
||||
答:N8N的多功能控制面板,可以让外部工具(如Claude)调用N8N所有节点,实现自动工作流创建。
|
||||
2. 配置Claude连接N8N时,需要从N8N后台获取哪两个关键参数?
|
||||
答:N8N服务器地址和API Key。
|
||||
3. Claude生成的自动化工作流大概能达到的完成度是多少?
|
||||
答:约80%-90%,部分细节仍需人工调整。
|
||||
4. 新手如何使用Claude减少N8N编程难度?
|
||||
答:直接输入自然语言需求,让Claude自动设计工作流和编写代码,避免自行搭建节点和写复杂代码。
|
||||
|
||||
## 总结与回顾🔍
|
||||
本视频系统地介绍了利用Claude智能助手自动生成N8N工作流的完整流程,从环境搭建、关键配置到提示词导入、实际任务执行和调试改进。通过此方法,特别是缺乏编程基础的新手能快速搭建功能复杂的自动化流程,大幅提升效率。尽管现阶段自动化结果还不完美,仍需反复迭代,但整体架构合理、逻辑清晰,展现了AI辅助工作流创建的巨大潜力。未来随着大模型的进步,这种流程自动化将越来越成熟,成为低代码甚至无代码开发的重要助力。
|
||||
Reference in New Issue
Block a user