本文へスキップ
Skillpedia
一般的なプログラミング48k · #5272

n8n-expression-syntax

できること

このツールは、n8nが自動化ワークフローを賢く動かすために使う特別なコード('式'と呼ばれます)を書いたり修正したりするのに役立ちます。構文が正しいことを確認し、必要な場所でデータを使えるようにします。

使う場面

  • ✓前のステップのデータを、別のステップで使うためのコードを書くとき。
  • ✓式の構文に関するエラーが出たとき。
  • ✓Webhookや他のノードの情報を使おうとしているとき。

スキルのリンク

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/n8n-expression-syntax/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/n8n-expression-syntax/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“このエクスプレッションを修正して、ユーザー名を取得できるようにしてください: {{ $json.body.userName }}”

毎週5つの新しいスキル。1分で読めます。

仕組み

このツールは、特別なコードがn8nのルールに従っているかを確認します。よくある間違いがあれば修正案を提示するので、ワークフローで正しくデータを使えるようになります。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

n8n Expression Syntax

Expert guide for writing correct n8n expressions in workflows.

Detailed Guide

Read the detailed guide before executing this skill. It retains the complete procedure and reference material. Treat its safety, prerequisites, and validation requirements as mandatory. For focused work, load the relevant sections; for end-to-end work, read the guide completely.

When to Use

  • You need to write or debug n8n expressions using {{ ... }} syntax.
  • The task involves $json, $node, webhook payloads, or expression-related workflow errors.
  • You want syntax-correct dynamic values inside n8n nodes and parameters.

When NOT to Use Expressions

❌ Code Nodes

Code nodes use direct JavaScript access, NOT expressions!

// ❌ WRONG in Code node
const email = '={{$json.email}}';
const name = '{{$json.body.name}}';

// ✅ CORRECT in Code node
const email = $json.email;
const name = $json.body.name;

// Or using Code node API
const email = $input.item.json.email;
const allItems = $input.all();

❌ Webhook Paths

// ❌ WRONG
path: "{{$json.user_id}}/webhook"

// ✅ CORRECT
path: "user-webhook"  // Static paths only

❌ Credential Fields

// ❌ WRONG
apiKey: "={{$env.API_KEY}}"

// ✅ CORRECT
Use n8n credential system, not expressions

Working Examples

For real workflow examples, see EXAMPLES.md

Example 1: Webhook to Slack

Webhook receives:

{
  "body": {
    "name": "John Doe",
    "email": "john@example.com",
    "message": "Hello!"
  }
}

In Slack node text field:

New form submission!

Name: {{$json.body.name}}
Email: {{$json.body.email}}
Message: {{$json.body.message}}

Example 2: HTTP Request to Email

HTTP Request returns:

{
  "data": {
    "items": [
      {"name": "Product 1", "price": 29.99}
    ]
  }
}

In Email node (reference HTTP Request):

Product: {{$node["HTTP Request"].json.data.items[0].name}}
Price: ${{$node["HTTP Request"].json.data.items[0].price}}

Example 3: Format Timestamp

// Current date
{{$now.toFormat('yyyy-MM-dd')}}
// Result: 2025-10-20

// Time
{{$now.toFormat('HH:mm:ss')}}
// Result: 14:30:45

// Full datetime
{{$now.toFormat('yyyy-MM-dd HH:mm')}}
// Result: 2025-10-20 14:30

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
よくある質問

n8nの'式'とは何ですか?

{{ ... }}のような特別な書き方を使って、自動化ワークフローの他の部分からデータを取得して使うための短いコードのことです。

このツールを使うべきでないのはどんなときですか?

'Codeノード'の中で直接コードを書くとき、固定のWebhookパス、認証情報の入力欄では使わないでください。その場合は構文が異なるか、使用できないためです。

前のステップのデータはどのように使いますか?

前のノードのデータにアクセスするには{{ $node["Node Name"].json["field"] }}と書きます。直接受け取ったデータには{{ $json["field"] }}を使います。

詳細

作者による元の説明

Validate n8n expression syntax and fix common errors. Use when writing n8n expressions, using {{}} syntax, accessing $json/$node variables, troubleshooting expression errors, or working with webhook data in workflows.

repo: sickn33/agentic-awesome-skills

人気

GitHubのスター
48k
ランキング
#5272
ライセンス
MIT
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル