@n8n/instance-ai 1.19.2 → 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/agent/instance-agent.js +1 -0
  2. package/dist/agent/instance-agent.js.map +1 -1
  3. package/dist/agent/system-prompt.d.ts +1 -0
  4. package/dist/agent/system-prompt.js +18 -4
  5. package/dist/agent/system-prompt.js.map +1 -1
  6. package/dist/build.tsbuildinfo +1 -1
  7. package/dist/index.d.ts +5 -2
  8. package/dist/index.js +8 -2
  9. package/dist/index.js.map +1 -1
  10. package/dist/knowledge-base/materialize-knowledge-base.js +12 -1
  11. package/dist/knowledge-base/materialize-knowledge-base.js.map +1 -1
  12. package/dist/skills/runtime-skills.js +1 -1
  13. package/dist/skills/runtime-skills.js.map +1 -1
  14. package/dist/stream/map-chunk.js +22 -0
  15. package/dist/stream/map-chunk.js.map +1 -1
  16. package/dist/stream/output-redaction.js +30 -0
  17. package/dist/stream/output-redaction.js.map +1 -1
  18. package/dist/tools/credentials.tool.d.ts +212 -0
  19. package/dist/tools/credentials.tool.js +155 -21
  20. package/dist/tools/credentials.tool.js.map +1 -1
  21. package/dist/tools/index.js +4 -0
  22. package/dist/tools/index.js.map +1 -1
  23. package/dist/tools/mcp-servers.tool.d.ts +2 -0
  24. package/dist/tools/mcp-servers.tool.js +56 -0
  25. package/dist/tools/mcp-servers.tool.js.map +1 -0
  26. package/dist/tools/orchestration/agent-target-binding.d.ts +3 -0
  27. package/dist/tools/orchestration/agent-target-binding.js +64 -0
  28. package/dist/tools/orchestration/agent-target-binding.js.map +1 -1
  29. package/dist/tools/orchestration/build-agent.tool.js +57 -30
  30. package/dist/tools/orchestration/build-agent.tool.js.map +1 -1
  31. package/dist/tools/tool-ids.d.ts +2 -0
  32. package/dist/tools/tool-ids.js +5 -1
  33. package/dist/tools/tool-ids.js.map +1 -1
  34. package/dist/tools/workflows/build-workflow.tool.js +41 -12
  35. package/dist/tools/workflows/build-workflow.tool.js.map +1 -1
  36. package/dist/tools/workflows/credential-utils.d.ts +3 -0
  37. package/dist/tools/workflows/credential-utils.js +31 -1
  38. package/dist/tools/workflows/credential-utils.js.map +1 -1
  39. package/dist/tools/workflows/resolve-credentials.js +54 -1
  40. package/dist/tools/workflows/resolve-credentials.js.map +1 -1
  41. package/dist/tools/workflows/setup-workflow.schema.d.ts +151 -0
  42. package/dist/tools/workflows/setup-workflow.service.d.ts +6 -0
  43. package/dist/tools/workflows/setup-workflow.service.js +77 -13
  44. package/dist/tools/workflows/setup-workflow.service.js.map +1 -1
  45. package/dist/tools/workflows/workflow-file-bindings.d.ts +3 -1
  46. package/dist/tools/workflows/workflow-file-bindings.js +5 -2
  47. package/dist/tools/workflows/workflow-file-bindings.js.map +1 -1
  48. package/dist/tools/workflows.tool.js +44 -0
  49. package/dist/tools/workflows.tool.js.map +1 -1
  50. package/dist/tracing/agent-snapshot-event.d.ts +17 -0
  51. package/dist/tracing/agent-snapshot-event.js +56 -0
  52. package/dist/tracing/agent-snapshot-event.js.map +1 -0
  53. package/dist/types.d.ts +30 -1
  54. package/dist/types.js.map +1 -1
  55. package/dist/workspace/workspace-paths.d.ts +4 -2
  56. package/dist/workspace/workspace-paths.js +15 -2
  57. package/dist/workspace/workspace-paths.js.map +1 -1
  58. package/knowledge-base/reference/anthropic-output-shape.md +72 -0
  59. package/knowledge-base/reference/open-ai-output-shape.md +3 -0
  60. package/package.json +13 -13
  61. package/skills/agent-builder/SKILL.md +94 -0
  62. package/skills/credential-recipe-research/SKILL.md +88 -0
  63. package/skills/debugging-executions/SKILL.md +2 -1
  64. package/skills/intent-recognition/SKILL.md +23 -30
  65. package/skills/planning/SKILL.md +7 -5
  66. package/skills/post-build-flow/SKILL.md +111 -28
  67. package/skills/workflow-builder/SKILL.md +68 -23
  68. package/skills/workflow-builder/references/error-workflows.md +2 -2
@@ -0,0 +1,88 @@
1
+ ---
2
+ name: credential-recipe-research
3
+ description: >-
4
+ Lookup procedure for Simplified Custom Auth recipe fields — sources the auth
5
+ template, the key-issuing docsUrl and an auth-rejecting testUrl from the
6
+ provider's real documentation instead of memory. Load before composing
7
+ credentialHints for a service without a dedicated credential type (the
8
+ post-build-flow setup step), or when asked to fix a recipe whose template,
9
+ key page or test endpoint is wrong.
10
+ recommended_tools:
11
+ - research
12
+ - workflows
13
+ ---
14
+
15
+ # Credential Recipe Research
16
+
17
+ A recipe is only as good as the documentation it came from. This is a
18
+ procedure, not guidance: execute every step with the `research` tool and keep
19
+ only findings you can point to on a fetched page. Guessed URLs are how users
20
+ end up on the wrong page with a key that can't be verified.
21
+
22
+ Inputs: the service name and the API host(s) the workflow's nodes call.
23
+
24
+ ## 1. Auth scheme (template)
25
+
26
+ Fetch the provider's authentication docs — `research(action="web-search")`
27
+ with `"<service> API authentication"`, then `fetch-url` the best docs hit.
28
+ Record the scheme EXACTLY as documented: header name, prefix word, casing
29
+ (`Authorization: Key {{api_key}}` vs `Bearer {{api_key}}` vs a custom header
30
+ like `xi-api-key`). If the documented auth is basic, digest, or OAuth, stop:
31
+ that is not expressible as a template — use the matching generic type instead
32
+ (see the workflow-builder skill's credential ladder).
33
+
34
+ ## 2. Key page (docsUrl)
35
+
36
+ Find where a logged-in user CREATES or COPIES the key. The URL is not shown
37
+ in the form — the AI Assistant help thread presents it as THE place to get
38
+ the value, so a wrong URL sends the user to a dead end with full confidence:
39
+
40
+ - Search `"<service> dashboard API keys"`, and scan the fetched auth docs for
41
+ phrases like "get your key from", "Dashboard → API Keys", "console",
42
+ "settings".
43
+ - The answer normally lives on an app/console/dashboard host —
44
+ `console.apify.com/settings/integrations`,
45
+ `elevenlabs.io/app/settings/api-keys`, `replicate.com/account/api-tokens`,
46
+ `app.tavily.com/home` — not under `/docs`, `/reference`, or
47
+ `/documentation`.
48
+ - Accept a docs-domain URL only when the fetched page shows keys are actually
49
+ issued there (some ReadMe-style logged-in portals do).
50
+ - NEVER construct a dashboard path by analogy (`/account/api-keys`,
51
+ `/dashboard/keys`, …). Dashboards are apps behind a login: a fetch answers
52
+ 200 for any invented route, so the path cannot be verified by fetching.
53
+ Emit a deep dashboard URL only when it appears VERBATIM on a page you
54
+ fetched; when the docs only describe navigation ("Dashboard → API Keys")
55
+ without a literal URL, use the dashboard/app root they reference — a
56
+ shallower real page beats a deeper invented one.
57
+ - Nothing conclusive after both steps → omit docsUrl. Never pass off the API
58
+ reference as the key page.
59
+
60
+ ## 3. Verification endpoint (testUrl)
61
+
62
+ Find a documented, side-effect-free GET that rejects a bad key with 401/403.
63
+ Check the API reference in this order and stop at the first qualifying hit:
64
+
65
+ 1. Account/profile/me endpoints — `/v1/account`, `/v2/users/me`, `/v1/user`.
66
+ 2. Usage/quota endpoints — e.g. fal's `/v1/models/usage`, Tavily's `/usage`.
67
+ 3. List/discovery endpoints — `/v1/templates`, `/v1/models`, `/v1/voices`.
68
+
69
+ Rules, all mandatory:
70
+
71
+ - The endpoint must appear on a page you fetched — never construct a path by
72
+ analogy with other APIs.
73
+ - Never one of the workflow's own endpoints, never a resource or action URL,
74
+ never anything that can trigger billable work. Setup rejects workflow-URL
75
+ collisions, and the probe reports unexpected statuses as "could not be
76
+ verified" — an invented URL only costs the user trust.
77
+ - Skip endpoints that answer 2xx regardless of the key: auth-optional
78
+ endpoints (Pexels search) or services that signal auth errors in the
79
+ response body (Apollo's `auth/health`, TikTok) — a status probe cannot
80
+ verify through them.
81
+ - Nothing qualifies → omit testUrl. The credential saves fine and the card
82
+ honestly reports it could not be verified, which beats a false green.
83
+
84
+ ## 4. Compose
85
+
86
+ Fill `credentialHints` (field list and example in the post-build-flow skill)
87
+ from the findings above only. `suggestedName` names the service ("Apify API
88
+ Token"); never include a real secret.
@@ -31,7 +31,8 @@ name what is unconfirmed instead of repeating a success claim.
31
31
 
32
32
  Use `executions(action="run")` with `inputData` matching the trigger's output
33
33
  shape — do not rebuild the workflow with a Manual Trigger. For trigger
34
- `inputData` shapes, read `knowledge-base/reference/trigger-input-data-shapes.md`
34
+ `inputData` shapes, read
35
+ `${N8N_WORKSPACE_DIR}/knowledge-base/reference/trigger-input-data-shapes.md`
35
36
  when a sandbox workspace is available.
36
37
 
37
38
  ## Failed execution
@@ -5,24 +5,25 @@ description: >-
5
5
  owns the top-level control flow — workflow-anchored, agent-anchored,
6
6
  needs-clarification, or out-of-scope) and embeds_other (whether the other
7
7
  primitive appears embedded inside — an agent step inside a workflow, or a
8
- workflow invoked as an agent tool). Must be used before deciding the intent
9
- of any automation request, including compound requests with multiple
10
- independent automations, mid-build extensions to an existing workflow or
11
- agent, one-off questions or reports that need external systems you cannot
12
- query directly, and requests that need clarification before an anchor can
13
- be chosen, before choosing workflow-builder, planning, or an agent-oriented
14
- design.
8
+ workflow invoked as an agent tool). Must be used whenever the current turn
9
+ requires choosing or reconsidering the intent of an automation request,
10
+ including compound requests, independent automations introduced mid-build,
11
+ one-off questions or reports that need external systems you cannot query
12
+ directly, and requests that need clarification before an anchor can be
13
+ chosen. Do not load for routine edits or extensions when the conversation
14
+ already targets a workflow or Agent.
15
15
  ---
16
16
 
17
17
  # Intent recognition
18
18
 
19
19
  ## Purpose
20
20
 
21
- Use this skill to classify an automation request before designing or building
22
- it. This skill must be used before deciding whether a request is
23
- workflow-anchored, agent-anchored, needs clarification, or out of scope, and
24
- before deciding whether the other primitive is embedded inside it. The
25
- deciding question is not a single "workflow or agent" label it is two
21
+ Use this skill when an automation request still needs to be classified before
22
+ designing or building it, or when a new turn may require reconsidering the
23
+ current artifact. Do not load it again for a routine edit or extension when the
24
+ conversation already targets a workflow or Agent, unless the user introduces
25
+ an independent automation or the new request carries its own anchor signal.
26
+ The deciding question is not a single "workflow or agent" label — it is two
26
27
  questions: who owns the top-level control flow, and does the other primitive
27
28
  show up inside that flow.
28
29
 
@@ -76,8 +77,8 @@ Two orthogonal decisions per request, or per part for compound requests:
76
77
 
77
78
  - workflow-anchored + `true`: an agent embedded as a workflow step (e.g. a
78
79
  scheduled pipeline whose middle step is open-ended investigation).
79
- - agent-anchored + `true`: workflows invoked as tools of the agent; see Adding
80
- tools to an agent to distinguish them from direct tools.
80
+ - agent-anchored + `true`: workflows invoked as tools of the agent; see Agent
81
+ tool shape to distinguish them from direct tools.
81
82
  - `n/a` for needs-clarification and out-of-scope.
82
83
 
83
84
  **Migration from the old taxonomy**: old **hybrid** → workflow-anchored,
@@ -87,37 +88,29 @@ only when the user wants a persistent, triggerable automation. Old
87
88
  **ambiguous** → needs-clarification. Old **workflow** and **agent** map
88
89
  directly onto the matching anchor value.
89
90
 
90
- ## Adding tools to an agent
91
+ ## Agent tool shape
91
92
 
92
93
  After choosing an agent-anchored design, decide whether each capability should
93
94
  be a direct agent tool or a workflow tool:
94
95
 
95
- - **Direct agent tools are the default.** Forward requests to add capabilities
96
- to `build-agent` near-verbatim so the delegated builder can choose MCP,
97
- node-backed, provider, or custom tools. One node-backed capability or
98
- multiple independent node tools stay on the agent build path with
96
+ - **Direct agent tools are the default.** One node-backed capability or multiple
97
+ independent node tools stay on the Agent build path with
99
98
  `embeds_other: false`.
100
99
  - Use a **workflow tool** only when one agent tool call must run an ordered
101
100
  multi-node procedure, or when the user explicitly needs that workflow
102
101
  reusable, manually callable, or usable outside the agent. Build the workflow
103
102
  first, pass it to `build-agent` via `workflowContext`, and set
104
103
  `embeds_other: true`.
105
- - Create required **data tables** via `data-table-manager` → `data-tables`
106
- before `build-agent` when the agent will store or query tabular data — the
107
- builder cannot create tables.
108
- - Before the first `build-agent` call, create every prerequisite the builder
109
- cannot: required data tables and any workflow tools the agent will invoke.
110
- Pass built workflows in `workflowContext` and list every prerequisite
111
- name/schema in `message`. Then let the builder gather remaining agent-specific
112
- requirements (model, credentials, integrations).
113
- - If a `builderReply` lists missing workflows or tables, create them and call
114
- `build-agent` again — never ask the user to create them manually.
115
104
 
116
105
  Count the nodes required inside one tool invocation, not the total number of
117
106
  tools on the agent. For example, looking up and inserting Data Table rows are
118
107
  two direct node tools; an atomic lookup-transform-write procedure is one
119
108
  workflow tool.
120
109
 
110
+ After choosing an agent-anchored design, load `agent-builder` before calling
111
+ `build-agent`. It owns prerequisite creation and the handoff to the delegated
112
+ builder.
113
+
121
114
  ## Decision Steps
122
115
 
123
116
  0. If the user is mid-build on an existing workflow or agent, apply context
@@ -224,7 +217,7 @@ that agent, never a spawned workflow.
224
217
  that drafts a tailored renewal pitch for each account from its usage
225
218
  history embeds an agent; a nightly job that condenses each ticket into a
226
219
  two-sentence summary does not.
227
- - For an agent with workflow tools, apply Adding tools to an agent.
220
+ - For an agent with workflow tools, apply Agent tool shape.
228
221
 
229
222
  **Context continuity** (step 0): inside a workflow build, a request to insert
230
223
  a scoring step stays a bounded LLM step, not a new agent. Inside an agent
@@ -58,11 +58,13 @@ with direct `data-tables` and `parse-file` calls.
58
58
 
59
59
  ## Knowledge Base
60
60
 
61
- **Consult the knowledge base before planning.** Read the relevant `.md` guides
62
- and templates for each technique the request involves (`knowledge-base/index.json`,
63
- `knowledge-base/best-practices/index.json`, and linked files). Use
64
- `workspace_execute_command` with `rg` or `find` under `knowledge-base/templates/`
65
- to locate matching SDK examples never load `templates/index.json` wholesale.
61
+ **Consult the knowledge base before planning.** It lives at the workspace root.
62
+ Read the relevant `.md` guides and templates for each technique the request
63
+ involves (`${N8N_WORKSPACE_DIR}/knowledge-base/index.json`,
64
+ `${N8N_WORKSPACE_DIR}/knowledge-base/best-practices/index.json`, and linked
65
+ files). Use `workspace_execute_command` with `rg` or `find` under
66
+ `${N8N_WORKSPACE_DIR}/knowledge-base/templates/` to locate matching SDK
67
+ examples — never load `templates/index.json` wholesale.
66
68
  Skip only for trivial mechanical edits you have already reviewed in this thread.
67
69
 
68
70
  ## Method
@@ -24,9 +24,9 @@ These instructions are in English, but user-visible text you write while
24
24
  following them stays in the user's conversation language.
25
25
 
26
26
  For trigger `inputData` shapes, read
27
- `knowledge-base/reference/trigger-input-data-shapes.md` in the sandbox workspace
28
- when available, or load this skill's `references/trigger-input-data-shapes.md`
29
- linked file.
27
+ `${N8N_WORKSPACE_DIR}/knowledge-base/reference/trigger-input-data-shapes.md` in
28
+ the sandbox workspace when available, or load this skill's
29
+ `references/trigger-input-data-shapes.md` linked file.
30
30
 
31
31
  ## Verification follow-up
32
32
 
@@ -51,6 +51,103 @@ if the payload or prior verification evidence says mocked credentials,
51
51
  simulated node output, fixture overrides, temporary pin data, or another mocked
52
52
  input was used.
53
53
 
54
+ ### Choosing the credential type for a service
55
+
56
+ Pick in this order:
57
+
58
+ 1. **A dedicated credential type** (`slackApi`, `notionApi`, …) whenever one
59
+ exists — search with `credentials(action="search-types")`.
60
+ 2. **Simplified Custom Auth** (`httpTemplatedCustomAuth`) for any service
61
+ without a dedicated type whose auth is expressible as header/query/body
62
+ values — which covers API keys and bearer tokens (`Authorization: Bearer
63
+ <token>` becomes `{"headers":{"Authorization":"Bearer {{api_key}}"}}`, not
64
+ `httpBearerAuth`). Always provide a recipe (below) so the user only pastes
65
+ their secret.
66
+ 3. **Plain generic types** (`httpBasicAuth`, `httpDigestAuth`, `oAuth2Api`, …)
67
+ only for what a template cannot express: basic auth's base64-encoded pair,
68
+ digest's challenge-response, OAuth flows — or when the user explicitly asks
69
+ for a specific plain type: an explicit user choice wins (setup accepts it
70
+ with `allowPlainGenericAuth: true`).
71
+
72
+ ### Credential recipes for Simplified Custom Auth
73
+
74
+ When the workflow authenticates a service through Simplified Custom Auth,
75
+ include `credentialHints` in the same `workflows(action="setup")` call so the
76
+ setup card pre-fills the credential and the user only pastes their secret —
77
+ instead of facing an empty JSON template they'd have to decode from the
78
+ provider's docs. Before composing the hints, load the
79
+ `credential-recipe-research` skill and execute its lookup procedure — the
80
+ template, `docsUrl` and `testUrl` must come from the provider documentation
81
+ it has you fetch, never from memory:
82
+
83
+ - `template` — the auth request parts (headers/qs/body) exactly as documented,
84
+ with `{{placeholder}}` markers where the user's values go.
85
+ - `placeholders` — one entry per marker: `name`, user-facing `title`, an
86
+ optional `info` clarifying the value itself — its format or which of the
87
+ provider's tokens it is (e.g. "Starts with tvly-"). Never where to obtain
88
+ it, and never a URL or domain: the user asks the AI Assistant for that from
89
+ the credential form. `type` is `password` unless clearly non-secret (at
90
+ least one placeholder must stay `password`). Add `optional: true` only when
91
+ the provider documents the value as optional (e.g. an org/region
92
+ qualifier) — template entries referencing an empty optional placeholder are
93
+ omitted from the request.
94
+ - `docsUrl` — the provider page where a logged-in user CREATES/COPIES the
95
+ secret (e.g. `https://replicate.com/account/api-tokens`) — never the API
96
+ reference. Not shown in the form: the AI Assistant help thread uses it to
97
+ send the user to the exact page. Found via the `credential-recipe-research`
98
+ procedure; omit when it finds nothing conclusive.
99
+ - `testUrl` — a documented side-effect-free GET that rejects a bad key with
100
+ 401/403, used to verify the credential on save and later retests; never one
101
+ of the workflow's own endpoints, never anything billable. Found via the
102
+ `credential-recipe-research` procedure; omit when nothing qualifies — a
103
+ credential without a testUrl saves fine and honestly shows "could not be
104
+ verified", which beats a false green.
105
+ - `acceptedStatusCodes` — almost always omit; the user can adjust it later on
106
+ the credential if a service's auth answers 401/403 to valid GETs.
107
+ - `suggestedName` — display name for the created credential.
108
+
109
+ Example — fal.ai's docs say requests use `Authorization: Key <FAL_KEY>` and
110
+ `GET https://api.fal.ai/v1/models/usage` is a documented side-effect-free
111
+ endpoint that rejects a bad key (the model-serving host `fal.run` is not a
112
+ key-check endpoint):
113
+
114
+ ```json
115
+ {
116
+ "action": "setup",
117
+ "workflowId": "...",
118
+ "credentialHints": [
119
+ {
120
+ "suggestedName": "fal.ai API Key",
121
+ "template": {
122
+ "headers": { "Authorization": "Key {{api_key}}" }
123
+ },
124
+ "placeholders": [
125
+ {
126
+ "name": "api_key",
127
+ "title": "fal.ai API key",
128
+ "info": "Key ID and secret, separated by a colon",
129
+ "type": "password"
130
+ }
131
+ ],
132
+ "docsUrl": "https://fal.ai/dashboard/keys",
133
+ "testUrl": "https://api.fal.ai/v1/models/usage"
134
+ }
135
+ ]
136
+ }
137
+ ```
138
+
139
+ Never put a real secret in a recipe — the user pastes it in the setup card and
140
+ it is stored redacted in the credential. Add `nodeName` when several nodes use
141
+ Simplified Custom Auth for different services. You cannot see the secret, but
142
+ once setup reports the credential applied, treat it as fully configured — the
143
+ `{{placeholder}}` markers live only in the template; the stored values replace
144
+ them at request time. If a live test later fails with an auth error, that is
145
+ the moment to have the user re-open the credential and re-paste the value.
146
+
147
+ If the user defers setup instead, don't hand them manual field-by-field
148
+ credential instructions for the n8n editor — tell them to reopen setup when
149
+ they're ready: the card pre-fills everything except their key.
150
+
54
151
  ## Publishing and testing
55
152
 
56
153
  **Publishing is never required for testing.** Both `executions(action="run")` and
@@ -147,27 +244,19 @@ again.
147
244
  when the latest verification evidence used mocks or simulations. If this
148
245
  follow-up is due, ask only that question now; do not also ask about the error
149
246
  workflow in the same response.
150
- 7. For a direct new primary workflow, follow
151
- [Error workflow follow-up](#error-workflow-follow-up) after the mocked
152
- live-test follow-up is no longer pending for this workflow. If no mocked
153
- live-test follow-up is due, ask about the error workflow before any generic
154
- testing prompt. Do not replace this explicit opt-in with a generic "add
155
- anything else?", publish, or test question.
156
- 8. Ask the user if they want to test the workflow (skip this if
157
- `verify-built-workflow` already proved it works end-to-end with full
158
- coverage). If you need to ask about both generic testing and an error
159
- workflow, ask the error-workflow opt-in first and leave generic testing as a
160
- later follow-up unless the user already requested testing.
161
- 9. Only call `workflows(action="publish")` when the user explicitly asks to
247
+ 7. If testing has not already been offered or completed, ask whether the user
248
+ wants to test the workflow. Skip this if `verify-built-workflow` already
249
+ proved it works end-to-end with full coverage.
250
+ 8. Only call `workflows(action="publish")` when the user explicitly asks to
162
251
  publish. Never publish automatically.
252
+ 9. After a direct new primary workflow is successfully published, follow
253
+ [Error workflow follow-up](#error-workflow-follow-up).
254
+ Do not replace this explicit opt-in with a generic "add
255
+ anything else?", publish, or test question.
163
256
 
164
257
  ## Error workflow follow-up
165
258
 
166
- This follow-up comes after the mocked verification live-test follow-up when that
167
- follow-up is due, and before generic "want to test it?" prompts. For a direct
168
- new primary workflow, ask about the error workflow after the user answers,
169
- declines, or defers any pending live/no-mock testing question. If no mocked
170
- live-test follow-up is due, ask about the error workflow first.
259
+ This follow-up comes only after a direct new primary workflow is successfully published.
171
260
 
172
261
  If you just built an Error Trigger workflow because the user opted into adding
173
262
  one for a known target workflow, do not ask whether to build another error
@@ -175,7 +264,7 @@ workflow. Continue the publish-before-assign flow for the target workflow:
175
264
  ask whether to publish the error workflow and set it on that target workflow,
176
265
  then publish and assign only after the user approves.
177
266
 
178
- After saving and handling verification/setup for a direct new primary workflow,
267
+ After successfully publishing a direct new primary workflow,
179
268
  ask once whether the user wants to build an error workflow for that workflow.
180
269
  Use `ask-user` with a yes/no choice or a concise visible question. Do **not**
181
270
  create an error workflow before the user opts in.
@@ -227,15 +316,9 @@ that workflow used mocked credentials, simulated node output, fixture overrides,
227
316
  temporary pin data, or another mocked input, ask whether the user wants a live
228
317
  test without mocks. Do not run the live test automatically.
229
318
 
230
- This follow-up has priority over the error-workflow opt-in for a direct new
231
- primary workflow. If both follow-ups are due, ask about the live/no-mock test
232
- first and ask the error-workflow question only after the user has answered,
233
- declined, or deferred the live/no-mock test follow-up.
234
-
235
319
  If the user agrees, use the explicit live execution path (`executions(action="run")`
236
320
  for a direct live run) and report the result separately from the earlier mocked
237
- verification. If the user declines or defers, state what remains untested and do
238
- not claim live end-to-end verification.
321
+ verification. If the user declines or defers, state what remains untested and do not claim live end-to-end verification.
239
322
 
240
323
  ## Claiming success
241
324
 
@@ -115,15 +115,19 @@ setup steps or node semantics from memory when those sources can answer.
115
115
  1. **Knowledge base** — consult before
116
116
  building. Read the relevant `.md` guides and templates for each technique
117
117
  the request involves. Skip only for trivial mechanical edits you have
118
- already reviewed in this thread.
119
- - `knowledge-base/index.json`catalog of technique guides
120
- (`knowledge-base/best-practices/index.json`; read the linked `.md` files)
121
- and orchestration reference docs (`knowledge-base/reference/index.json`)
122
- - `knowledge-base/templates/` — curated SDK workflow examples: use
123
- `workspace_execute_command` with `rg` or `find` to locate matches, then
124
- read only the relevant `.ts` files — never load `templates/index.json`
125
- wholesale
126
- - `node-types/index.txt` searchable catalog of available n8n nodes
118
+ already reviewed in this thread. The knowledge base lives at the workspace
119
+ root (NOT inside this skill's directory) all paths below are
120
+ workspace-root-relative:
121
+ - `${N8N_WORKSPACE_DIR}/knowledge-base/index.json` — catalog of technique
122
+ guides (`${N8N_WORKSPACE_DIR}/knowledge-base/best-practices/index.json`;
123
+ read the linked `.md` files) and orchestration reference docs
124
+ (`${N8N_WORKSPACE_DIR}/knowledge-base/reference/index.json`)
125
+ - `${N8N_WORKSPACE_DIR}/knowledge-base/templates/` — curated SDK workflow
126
+ examples: use `workspace_execute_command` with `rg` or `find` to locate
127
+ matches, then read only the relevant `.ts` files —
128
+ never load `templates/index.json` wholesale
129
+ - `${N8N_WORKSPACE_DIR}/node-types/index.txt` — searchable catalog of
130
+ available n8n nodes
127
131
  2. **Runtime skills** — when another skill matches (e.g. `data-table-manager`,
128
132
  `debugging-executions`, `post-build-flow`), `load_skill` and follow it
129
133
  instead of improvising.
@@ -135,14 +139,19 @@ setup steps or node semantics from memory when those sources can answer.
135
139
 
136
140
  For workflows with multiple external systems, multiple requested effects,
137
141
  digests or reports, non-trivial branching, or Code nodes, read
138
- `knowledge-base/reference/workflow-builder-guardrails.md` before writing code.
139
- Use it as the build checklist for source preservation, fan-out/fan-in,
140
- effect-specific gating, and list itemization.
142
+ `${N8N_WORKSPACE_DIR}/knowledge-base/reference/workflow-builder-guardrails.md`
143
+ before writing code. Use it as the build checklist for source preservation,
144
+ fan-out/fan-in, effect-specific gating, and list itemization.
141
145
 
142
146
  When mapping downstream fields from an OpenAI node, read
143
- `knowledge-base/reference/open-ai-output-shape.md` (v2+ text/response uses
144
- `$json.output[0].content[0].text`; v1 text/message uses `$json.message.content`
145
- — not `$json.text`).
147
+ `${N8N_WORKSPACE_DIR}/knowledge-base/reference/open-ai-output-shape.md`
148
+ (v2+ text/response uses `$json.output[0].content[0].text`; v1 text/message
149
+ uses `$json.message.content` — not `$json.text`; `json_object`/`json_schema`
150
+ output is already a parsed object, never `JSON.parse` it). When mapping fields
151
+ from an Anthropic node, read
152
+ `${N8N_WORKSPACE_DIR}/knowledge-base/reference/anthropic-output-shape.md`
153
+ (`$json.content` is an array of blocks — read text with
154
+ `$json.content[0].text`, never treat `$json.content` as a string).
146
155
 
147
156
  ## Workflow-Level Error Workflows
148
157
 
@@ -150,9 +159,10 @@ Error workflows are per-target-workflow (`settings.errorWorkflow` must be the
150
159
  real workflow ID of a separate **published** workflow with an active Error
151
160
  Trigger — never a name, placeholder, `activeVersionId`, or local SDK id).
152
161
  n8n has no global error workflow setting; mention that only if the user asks
153
- about global behavior. Before building or attaching an error workflow, load
154
- this skill's `references/error-workflows.md` linked file and follow its
155
- build publish assign steps. Do not create one before the user opts in.
162
+ about global behavior. Do not offer or build an error workflow before the
163
+ primary workflow is published. Before building or attaching an error
164
+ workflow, load this skill's `references/error-workflows.md` linked file and
165
+ follow its build → publish → assign steps.
156
166
 
157
167
  ## Mandatory Process
158
168
 
@@ -316,9 +326,30 @@ decision after testing.
316
326
  - Never use raw credential objects like `{ id: '...', name: '...' }` in SDK
317
327
  code; replace them with `newCredential()` when editing roundtripped code.
318
328
  - If a required credential type is not listed, call
319
- `credentials(action="search-types")` with the service name. Prefer dedicated
320
- credential types over generic auth; when generic auth is truly needed,
321
- prefer `httpBearerAuth` over `httpHeaderAuth`.
329
+ `credentials(action="search-types")` with the service name. Pick in this
330
+ order:
331
+ 1. A **dedicated credential type** whenever search finds one.
332
+ 2. **Simplified Custom Auth** (`httpTemplatedCustomAuth`) for any service
333
+ without a dedicated type whose auth is expressible as header/query/body
334
+ values — this covers API keys and bearer tokens. When the provider
335
+ documents `Authorization: Bearer <token>`, do NOT reach for
336
+ `httpBearerAuth`: template it as
337
+ `{"headers":{"Authorization":"Bearer {{api_key}}"}}`. Set the HTTP
338
+ Request node's `genericAuthType` to `httpTemplatedCustomAuth`, and note
339
+ the provider's documented auth scheme (header format, key page, a cheap
340
+ authenticated GET endpoint) while you have the docs open: the setup call
341
+ needs them for the `credentialHints` recipe (see the post-build-flow
342
+ skill). Before that setup call, load the `credential-recipe-research`
343
+ skill and execute its lookup procedure — the recipe's template, docsUrl
344
+ and testUrl must come from pages fetched there, never from memory. Setup
345
+ rejects new plain generic credentials on HTTP Request nodes, so picking
346
+ Bearer/Header/Query/Custom Auth here means rebuilding — unless the user
347
+ explicitly asked for that plain type: an explicit user choice wins (setup
348
+ accepts it with `allowPlainGenericAuth: true`), don't argue with it.
349
+ 3. Plain generic types (`httpBasicAuth`, `httpDigestAuth`, `oAuth2Api`, …)
350
+ only for what a template cannot express: basic auth's base64-encoded
351
+ pair, digest's challenge-response, OAuth flows — or when the user
352
+ explicitly asks for a specific plain type.
322
353
  - `credentials(action="list", type=...)` may include a synthetic n8n credits
323
354
  entry `{ id: null, name: "n8n credits", type, __aiGatewayManaged: true }`
324
355
  when the type is covered by n8n credits (see n8n credits Preference). It is
@@ -445,12 +476,12 @@ unsolicited `sticky()`, forbidden builder constructs (e.g. `.map()`), and
445
476
  repeated `.onTrue()` / `.onFalse()` overwrites on the same IF variable. Fix
446
477
  every reported error and warning before calling `build-workflow`.
447
478
 
448
- - Code nodes need not always be necessary. You can use other n8n nodes to do the same thing.
479
+ - Code nodes need not always be necessary. You can use other n8n nodes to do the same thing.
449
480
  - SDK builder code is a restricted subset of TypeScript that builds a static
450
481
  graph; it is not a Code node and does not run. Build strings with template
451
482
  literals; do runtime joining, aggregation, or transforms in a Code node or
452
483
  `expr()`. Full allowed/forbidden list:
453
- `knowledge-base/reference/workflow-sdk-language.md`.
484
+ `${N8N_WORKSPACE_DIR}/knowledge-base/reference/workflow-sdk-language.md`.
454
485
  - Use `@n8n/workflow-sdk`.
455
486
  - Do not specify node positions. They are auto-calculated by the layout engine.
456
487
  - Use `expr('{{ $json.field }}')` for n8n expressions. Variables must be inside
@@ -534,6 +565,20 @@ import {
534
565
  } from '@n8n/workflow-sdk';
535
566
  ```
536
567
 
568
+ ## Node Groups
569
+
570
+ Organise multi-stage workflows into named node groups — visual frames on the canvas — so the
571
+ result is readable the first time the user sees it. Group each clear stage (ingest → transform
572
+ → deliver); small workflows don't need groups. Give every group a one-sentence
573
+ `description` — groups are collapsed by default, so name + description is what the user sees
574
+ first.
575
+
576
+ `.group(name, members, { description })` on the workflow builder; members are the node handles.
577
+ Read `knowledge-base/reference/node-groups.md` for the exact rules (trigger nodes excluded,
578
+ one connected section, AI sub-nodes stay with their Agent) before creating groups — an invalid
579
+ group is rejected on save. When editing an existing workflow, keep existing `.group(...)` calls
580
+ and their descriptions intact unless the change is about grouping.
581
+
537
582
  ## Workflow Rules
538
583
 
539
584
  Follow these rules strictly when generating workflows:
@@ -20,8 +20,8 @@ instance-wide error workflow behavior.
20
20
 
21
21
  When creating an error workflow to attach to another workflow:
22
22
 
23
- 1. Build the target workflow first, then ask whether the user wants an error
24
- workflow for it. Do not create one before the user opts in.
23
+ 1. Wait until the target workflow is published, then ask whether the user wants
24
+ an error workflow for it.
25
25
  2. Build the error workflow as a separate workflow. It starts with an Error
26
26
  Trigger and sends the notification the user requested.
27
27
  3. Publish the error workflow with `workflows(action="publish")` before setting