Skip to content

docs: n8nワークフローPRレビューのスキルを追加 - #980

Merged
keito4 merged 2 commits into
mainfrom
docs/n8n-workflow-pr-review-skill
Jul 20, 2026
Merged

docs: n8nワークフローPRレビューのスキルを追加#980
keito4 merged 2 commits into
mainfrom
docs/n8n-workflow-pr-review-skill

Conversation

@keito4

@keito4 keito4 commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Why

n8n(keito4-org/n8n_custom_node)のPRレビューには、このリポジトリ固有の判断が要る。今回4件をレビューして得た手順を、次回セッションに残すためスキル化する(AGENTS.md「セッションを跨ぐ情報はgitにコミットする」に従う)。

特に、推測すると誤判定する箇所が実在した。今回レビュー中に「executeWorkflow の typeVersion 1.1 は workflowInputs を無視する」と想定したが、n8nのソースを読むと誤りだった(displayOptions はエディタでの表示条件で、実行時は getNodeParameter が生パラメータを読む)。スキルには裏取り済みの事実と出典のみを載せている。

What

.claude/skills/n8n-workflow-pr-review.md を追加。

  • 資格情報のMASKED破損チェック — 同期PRで最も重大な退行。n8n APIは資格情報を "MASKED" で返すため live→repo→live の往復で壊れる
  • .item.first() の退行判定 — 一般論に頼らず、fan-outノードの有無とトリガー特性から「複数アイテムが流れうるか」を構造で確定させる。1アイテムなら等価=退行ではない
  • typeVersion の意味論 — 1.3 の変更点はエラー出力の統合のみで、onError: continueErrorOutput を使うノードにしか影響しない(n8nソースの出典付き)
  • CI失敗の切り分けERR_PNPM_BROKEN_LOCKFILE(他PR起因)と ERR_PNPM_OUTDATED_LOCKFILE(自PRの欠陥)と Generated Docs Sync(自PRの責任)を区別する
  • マージ順序 — lockfile修正を先に流してから rebase

AGENTS.md の Skills 表は自動生成ブロック内のため、手編集せず script/update-agents-md.sh で生成した(同スクリプトが Quality Gates 表の既存の崩れも併せて整形している)。

How

今回の実作業(PR #2727 → #2726 → #2718 をこの順でマージ、#2684 は保留)で実際に使ったコマンドをそのまま収録している。

Risk

ドキュメントのみでコード影響なし。n8nソースの参照は master ブランチのため、対象インスタンスのバージョン差異で結論が変わりうる点はスキル内に明記済み。

Summary by CodeRabbit

  • Documentation
    • Added a comprehensive guide for reviewing n8n workflow/template pull requests, including PR classification, credential-safety checks, semantic diff review, wiring/edge-path validation, CI troubleshooting, and recommended merge sequencing.
    • Updated contributor documentation to add the new workflow review skill, improve the quality-gate scripts presentation, adjust shellcheck guidance, and include a new hook for managed file edits.

n8n_custom_node のワークフロー同期PR・テンプレート修正PRをレビューする際の
判定手順をスキル化。

- 資格情報のMASKED破損チェック(同期PRで最も重大な退行)
- .item/.first() の退行判定(fan-outノードとトリガー特性から確定させる)
- executeWorkflow の typeVersion 意味論(n8nソースで裏取り済み)
- lockfile起因のCI失敗と自PR起因の切り分け
- Generated Docs Sync の直し方
@cursor

cursor Bot commented Jul 15, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e301c602-2434-49bf-81d8-3a9d6d7f26ed

📥 Commits

Reviewing files that changed from the base of the PR and between 405f174 and d18589f.

📒 Files selected for processing (1)
  • AGENTS.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • AGENTS.md

📝 Walkthrough

Walkthrough

Adds an n8n workflow PR review procedure covering classification, credential safety, semantic validation, CI triage, package updates, generated documentation, and merge order. Registers the skill in AGENTS.md and updates quality-gate and hook documentation.

Changes

n8n review guidance

Layer / File(s) Summary
n8n workflow PR review procedure
.claude/skills/n8n-workflow-pr-review.md
Defines workflow classification, credential checks, .item versus .first() semantics, typeVersion validation, JSON wiring checks, CI triage, package update handling, generated-doc repair, and merge sequencing.
Agent skill and repository guidance updates
AGENTS.md
Registers the review skill and revises the quality-gate scripts table, shellcheck glob, additional test commands, and hooks table.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • keito4/config#615: Modifies the same AGENTS.md skills, quality-gate, and hook documentation areas.
  • keito4/config#609: Overlaps with generated or restructured AGENTS.md skills, hooks, and quality-gate content.
  • keito4/config#614: Overlaps with the AGENTS.md Quality Gates and shellcheck documentation changes.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely states the main change: adding a skill for n8n workflow PR review.
Description check ✅ Passed The description covers Why, What, How, and Risk well, but it omits the template's Summary, test steps, checklist, and Related sections.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/n8n-workflow-pr-review-skill

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@claude

claude Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Claude finished @keito4's task in 0s —— View job


I'll analyze this and get back to you.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (1)
.claude/skills/n8n-workflow-pr-review.md (1)

63-88: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

n8nソースの参照先を対象版で固定してください。
master を根拠にすると、対象インスタンスと異なる実装で typeVersion の結論を出す危険があります。対象 n8n のバージョンまたはコミットを必須入力にして、この節の参照先をその版へ固定してください。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.claude/skills/n8n-workflow-pr-review.md around lines 63 - 88, Update the
n8n source-verification guidance in this section to require the target
instance’s n8n version or commit as an input, and use that exact revision for
the ExecuteWorkflow.node.ts and ExecuteWorkflowTrigger.node.ts references
instead of master. Ensure typeVersion conclusions are based only on the matched
source revision.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.claude/skills/n8n-workflow-pr-review.md:
- Around line 81-85: jq例の接続確認を、固定文字列「Execute Workflow」「Create an
issue」「Guard」ではなく、まず.nodes[]から対象ノード名を取得して参照する形に更新してください。.connectionsのキーと実際のノード名を突き合わせ、ノード名変更・複数配置・自動リネーム後も各対象ノードの配線を確認できるようにしてください。該当するtypeや役割で対象ノードを特定し、配線が見つからない場合に未確認を問題なしと扱わない出力を維持してください。
- Around line 39-44: 「.first()
は例外を投げない」という断定を、「1件以上の入力がある場合に先頭アイテムを返す」と修正し、空入力では undefined/null
になり得ることを明記してください。後続で json
などを参照する場合は、対象アイテムと必要フィールドの存在をガードする条件も追記し、既存の単一・複数アイテムに関する説明は維持してください。
- Around line 117-121: Revise the ERR_PNPM_BROKEN_LOCKFILE guidance in the
troubleshooting table so it is not categorically treated as unrelated to the PR.
Instruct reviewers to determine the cause by checking the base diff, changed
files, and failed job logs, while preserving the existing conditional guidance
for ERR_PNPM_OUTDATED_LOCKFILE and Generated Docs Sync failures.

In `@AGENTS.md`:
- Around line 152-158: 修正Quality
Gates表の列数を整え、shellcheck行のコマンド内パイプをMarkdown上で列区切りとして解釈されないようエスケープするか表外へ移動してください。追加テストコマンドもScript・Command・Purposeの3列を持つ正しい表行に変更してください。
- Line 168: AGENTS.mdのblock_managed_file_edit.pyのHook
TriggerとPurposeを、PreToolUseで「Managed by
keito4/config」マーカー付きファイルの編集をブロックする実装内容に合わせて更新してください。TriggerのUnknownを実際のフック種別に置き換え、Purposeには適用条件とブロック対象を明記してください。

---

Nitpick comments:
In @.claude/skills/n8n-workflow-pr-review.md:
- Around line 63-88: Update the n8n source-verification guidance in this section
to require the target instance’s n8n version or commit as an input, and use that
exact revision for the ExecuteWorkflow.node.ts and
ExecuteWorkflowTrigger.node.ts references instead of master. Ensure typeVersion
conclusions are based only on the matched source revision.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 762cd8e5-653f-4932-af84-a3a34a995cc7

📥 Commits

Reviewing files that changed from the base of the PR and between 9e02ae9 and 405f174.

📒 Files selected for processing (2)
  • .claude/skills/n8n-workflow-pr-review.md
  • AGENTS.md

Comment on lines +39 to +44
- `$('X').item` = paired item 解決。Switch/If の分岐をまたぐと解決に失敗して実行時エラーになりうる
(関連: [n8n#14568](https://github.com/n8n-io/n8n/issues/14568)。**ソース未確認 — 一般論として鵜呑みにしない**)。
- `$('X').first()` = 常に先頭アイテム。例外を投げない。
- **アイテムが1件しか流れない場合、両者は等価** → 退行ではない。
- 複数アイテムが流れうる場合は、全アイテムが先頭の値で処理される**サイレントな退行**になる。
Slackなら「別のユーザー宛に返信する」等の実害になり、CIでは検出できない。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

file=".claude/skills/n8n-workflow-pr-review.md"

echo "== file exists =="
git ls-files "$file"

echo
echo "== line count =="
wc -l "$file"

echo
echo "== relevant excerpt =="
sed -n '1,120p' "$file"

Repository: keito4/config

Length of output: 5498


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== repo references to first() / item linking =="
rg -n --hidden --glob '!**/.git/**' '\.first\(\)|item linking|paired item|item-linking|item linking' . || true

echo
echo "== nearby references in the reviewed file =="
sed -n '30,55p' .claude/skills/n8n-workflow-pr-review.md

Repository: keito4/config

Length of output: 2387


🌐 Web query:

n8n $('X').first() item linking semantics empty input missing field exceptions docs source

💡 Result:

In n8n, expressions using $('X').first and $('X').item have distinct semantics regarding how they resolve data from previous nodes [1]. Semantics of.first vs.item: - $('X').first: Explicitly targets the first item from the output of node 'X' [2][3][1]. It is a deterministic method that ignores the current execution context's paired item linking, making it useful when you need a specific item regardless of branch structure [2][3]. - $('X').item: Relies on "paired item linking" [2][4]. n8n attempts to trace the relationship between the current item and the source item from node 'X' based on the workflow execution path [2][5]. If the connection is broken (e.g., due to branching with If/Switch nodes) or ambiguous, n8n may fail to resolve the item, often resulting in an error or empty result [2]. Missing Fields and Exceptions: - Missing Fields: Accessing a non-existent field via dot notation (e.g., $('X').first.json.missingField) typically returns undefined rather than throwing an immediate exception [6]. However, attempting to access properties on that undefined result (e.g., $('X').first.json.missingField.subProperty) will cause a TypeError [6]. - Empty Input: If node 'X' produced no output, or if.first is called on an empty dataset, it may return undefined or null, leading to similar TypeError issues if subsequent property access is attempted [1][6]. Best Practices for Robustness: - Use Optional Chaining and Nullish Coalescing: Protect expressions with standard JavaScript patterns to handle missing data gracefully [7][6]: {{ $('X').first?.json?.field?? 'fallback-value' }} - Use $ifEmpty: n8n provides a built-in helper function to handle empty or missing values: {{ $ifEmpty($('X').first.json.field, 'default') }} [1] - Verify Data Paths: If an expression returns undefined in the editor but the data appears to exist, ensure the node has been executed and the expression path matches the actual JSON structure (use bracket notation for keys with spaces/dots: $json['field name']) [8]. - Partial Execution: Be aware that in partial executions (running only a sub-section of a workflow),.item expressions can fail because they lack the full "connectionInputData" chain, whereas.first may still resolve by reading directly from the target node's run data [4].

Citations:


.first() の安全性は条件付きに書き換えてください。
.first() 自体は先頭アイテムを返しますが、空入力では undefined/null になり得て、json などの後続参照で落ちます。「例外を投げない」 ではなく、1件以上の入力があること欠落フィールドをガードすること を明記してください。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.claude/skills/n8n-workflow-pr-review.md around lines 39 - 44, 「.first()
は例外を投げない」という断定を、「1件以上の入力がある場合に先頭アイテムを返す」と修正し、空入力では undefined/null
になり得ることを明記してください。後続で json
などを参照する場合は、対象アイテムと必要フィールドの存在をガードする条件も追記し、既存の単一・複数アイテムに関する説明は維持してください。

Comment on lines +81 to +85
```bash
# typeVersion と、エラー出力モードを使っているか
jq -r '.nodes[] | select(.type=="n8n-nodes-base.executeWorkflow") | "\(.name)\ttypeVersion=\(.typeVersion)\tonError=\(.onError // "none")\thasWorkflowInputs=\(.parameters.workflowInputs != null)"' $F
# エラー出力の配線があるか(無ければ 1.3 の変更は無影響)
jq -r '.connections | to_entries[] | select(.key|test("Execute Workflow")) | "\(.key): -> \([.value.main[]?[]?.node])"' $F

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

jq例を実際のノード名から解決するよう修正してください。

.connectionsのキーはワークフロー内のノード名ですが、ここでは Execute WorkflowCreate an issueGuard という固定文字列に依存しています。ノード名変更・複数配置・自動リネーム時に何も出力されず、配線未確認を「問題なし」と誤判定します。まず.nodes[]から対象ノード名を取得してから接続を参照してください。

Also applies to: 94-99

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.claude/skills/n8n-workflow-pr-review.md around lines 81 - 85,
jq例の接続確認を、固定文字列「Execute Workflow」「Create an
issue」「Guard」ではなく、まず.nodes[]から対象ノード名を取得して参照する形に更新してください。.connectionsのキーと実際のノード名を突き合わせ、ノード名変更・複数配置・自動リネーム後も各対象ノードの配線を確認できるようにしてください。該当するtypeや役割で対象ノードを特定し、配線が見つからない場合に未確認を問題なしと扱わない出力を維持してください。

Comment on lines +117 to +121
| エラー | 原因 | 対応 |
| ---------------------------- | ------------------------------------ | ---------------------------- |
| `ERR_PNPM_BROKEN_LOCKFILE` | lockfileの重複キー(自PRとは無関係) | 修正PRを先にマージ → rebase |
| `ERR_PNPM_OUTDATED_LOCKFILE` | package.jsonとlockfileの不整合 | lockfile未更新。そのPRの欠陥 |
| `Generated Docs Sync` 失敗 | ノード数変更後にdocs未再生成 | **自PRの責任。下記で修正** |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

file=".claude/skills/n8n-workflow-pr-review.md"
echo "== file exists =="
ls -l "$file"
echo
echo "== lines 100-140 =="
sed -n '100,140p' "$file" | cat -n
echo
echo "== search for lockfile mentions =="
rg -n "ERR_PNPM_BROKEN_LOCKFILE|ERR_PNPM_OUTDATED_LOCKFILE|lockfile|Generated Docs Sync" "$file"

Repository: keito4/config

Length of output: 3186


lockfileエラーは条件付きで切り分けるようにしてください。
ERR_PNPM_BROKEN_LOCKFILE を「自PRとは無関係」と断定せず、base差分・変更ファイル・失敗ジョブのログを見て原因を判定する形に直してください。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.claude/skills/n8n-workflow-pr-review.md around lines 117 - 121, Revise the
ERR_PNPM_BROKEN_LOCKFILE guidance in the troubleshooting table so it is not
categorically treated as unrelated to the PR. Instruct reviewers to determine
the cause by checking the base diff, changed files, and failed job logs, while
preserving the existing conditional guidance for ERR_PNPM_OUTDATED_LOCKFILE and
Generated Docs Sync failures.

Comment thread AGENTS.md
Comment thread AGENTS.md Outdated
| `block_dangerous_commands.py` | Pre Bash | Block destructive commands |
| `block_git_no_verify.py` | Pre git commit/push | Block `--no-verify` and `HUSKY=0` |
| `block_inline_secrets.py` | Pre Bash | Block commands embedding literal credentials |
| `block_managed_file_edit.py` | Unknown | block_managed_file_edit |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

HookのTriggerとPurposeを実装内容に合わせてください。

.claude/hooks/block_managed_file_edit.pyはPreToolUse hookで、Managed by keito4/configマーカー付きファイルの編集をブロックします。Unknownと自身のファイル名だけのPurposeでは、利用者が適用条件を判断できません。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@AGENTS.md` at line 168, AGENTS.mdのblock_managed_file_edit.pyのHook
TriggerとPurposeを、PreToolUseで「Managed by
keito4/config」マーカー付きファイルの編集をブロックする実装内容に合わせて更新してください。TriggerのUnknownを実際のフック種別に置き換え、Purposeには適用条件とブロック対象を明記してください。

@keito4 keito4 self-assigned this Jul 15, 2026
@keito4
keito4 merged commit 36a60e6 into main Jul 20, 2026
4 checks passed
@keito4
keito4 deleted the docs/n8n-workflow-pr-review-skill branch July 20, 2026 08:41
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.124.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released リリース済み

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant