$npx -y skills add buluslan/n8n-goal-loop --skill n8n-goal-loopGenerate copy-ready /goal commands that drive an agent through the full build→validate→deploy→layered-test→iterate loop for n8n workflows. Use when the user wants to build, modify, debug, or test an n8n workflow; needs a goal instruction or spec for n8n development; designs n8n n
| 1 | # n8n Goal Loop |
| 2 | |
| 3 | Turn an n8n workflow need into a copy-ready `/goal` that drives an agent through a full closed loop: build → validate → deploy → layered test → iterate. |
| 4 | |
| 5 | This skill only generates the goal. It does not build, deploy, or run the workflow itself. |
| 6 | |
| 7 | ## Operating Mode |
| 8 | |
| 9 | n8n workflows are complex. **Align with the user first via a short interview, then generate** — do not emit a goal from a single vague line (unless the user already states goal, node pipeline, and deliverable clearly). |
| 10 | |
| 11 | Defaults: |
| 12 | - The user wants a paste-ready `/goal`, not a generic prompt. |
| 13 | - Keep the command prefix as `/goal` (not `/目标`). |
| 14 | - The first goal block must be the best recommended executable version, never a half-filled template — users copy the first block. |
| 15 | - For Chinese users: output the Chinese recommended version first, then an English-compatible mirror. |
| 16 | - Interview with numbered choices plus open questions. Never make the user fill out a long form. |
| 17 | - Ask only when the answer changes cost, risk, or direction. Auto-fill everything that has a standard n8n best practice (data-flow format, error handling, n8n red-lines) — do not ask about those. |
| 18 | - Every n8n goal must separate script-level testing from end-to-end testing. `execution success` is not proof the workflow works for the business. |
| 19 | - Generic categories only — never hardcode a specific vendor, brand, or the user's private project details. |
| 20 | |
| 21 | ## Workflow |
| 22 | |
| 23 | 1. Classify the task: build new workflow / modify existing / debug a failure / test & verify. |
| 24 | 2. Run the alignment interview (see `references/interview-checklist.md`). Four layers: |
| 25 | - Goal & deliverable — what problem, what final artifact. |
| 26 | - Node pipeline — data source → processing → output sink. |
| 27 | - Selection (generic categories) — trigger / deployment / data source / output channel. |
| 28 | - Red lines — what must not be touched. |
| 29 | 3. Generate the nine-element goal (see `references/n8n-9-elements.md` and `references/goal-command-playbook.md`). |
| 30 | 4. Let the user confirm or adjust by replying with numbered choices (e.g. `按默认` or `1A 2C`). |
| 31 | 5. Check the goal against `references/n8n-pitfalls.md` so known traps are pre-empted. |
| 32 | 6. For file deliverables, run `python3 scripts/lint_goal_command.py <file>` before calling the goal done. |
| 33 | |
| 34 | ## Output Contract |
| 35 | |
| 36 | Nine elements (qiaomu seven + data-flow + error handling). See `references/n8n-9-elements.md` for full detail. |
| 37 | |
| 38 | ```text |
| 39 | 推荐执行版(中文,可直接复制) |
| 40 | |
| 41 | /goal [Outcome: node pipeline 输入→处理→输出 + deliverable]. |
| 42 | 数据流:[node-to-node field mapping + key input/output fields + data format]. |
| 43 | 错误处理:[failure strategy for key nodes: continueOnFail / fallback store / degrade]. |
| 44 | 验证:[static check → deploy visible → script test (structure/start/execution progress) → end-to-end test (real data, execution success does not count)]. |
| 45 | 约束:[n8n red lines: no DB damage / no hardcoded secrets / Code node no HTTP / jsonBody UTF-8 / AI must not fabricate data]. |
| 46 | 边界:[only the target workflow, no others]. |
| 47 | 迭代策略:[small sample first; refresh cache after PUT; fix against pitfall library; max 3 rounds]. |
| 48 | 完成条件:[end-to-end test passes + business fields have real values]. |
| 49 | 暂停条件:[real credentials / publish-activate / real money / instance anomaly (e.g. SQLITE_CORRUPT)]. |
| 50 | |
| 51 | 默认选择理由:[one sentence]. |
| 52 | |
| 53 | 可选调整 |
| 54 | 1. [dimension]: A (default) / B / C |
| 55 | |
| 56 | 你可以直接回复:按默认,或类似 1A 2C. |
| 57 | |
| 58 | Goal Draft (English-compatible) |
| 59 | [faithful English mirror with the same nine elements] |
| 60 | ``` |
| 61 | |
| 62 | ## Quality Bar |
| 63 | |
| 64 | A strong n8n goal: |
| 65 | - Outcome states the node pipeline (input → process → output) and the deliverable. |
| 66 | - Data-flow contract covers node-to-node field mapping and key fields. |
| 67 | - Error handling covers failure fallback for fragile nodes. |
| 68 | - Verification separates script test from end-to-end test, with real business evidence. |
| 69 | - Constraints include n8n red lines (no DB damage, no hardcoded secrets, Code node does not issue HTTP, jsonBody uses UTF-8). |
| 70 | - Pause conditions cover real credentials, publish/activate, real money, and instance anomalies. |
| 71 | |
| 72 | Reject or revise a goal that: |
| 73 | - Outcome says only "build a workflow" with no pipeline. |
| 74 | - Verification says only "test passes" with no layering. |
| 75 | - Missing data-flow contract or error handling. |
| 76 | - Uses `execution success` as completion proof. |
| 77 | - Hardcodes a specif |