API安装
- 作者仓库星标 190,957
- 作者更新于 实时读取
- 作者仓库 n8n
- 领域
- 通用
- 兼容 Agent
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- 信任分
- 88 / 100 · 社区维护
- 作者 / 版本 / 许可
- @n8n-io · 未声明 license
- Token 消耗评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部 API Key
- 需要 · Vendor-specific
- 兼容的系统
- macOS · Linux · Windows
- 底层运行要求
- Node.js
- 文件与系统权限
-
- 只读
- 允许写入 / 修改
- Shell 执行
- 读取环境变量
- 网络行为
- 允许外网请求
- 安装命令数
- 26 条
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: n8n-cli
description: Use the n8n CLI to manage workflows, credentials, executions, and more on an n8n instance. Use w…
category: 通用
runtime: Node.js
---
# n8n-cli 输出预览
## PART A: 任务判断
- 适用问题:通用任务拆解、检查和交付。
- 输入要求:目标材料、限制条件、期望输出和验收方式。
- 证据边界:围绕“Setup / Global Flags / Workflows”读取原文规则,不把推断写成作者承诺。
## PART B: 执行结果
- **01** 任务判断:确认你的需求是否属于通用任务拆解、检查和交付,并标出输入、限制和预期结果。
- **02** 执行计划:优先按“Setup / Global Flags / Workflows”拆成步骤,说明每一步会读取什么、修改什么、产出什么。
- **03** 交付结果:给出可复制的命令、文件改动、检查清单或内容草稿,并说明如何继续迭代。
- **04** 风险边界:结合 读取文件、写入/修改文件、执行终端命令、读取环境变量、会按任务需要访问外部网络、需要准备 Vendor-specific API Key 给出执行前确认项。
## Running Rules
- 读取文件、写入/修改文件、执行终端命令、读取环境变量;会按任务需要访问外部网络;需要准备 Vendor-specific API Key。
- 先小样例验证,再放大到真实任务。
- 交付时同时给结果、检查口径和下一步迭代建议。 原文没有稳定的斜杠命令要求。安装验证后通常全局生效,直接在对话里点名这个 Skill 并描述任务即可。
告诉 Agent 目标文件或材料、期望结果、不可改范围、是否允许联网或执行命令。本 Skill 的权限画像是:读取文件、写入/修改文件、执行终端命令、读取环境变量。
先用一个小任务确认它会围绕“Setup / Global Flags / Workflows”工作;涉及文件或命令时,先看 diff、日志、预览或测试结果。
检查最终产物是否包含明确结果、必要证据和下一步动作;如果输出泛泛而谈,就补充输入、边界和验收标准后重跑。
---
name: n8n-cli
description: Use the n8n CLI to manage workflows, credentials, executions, and more on an n8n instance. Use w…
category: 通用
source: n8n-io/n8n
---
# n8n-cli
## 什么时候使用
- 把通用方向的常用动作沉淀成 Agent 可调用的技能 适合处理通用任务拆解、检查、交付和复盘,核心价值是把输入、判断、执行、验证和交付边界固定下来,避免 Agent 泛泛回答。 把任务拆成可执行、可检查、可继续迭代的步骤;使用前要准备…
- 面向通用任务拆解、检查和交付,优先处理能明确输入、步骤和验收标准的工作。
## 需要提供什么
- 目标材料、目录范围、期望结果和不可改动内容。
- 是否允许联网、执行命令、读写文件或调用外部服务。
## 执行规则
- 围绕「Setup / Global Flags / Workflows」组织步骤,不把推断写成作者事实。
- 读取文件、写入/修改文件、执行终端命令、读取环境变量;会按任务需要访问外部网络;需要准备 Vendor-specific API Key。
- 先跑小样例,确认结果可检查后再扩大任务范围。
## 输出要求
- 给出最终产物、关键证据、验证方式和下一步动作。
- 信息不足时标记 unknown,不编造命令、平台或依赖。 作者原文负责流程事实;仓库文件负责来源和命令;流狐只补充适用场景、限制和质量判断。
skill "n8n-cli" {
输入层 -> 用户目标 + 目标文件 + 禁止范围 + 验收标准
上下文层 -> Setup / Global Flags / Workflows
规则层 -> SKILL.md 触发条件 / 执行顺序 / 输出格式
运行层 -> Node.js | 读取文件、写入/修改文件、执行终端命令、读取环境变量 | 会按任务需要访问外部网络
安全层 -> 需要准备 Vendor-specific API Key + 小任务验证 + diff / 日志复核
输出层 -> 可复制结果 + 检查清单 + 下一步迭代
} n8n CLI
The n8n-cli command-line tool manages an n8n instance via its REST API.
It auto-detects piped output and switches to JSON, making it composable for scripts and LLM tool use.
Setup
# Interactive login (saves to ~/.n8n-cli/config.json)
n8n-cli login
# Or configure directly
n8n-cli config set-url https://my-instance.n8n.cloud
n8n-cli config set-api-key n8n_api_...
# Or use environment variables (no config file needed)
export N8N_URL=https://my-instance.n8n.cloud
export N8N_API_KEY=n8n_api_...
Global Flags
Every command supports these flags:
| Flag | Short | Description |
|---|---|---|
--url |
-u |
Instance URL (overrides config/env) |
--apiKey |
-k |
API key (overrides config/env) |
--format |
-f |
Output format: table, json, id-only |
--json |
Shorthand for --format=json |
|
--jq |
jq-style filter (implies --json), e.g. '.[0].id', '.[].name' |
|
--quiet |
-q |
Suppress output |
--no-header |
Hide table headers (for awk/cut parsing) |
|
--debug |
Print HTTP details to stderr |
Auto-JSON: When stdout is piped (not a TTY), output defaults to JSON automatically.
Workflows
# List all workflows
n8n-cli workflow list
# Filter workflows
n8n-cli workflow list --active
n8n-cli workflow list --tag=production
n8n-cli workflow list --name="My Workflow"
n8n-cli workflow list --limit=5
# Get a single workflow (full JSON with nodes and connections)
n8n-cli workflow get <id>
# Extract just node names from a workflow
n8n-cli workflow get <id> --jq '.nodes[].name'
# Create a workflow from JSON
n8n-cli workflow create --file=workflow.json
cat workflow.json | n8n-cli workflow create --stdin
# Update a workflow
n8n-cli workflow update <id> --file=updated.json
cat updated.json | n8n-cli workflow update <id> --stdin
# Activate / deactivate
n8n-cli workflow activate <id>
n8n-cli workflow deactivate <id>
# Delete a workflow
n8n-cli workflow delete <id>
# Transfer to another project
n8n-cli workflow transfer <id> --project=<projectId>
# List tags on a workflow
n8n-cli workflow tags <id>
Executions
# List recent executions
n8n-cli execution list
n8n-cli execution list --workflow=<id> --status=error --limit=10
# status options: canceled, error, running, success, waiting
# Get execution details
n8n-cli execution get <id>
n8n-cli execution get <id> --include-data # includes full node I/O
# Retry a failed execution
n8n-cli execution retry <id>
# Stop a running execution
n8n-cli execution stop <id>
# Delete an execution
n8n-cli execution delete <id>
Credentials
# List credentials
n8n-cli credential list
# Get credential metadata (not secrets)
n8n-cli credential get <id>
# Get the schema for a credential type (shows required fields)
n8n-cli credential schema notionApi
n8n-cli credential schema slackOAuth2Api
# Create a credential
n8n-cli credential create --type=notionApi --name='My Notion' --data='{"apiKey":"..."}'
n8n-cli credential create --type=notionApi --name='My Notion' --file=cred.json
cat cred.json | n8n-cli credential create --type=notionApi --name='My Notion' --stdin
# Delete / transfer
n8n-cli credential delete <id>
n8n-cli credential transfer <id> --project=<projectId>
Tip: Use credential schema <type> to discover required fields before creating.
Projects
n8n-cli project list
n8n-cli project get <id>
n8n-cli project create --name="My Project"
n8n-cli project update <id> --name="New Name"
n8n-cli project delete <id>
# Team management
n8n-cli project members <id>
n8n-cli project add-member <id> --user=<userId> --role=<role>
n8n-cli project remove-member <id> --user=<userId>
Tags
n8n-cli tag list
n8n-cli tag create --name=production
n8n-cli tag update <id> --name=staging
n8n-cli tag delete <id>
Variables
n8n-cli variable list
n8n-cli variable create --key=API_ENDPOINT --value=https://api.example.com
n8n-cli variable update <id> --key=API_ENDPOINT --value=https://new-api.example.com
n8n-cli variable delete <id>
Data Tables
# CRUD
n8n-cli data-table list
n8n-cli data-table get <id>
n8n-cli data-table create --name=Inventory --columns='[{"name":"item","type":"string"},{"name":"qty","type":"number"}]'
n8n-cli data-table delete <id>
# Row operations
n8n-cli data-table rows <id>
n8n-cli data-table add-rows <id> --file=rows.json
n8n-cli data-table update-rows <id> --file=rows.json
n8n-cli data-table upsert-rows <id> --file=rows.json
n8n-cli data-table delete-rows <id> --ids=row1,row2,row3
# All row commands support --stdin
cat rows.json | n8n-cli data-table add-rows <id> --stdin
Users
n8n-cli user list
n8n-cli user get <id>
Other
# Security audit
n8n-cli audit
n8n-cli audit --categories=credentials,nodes
# Source control
n8n-cli source-control pull
# View config
n8n-cli config show
Composability Patterns
The CLI is designed to be piped and composed:
# Get all workflow IDs
n8n-cli workflow list --jq '.[].id'
# Get the name of the first workflow
n8n-cli workflow list --jq '.[0].name'
# Export a workflow to a file
n8n-cli workflow get 1234 --json > workflow-backup.json
# Find failing executions for a workflow
n8n-cli execution list --workflow=1234 --status=error --json
# Pipe workflow JSON for modification
n8n-cli workflow get 1234 --json | jq '.name = "Updated Name"' | n8n-cli workflow update 1234 --stdin
# Table output without headers for shell parsing
n8n-cli workflow list --no-header | awk '{print $1}'
# Debug API calls
n8n-cli workflow list --debug 2>debug.log
Workflow JSON Structure
When creating or updating workflows, the JSON follows this structure:
{
"name": "My Workflow",
"nodes": [
{
"name": "Start",
"type": "n8n-nodes-base.manualTrigger",
"position": [250, 300],
"parameters": {}
},
{
"name": "HTTP Request",
"type": "n8n-nodes-base.httpRequest",
"position": [450, 300],
"parameters": {
"url": "https://api.example.com/data",
"method": "GET"
}
}
],
"connections": {
"Start": {
"main": [[{ "node": "HTTP Request", "type": "main", "index": 0 }]]
}
}
}
Key points:
nodes[].typefollows the patternn8n-nodes-base.<nodeName>for built-in nodesconnectionsis keyed by source node name, withmainoutput arrays- Each connection specifies target
node,type(usuallymain), and outputindex - Use
workflow get <id> --jsonto see real examples from the instance
先判断是否适合
作者设计意图
作者的方法与取舍
边界和复核