@n8n/workflow-sdk 0.9.0 → 0.10.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 (183) hide show
  1. package/dist/build.tsbuildinfo +1 -1
  2. package/dist/generate-types/generate-types.js +1 -1
  3. package/dist/generate-types/generate-types.js.map +1 -1
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.js +4 -2
  6. package/dist/index.js.map +1 -1
  7. package/dist/prompts/best-practices/guides/chatbot.d.ts +7 -0
  8. package/dist/prompts/best-practices/guides/chatbot.js +120 -0
  9. package/dist/prompts/best-practices/guides/chatbot.js.map +1 -0
  10. package/dist/prompts/best-practices/guides/content-generation.d.ts +7 -0
  11. package/dist/prompts/best-practices/guides/content-generation.js +117 -0
  12. package/dist/prompts/best-practices/guides/content-generation.js.map +1 -0
  13. package/dist/prompts/best-practices/guides/data-analysis.d.ts +7 -0
  14. package/dist/prompts/best-practices/guides/data-analysis.js +369 -0
  15. package/dist/prompts/best-practices/guides/data-analysis.js.map +1 -0
  16. package/dist/prompts/best-practices/guides/data-extraction.d.ts +7 -0
  17. package/dist/prompts/best-practices/guides/data-extraction.js +124 -0
  18. package/dist/prompts/best-practices/guides/data-extraction.js.map +1 -0
  19. package/dist/prompts/best-practices/guides/data-persistence.d.ts +7 -0
  20. package/dist/prompts/best-practices/guides/data-persistence.js +199 -0
  21. package/dist/prompts/best-practices/guides/data-persistence.js.map +1 -0
  22. package/dist/prompts/best-practices/guides/data-transformation.d.ts +7 -0
  23. package/dist/prompts/best-practices/guides/data-transformation.js +148 -0
  24. package/dist/prompts/best-practices/guides/data-transformation.js.map +1 -0
  25. package/dist/prompts/best-practices/guides/document-processing.d.ts +7 -0
  26. package/dist/prompts/best-practices/guides/document-processing.js +334 -0
  27. package/dist/prompts/best-practices/guides/document-processing.js.map +1 -0
  28. package/dist/prompts/best-practices/guides/enrichment.d.ts +7 -0
  29. package/dist/prompts/best-practices/guides/enrichment.js +273 -0
  30. package/dist/prompts/best-practices/guides/enrichment.js.map +1 -0
  31. package/dist/prompts/best-practices/guides/form-input.d.ts +7 -0
  32. package/dist/prompts/best-practices/guides/form-input.js +175 -0
  33. package/dist/prompts/best-practices/guides/form-input.js.map +1 -0
  34. package/dist/prompts/best-practices/guides/human-in-the-loop.d.ts +7 -0
  35. package/dist/prompts/best-practices/guides/human-in-the-loop.js +270 -0
  36. package/dist/prompts/best-practices/guides/human-in-the-loop.js.map +1 -0
  37. package/dist/prompts/best-practices/guides/knowledge-base.d.ts +7 -0
  38. package/dist/prompts/best-practices/guides/knowledge-base.js +270 -0
  39. package/dist/prompts/best-practices/guides/knowledge-base.js.map +1 -0
  40. package/dist/prompts/best-practices/guides/monitoring.d.ts +7 -0
  41. package/dist/prompts/best-practices/guides/monitoring.js +173 -0
  42. package/dist/prompts/best-practices/guides/monitoring.js.map +1 -0
  43. package/dist/prompts/best-practices/guides/notification.d.ts +7 -0
  44. package/dist/prompts/best-practices/guides/notification.js +137 -0
  45. package/dist/prompts/best-practices/guides/notification.js.map +1 -0
  46. package/dist/prompts/best-practices/guides/scheduling.d.ts +7 -0
  47. package/dist/prompts/best-practices/guides/scheduling.js +154 -0
  48. package/dist/prompts/best-practices/guides/scheduling.js.map +1 -0
  49. package/dist/prompts/best-practices/guides/scraping-and-research.d.ts +7 -0
  50. package/dist/prompts/best-practices/guides/scraping-and-research.js +160 -0
  51. package/dist/prompts/best-practices/guides/scraping-and-research.js.map +1 -0
  52. package/dist/prompts/best-practices/guides/triage.d.ts +7 -0
  53. package/dist/prompts/best-practices/guides/triage.js +151 -0
  54. package/dist/prompts/best-practices/guides/triage.js.map +1 -0
  55. package/dist/prompts/best-practices/index.d.ts +20 -0
  56. package/dist/prompts/best-practices/index.js +69 -0
  57. package/dist/prompts/best-practices/index.js.map +1 -0
  58. package/dist/prompts/best-practices/types.d.ts +25 -0
  59. package/dist/prompts/best-practices/types.js +40 -0
  60. package/dist/prompts/best-practices/types.js.map +1 -0
  61. package/dist/prompts/index.d.ts +3 -0
  62. package/dist/prompts/index.js +25 -0
  63. package/dist/prompts/index.js.map +1 -0
  64. package/dist/prompts/node-guidance/index.d.ts +3 -0
  65. package/dist/prompts/node-guidance/index.js +20 -0
  66. package/dist/prompts/node-guidance/index.js.map +1 -0
  67. package/dist/prompts/node-guidance/node-recommendations/audio-generation.d.ts +2 -0
  68. package/dist/prompts/node-guidance/node-recommendations/audio-generation.js +18 -0
  69. package/dist/prompts/node-guidance/node-recommendations/audio-generation.js.map +1 -0
  70. package/dist/prompts/node-guidance/node-recommendations/format-recommendation.d.ts +2 -0
  71. package/dist/prompts/node-guidance/node-recommendations/format-recommendation.js +27 -0
  72. package/dist/prompts/node-guidance/node-recommendations/format-recommendation.js.map +1 -0
  73. package/dist/prompts/node-guidance/node-recommendations/image-generation.d.ts +2 -0
  74. package/dist/prompts/node-guidance/node-recommendations/image-generation.js +18 -0
  75. package/dist/prompts/node-guidance/node-recommendations/image-generation.js.map +1 -0
  76. package/dist/prompts/node-guidance/node-recommendations/index.d.ts +6 -0
  77. package/dist/prompts/node-guidance/node-recommendations/index.js +17 -0
  78. package/dist/prompts/node-guidance/node-recommendations/index.js.map +1 -0
  79. package/dist/prompts/node-guidance/node-recommendations/text-manipulation.d.ts +2 -0
  80. package/dist/prompts/node-guidance/node-recommendations/text-manipulation.js +27 -0
  81. package/dist/prompts/node-guidance/node-recommendations/text-manipulation.js.map +1 -0
  82. package/dist/prompts/node-guidance/node-recommendations/types.d.ts +26 -0
  83. package/dist/prompts/node-guidance/node-recommendations/types.js +16 -0
  84. package/dist/prompts/node-guidance/node-recommendations/types.js.map +1 -0
  85. package/dist/prompts/node-guidance/node-recommendations/video-generation.d.ts +2 -0
  86. package/dist/prompts/node-guidance/node-recommendations/video-generation.js +15 -0
  87. package/dist/prompts/node-guidance/node-recommendations/video-generation.js.map +1 -0
  88. package/dist/prompts/node-guidance/node-tips/index.d.ts +3 -0
  89. package/dist/prompts/node-guidance/node-tips/index.js +8 -0
  90. package/dist/prompts/node-guidance/node-tips/index.js.map +1 -0
  91. package/dist/prompts/node-guidance/node-tips/structured-output-parser.d.ts +2 -0
  92. package/dist/prompts/node-guidance/node-tips/structured-output-parser.js +35 -0
  93. package/dist/prompts/node-guidance/node-tips/structured-output-parser.js.map +1 -0
  94. package/dist/prompts/node-guidance/node-tips/types.d.ts +7 -0
  95. package/dist/prompts/node-guidance/node-tips/types.js +3 -0
  96. package/dist/prompts/node-guidance/node-tips/types.js.map +1 -0
  97. package/dist/prompts/node-guidance/node-tips/webhook.d.ts +2 -0
  98. package/dist/prompts/node-guidance/node-tips/webhook.js +38 -0
  99. package/dist/prompts/node-guidance/node-tips/webhook.js.map +1 -0
  100. package/dist/prompts/node-guidance/parameter-guides/embedding-nodes.d.ts +2 -0
  101. package/dist/prompts/node-guidance/parameter-guides/embedding-nodes.js +70 -0
  102. package/dist/prompts/node-guidance/parameter-guides/embedding-nodes.js.map +1 -0
  103. package/dist/prompts/node-guidance/parameter-guides/gmail.d.ts +2 -0
  104. package/dist/prompts/node-guidance/parameter-guides/gmail.js +53 -0
  105. package/dist/prompts/node-guidance/parameter-guides/gmail.js.map +1 -0
  106. package/dist/prompts/node-guidance/parameter-guides/http-request.d.ts +2 -0
  107. package/dist/prompts/node-guidance/parameter-guides/http-request.js +139 -0
  108. package/dist/prompts/node-guidance/parameter-guides/http-request.js.map +1 -0
  109. package/dist/prompts/node-guidance/parameter-guides/if-node.d.ts +2 -0
  110. package/dist/prompts/node-guidance/parameter-guides/if-node.js +159 -0
  111. package/dist/prompts/node-guidance/parameter-guides/if-node.js.map +1 -0
  112. package/dist/prompts/node-guidance/parameter-guides/index.d.ts +12 -0
  113. package/dist/prompts/node-guidance/parameter-guides/index.js +26 -0
  114. package/dist/prompts/node-guidance/parameter-guides/index.js.map +1 -0
  115. package/dist/prompts/node-guidance/parameter-guides/predecessor-output.d.ts +2 -0
  116. package/dist/prompts/node-guidance/parameter-guides/predecessor-output.js +25 -0
  117. package/dist/prompts/node-guidance/parameter-guides/predecessor-output.js.map +1 -0
  118. package/dist/prompts/node-guidance/parameter-guides/resource-locator.d.ts +2 -0
  119. package/dist/prompts/node-guidance/parameter-guides/resource-locator.js +40 -0
  120. package/dist/prompts/node-guidance/parameter-guides/resource-locator.js.map +1 -0
  121. package/dist/prompts/node-guidance/parameter-guides/set-node.d.ts +2 -0
  122. package/dist/prompts/node-guidance/parameter-guides/set-node.js +94 -0
  123. package/dist/prompts/node-guidance/parameter-guides/set-node.js.map +1 -0
  124. package/dist/prompts/node-guidance/parameter-guides/switch-node.d.ts +2 -0
  125. package/dist/prompts/node-guidance/parameter-guides/switch-node.js +75 -0
  126. package/dist/prompts/node-guidance/parameter-guides/switch-node.js.map +1 -0
  127. package/dist/prompts/node-guidance/parameter-guides/system-message.d.ts +2 -0
  128. package/dist/prompts/node-guidance/parameter-guides/system-message.js +96 -0
  129. package/dist/prompts/node-guidance/parameter-guides/system-message.js.map +1 -0
  130. package/dist/prompts/node-guidance/parameter-guides/text-fields.d.ts +2 -0
  131. package/dist/prompts/node-guidance/parameter-guides/text-fields.js +31 -0
  132. package/dist/prompts/node-guidance/parameter-guides/text-fields.js.map +1 -0
  133. package/dist/prompts/node-guidance/parameter-guides/tool-nodes.d.ts +2 -0
  134. package/dist/prompts/node-guidance/parameter-guides/tool-nodes.js +76 -0
  135. package/dist/prompts/node-guidance/parameter-guides/tool-nodes.js.map +1 -0
  136. package/dist/prompts/node-guidance/parameter-guides/types.d.ts +18 -0
  137. package/dist/prompts/node-guidance/parameter-guides/types.js +3 -0
  138. package/dist/prompts/node-guidance/parameter-guides/types.js.map +1 -0
  139. package/dist/prompts/node-selection/ai-nodes.d.ts +2 -0
  140. package/dist/prompts/node-selection/ai-nodes.js +35 -0
  141. package/dist/prompts/node-selection/ai-nodes.js.map +1 -0
  142. package/dist/prompts/node-selection/connection-parameters.d.ts +1 -0
  143. package/dist/prompts/node-selection/connection-parameters.js +13 -0
  144. package/dist/prompts/node-selection/connection-parameters.js.map +1 -0
  145. package/dist/prompts/node-selection/index.d.ts +5 -0
  146. package/dist/prompts/node-selection/index.js +16 -0
  147. package/dist/prompts/node-selection/index.js.map +1 -0
  148. package/dist/prompts/node-selection/native-preference.d.ts +1 -0
  149. package/dist/prompts/node-selection/native-preference.js +18 -0
  150. package/dist/prompts/node-selection/native-preference.js.map +1 -0
  151. package/dist/prompts/node-selection/trigger-selection.d.ts +1 -0
  152. package/dist/prompts/node-selection/trigger-selection.js +23 -0
  153. package/dist/prompts/node-selection/trigger-selection.js.map +1 -0
  154. package/dist/prompts/node-selection/use-case-patterns.d.ts +2 -0
  155. package/dist/prompts/node-selection/use-case-patterns.js +58 -0
  156. package/dist/prompts/node-selection/use-case-patterns.js.map +1 -0
  157. package/dist/prompts/sdk-reference/additional-functions.d.ts +1 -0
  158. package/dist/prompts/sdk-reference/additional-functions.js +20 -0
  159. package/dist/prompts/sdk-reference/additional-functions.js.map +1 -0
  160. package/dist/prompts/sdk-reference/expressions.d.ts +1 -0
  161. package/dist/prompts/sdk-reference/expressions.js +34 -0
  162. package/dist/prompts/sdk-reference/expressions.js.map +1 -0
  163. package/dist/prompts/sdk-reference/index.d.ts +5 -0
  164. package/dist/prompts/sdk-reference/index.js +14 -0
  165. package/dist/prompts/sdk-reference/index.js.map +1 -0
  166. package/dist/prompts/sdk-reference/workflow-patterns-detailed.d.ts +1 -0
  167. package/dist/prompts/sdk-reference/workflow-patterns-detailed.js +398 -0
  168. package/dist/prompts/sdk-reference/workflow-patterns-detailed.js.map +1 -0
  169. package/dist/prompts/sdk-reference/workflow-patterns.d.ts +2 -0
  170. package/dist/prompts/sdk-reference/workflow-patterns.js +479 -0
  171. package/dist/prompts/sdk-reference/workflow-patterns.js.map +1 -0
  172. package/dist/prompts/sdk-reference/workflow-rules.d.ts +1 -0
  173. package/dist/prompts/sdk-reference/workflow-rules.js +23 -0
  174. package/dist/prompts/sdk-reference/workflow-rules.js.map +1 -0
  175. package/dist/workflow-builder/plugins/defaults.js +1 -0
  176. package/dist/workflow-builder/plugins/defaults.js.map +1 -1
  177. package/dist/workflow-builder/plugins/validators/filter-node-validator.d.ts +2 -0
  178. package/dist/workflow-builder/plugins/validators/filter-node-validator.js +90 -0
  179. package/dist/workflow-builder/plugins/validators/filter-node-validator.js.map +1 -0
  180. package/dist/workflow-builder/plugins/validators/index.d.ts +1 -0
  181. package/dist/workflow-builder/plugins/validators/index.js +3 -1
  182. package/dist/workflow-builder/plugins/validators/index.js.map +1 -1
  183. package/package.json +48 -2
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChatbotBestPractices = void 0;
4
+ const types_1 = require("../types");
5
+ class ChatbotBestPractices {
6
+ constructor() {
7
+ this.technique = types_1.WorkflowTechnique.CHATBOT;
8
+ this.version = '1.0.0';
9
+ this.documentation = `# Best Practices: Chatbot Workflows
10
+
11
+ ## Workflow Design
12
+
13
+ Break chatbot logic into manageable steps and use error handling nodes (IF, Switch) with fallback mechanisms to manage unexpected inputs.
14
+
15
+ Most chatbots run through external platforms like Slack, Telegram, or WhatsApp rather than through the n8n chat interface - if the user requests a service like this don't use the built in chat interface nodes. But, the n8n chat node is easier to get started with tests. If the user mentions chatting but does not mention a service then use the built in n8n chat node.
16
+
17
+ CRITICAL: The user may ask to be able to chat to a workflow as well as trigger it via some other method, for example scheduling information gathering but also being able to chat with the agent - in scenarios like this the two separate workflows MUST be connected through shared memory, vector stores, data storage, or direct connections.
18
+
19
+ Example pattern:
20
+ - Schedule Trigger → News Gathering Agent → [memory node via ai_memory]
21
+ - Chat Trigger → Chatbot Agent → [SAME memory node via ai_memory]
22
+ - Result: Both agents share conversation/context history, enabling the chatbot to discuss gathered news
23
+
24
+ For the chatbot always use the same chat node type as used for response. If Telegram has been requested trigger the chatbot via telegram AND
25
+ respond via telegram - do not mix chatbot interfaces.
26
+
27
+ ## Context & Memory Management
28
+
29
+ Always utilise memory in chatbot agent nodes - providing context gives you full conversation history and more control over context.
30
+ Memory nodes enable the bot to handle follow-up questions by maintaining short-term conversation history.
31
+
32
+ Include information with the user prompt such as timestamp, user ID, or session metadata. This enriches context without relying solely on memory and user prompt.
33
+
34
+ If there are other agents involved in the workflow you should share memory between the chatbot and those other agents where it makes sense.
35
+ Connect the same memory node to multiple agents to enable data sharing and context continuity.
36
+
37
+ ## Context Engineering & AI Agent Output
38
+
39
+ It can be beneficial to respond to the user as a tool of the chatbot agent rather than using the agent output - this allows the agent to loop/carry out multiple responses if necessary.
40
+ This will require adding a note to the system prompt for the agent to tell it to use the tool to respond to the user.
41
+
42
+ ## Message Attribution
43
+
44
+ n8n chatbots often attach the attribution "n8n workflow" to messages by default - you must disable this setting which will
45
+ often be called "Append n8n Attribution" for nodes that support it, add this setting and set it to false.
46
+
47
+ ## Recommended Nodes
48
+
49
+ ### Chat Trigger (@n8n/n8n-nodes-langchain.chatTrigger)
50
+
51
+ Purpose: Entry point for user messages in n8n-hosted chat interfaces
52
+
53
+ Pitfalls:
54
+
55
+ - Most production chatbots use external platforms (Slack, Telegram) rather than n8n's chat interface
56
+
57
+ ### AI Agent (@n8n/n8n-nodes-langchain.agent)
58
+
59
+ Purpose: Orchestrates logic, tool use, and LLM calls for intelligent responses.
60
+
61
+ Unless user asks for a node by name, always use the AI Agent node over provider-specific nodes (like OpenAI, Google Gemini) or use-case-specific AI nodes (like Message a model) for chatbot workflows. The AI Agent node provides better orchestration, tool integration, and memory management capabilities essential for conversational interfaces.
62
+ For example, for "create a chatbot using OpenAI", implement: AI Agent -- OpenAI Chat Model.
63
+
64
+ ### Chat Model Nodes
65
+
66
+ - OpenAI Chat Model (@n8n/n8n-nodes-langchain.lmChatOpenAi)
67
+ - Google Gemini Chat Model (@n8n/n8n-nodes-langchain.lmChatGoogleGemini)
68
+ - xAI Grok Chat Model (@n8n/n8n-nodes-langchain.lmChatXAiGrok)
69
+ - DeepSeek Chat Model (@n8n/n8n-nodes-langchain.lmChatDeepSeek)
70
+
71
+ Purpose: Connect to LLMs for natural, context-aware responses
72
+
73
+ ### Simple Memory (@n8n/n8n-nodes-langchain.memoryBufferWindow)
74
+
75
+ Purpose: Maintains short-term conversation history for context continuity
76
+
77
+ ### HTTP Request (n8n-nodes-base.httpRequest)
78
+
79
+ Purpose: Fetches external data to enrich chatbot responses with real-time or organizational information
80
+
81
+ ### Database Nodes & Google Sheets
82
+
83
+ - Data Table (n8n-nodes-base.dataTable)
84
+ - Postgres (n8n-nodes-base.postgres)
85
+ - MySQL (n8n-nodes-base.mySql)
86
+ - MongoDB (n8n-nodes-base.mongoDb)
87
+ - Google Sheets (n8n-nodes-base.googleSheets)
88
+
89
+ Purpose: Store conversation logs, retrieve structured data, or maintain user preferences
90
+
91
+ ### IF / Switch
92
+
93
+ - If (n8n-nodes-base.if)
94
+ - Switch (n8n-nodes-base.switch)
95
+
96
+ Purpose: Conditional logic and error handling for routing messages or managing conversation state
97
+
98
+ ### Integration Nodes
99
+
100
+ - Slack (n8n-nodes-base.slack)
101
+ - Telegram (n8n-nodes-base.telegram)
102
+ - WhatsApp Business Cloud (n8n-nodes-base.whatsApp)
103
+ - Discord (n8n-nodes-base.discord)
104
+
105
+ Purpose: Multi-channel support for deploying chatbots on popular messaging platforms
106
+
107
+ ## Common Pitfalls to Avoid
108
+
109
+ ### Leaving Chatbot Disconnected
110
+
111
+ When a workflow has multiple triggers (e.g., scheduled data collection + chatbot interaction), the chatbot MUST have access to the data
112
+ generated by the workflow. Connect the chatbot through shared memory, vector stores, data storage, or direct data flow connections.
113
+ `;
114
+ }
115
+ getDocumentation() {
116
+ return this.documentation;
117
+ }
118
+ }
119
+ exports.ChatbotBestPractices = ChatbotBestPractices;
120
+ //# sourceMappingURL=chatbot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chatbot.js","sourceRoot":"","sources":["../../../../src/prompts/best-practices/guides/chatbot.ts"],"names":[],"mappings":";;;AACA,oCAA6C;AAE7C,MAAa,oBAAoB;IAAjC;QACU,cAAS,GAAG,yBAAiB,CAAC,OAAO,CAAC;QACtC,YAAO,GAAG,OAAO,CAAC;QAEV,kBAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwGjC,CAAC;IAKF,CAAC;IAHA,gBAAgB;QACf,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;CACD;AAjHD,oDAiHC"}
@@ -0,0 +1,7 @@
1
+ import type { BestPracticesDocument } from '../types';
2
+ export declare class ContentGenerationBestPractices implements BestPracticesDocument {
3
+ readonly technique: "content_generation";
4
+ readonly version = "1.0.0";
5
+ private readonly documentation;
6
+ getDocumentation(): string;
7
+ }
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContentGenerationBestPractices = void 0;
4
+ const types_1 = require("../types");
5
+ class ContentGenerationBestPractices {
6
+ constructor() {
7
+ this.technique = types_1.WorkflowTechnique.CONTENT_GENERATION;
8
+ this.version = '1.0.0';
9
+ this.documentation = `# Best Practices: Content Generation Workflows
10
+
11
+ ## Workflow Design
12
+
13
+ Break complex tasks into sequential steps (e.g., generate text, create image, compose video) for modularity and easier troubleshooting.
14
+
15
+ ## Node Selection Guidelines
16
+
17
+ Always prefer built-in n8n nodes over HTTP Request nodes when a dedicated node exists for the service or API you need to integrate with. Built-in nodes provide:
18
+ - Pre-configured authentication handling
19
+ - Optimized data structures and field mappings
20
+ - Better error handling and user experience
21
+ - Simplified setup without manual API configuration
22
+
23
+ Only use HTTP Request nodes when no built-in node exists for the service, or when you need to access an API endpoint not covered by the built-in node's operations.
24
+
25
+ ## Multi-Modal Content Generation - MANDATORY
26
+
27
+ When the user's request involves specific generative AI models or media-focused platforms, the workflow MUST include the appropriate media generation node from a
28
+ provider-specific node. The finished workflow MUST contain the relevant video, audio, or image generation capability.
29
+
30
+ Prompts that require multi-modal generation nodes:
31
+
32
+ Video Generation:
33
+ - Model mentions: Sora, Nano Banana, Veo, Runway, Pika
34
+ - Platform mentions: YouTube content, TikTok videos, Instagram Reels, video ads, short-form video
35
+ - Task mentions: generate video, create video, video from text, animate
36
+
37
+ Image Generation:
38
+ - Model mentions: DALL-E, Midjourney, Stable Diffusion, Imagen
39
+ - Platform mentions: thumbnails, social media graphics, product images, marketing visuals
40
+ - Task mentions: generate image, create artwork, design graphic, visualize
41
+
42
+ Audio Generation:
43
+ - Model mentions: ElevenLabs, text-to-speech, TTS
44
+ - Platform mentions: podcast audio, voiceovers, narration, audio content
45
+ - Task mentions: generate voice, create audio, synthesize speech, clone voice
46
+
47
+ If anything like the examples above are mentioned in the prompt, include the appropriate
48
+ provider node (OpenAI for DALL-E/Sora, Google Gemini for Nano Banana/Imagen, etc.)
49
+ with the media generation operation configured.
50
+
51
+ ## Content-Specific Guidance
52
+
53
+ For text generation, validate and sanitize input/output to avoid malformed data. When generating images, prefer binary data over URLs for uploads to avoid media type errors.
54
+
55
+ ## Recommended Nodes
56
+
57
+ ### OpenAI (@n8n/n8n-nodes-langchain.openAi)
58
+
59
+ Purpose: GPT-based text generation, DALL-E image generation, text-to-speech (TTS), and audio transcription, SORA for video generation
60
+
61
+ ### xAI Grok Chat Model (@n8n/n8n-nodes-langchain.lmChatXAiGrok)
62
+
63
+ Purpose: Conversational AI and text generation
64
+
65
+ ### Google Gemini Chat Model (@n8n/n8n-nodes-langchain.lmChatGoogleGemini)
66
+
67
+ Purpose: Image analysis and generation, video generation from text prompts using nano banana, multimodal content creation
68
+
69
+ ### ElevenLabs
70
+
71
+ Purpose: Natural-sounding AI voice generation
72
+
73
+ Note: Use HTTP Request node or a community node to integrate with ElevenLabs API
74
+
75
+ ### HTTP Request (n8n-nodes-base.httpRequest)
76
+
77
+ Purpose: Integrating with other LLM and content generation APIs (e.g., Jasper, Writesonic, Anthropic, HuggingFace)
78
+
79
+ ### Edit Image (n8n-nodes-base.editImage)
80
+
81
+ Purpose: Manipulating images - resize, crop, rotate, and format conversion
82
+
83
+ Pitfalls:
84
+
85
+ - Ensure input is valid binary image data
86
+ - Check output format compatibility with downstream nodes
87
+
88
+ ### Markdown (n8n-nodes-base.markdown)
89
+
90
+ Purpose: Formatting and converting text to HTML or Markdown reports
91
+
92
+ ### Facebook Graph API (n8n-nodes-base.facebookGraphApi)
93
+
94
+ Purpose: Uploading videos and images to Instagram and Facebook
95
+
96
+ Pitfalls:
97
+
98
+ - Use binary data fields rather than URLs for media uploads to prevent "media type" errors
99
+ - Verify page IDs and access tokens have correct permissions
100
+
101
+ ### Wait (n8n-nodes-base.wait)
102
+
103
+ Purpose: Handling delays in video processing/uploading and respecting API rate limits
104
+
105
+ ## Common Pitfalls to Avoid
106
+
107
+ Binary Data Handling: For media uploads, use binary fields rather than URLs to prevent "media type" errors, especially with Facebook and Instagram APIs. Download media to binary data first, then upload from binary rather than passing URLs.
108
+
109
+ Async Processing: For long-running content generation tasks (especially video), implement proper wait/polling mechanisms. Don't assume instant completion - many AI services process requests asynchronously.
110
+ `;
111
+ }
112
+ getDocumentation() {
113
+ return this.documentation;
114
+ }
115
+ }
116
+ exports.ContentGenerationBestPractices = ContentGenerationBestPractices;
117
+ //# sourceMappingURL=content-generation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-generation.js","sourceRoot":"","sources":["../../../../src/prompts/best-practices/guides/content-generation.ts"],"names":[],"mappings":";;;AACA,oCAA6C;AAE7C,MAAa,8BAA8B;IAA3C;QACU,cAAS,GAAG,yBAAiB,CAAC,kBAAkB,CAAC;QACjD,YAAO,GAAG,OAAO,CAAC;QAEV,kBAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqGjC,CAAC;IAKF,CAAC;IAHA,gBAAgB;QACf,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;CACD;AA9GD,wEA8GC"}
@@ -0,0 +1,7 @@
1
+ import type { BestPracticesDocument } from '../types';
2
+ export declare class DataAnalysisBestPractices implements BestPracticesDocument {
3
+ readonly technique: "data_analysis";
4
+ readonly version = "1.0.0";
5
+ private readonly documentation;
6
+ getDocumentation(): string;
7
+ }
@@ -0,0 +1,369 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataAnalysisBestPractices = void 0;
4
+ const types_1 = require("../types");
5
+ class DataAnalysisBestPractices {
6
+ constructor() {
7
+ this.technique = types_1.WorkflowTechnique.DATA_ANALYSIS;
8
+ this.version = '1.0.0';
9
+ this.documentation = `# Best Practices: Data Analysis Workflows
10
+
11
+ ## Workflow Design
12
+
13
+ Structure workflows following the Input → Transform → Output pattern. Use clear node naming (e.g., "Fetch Sales Data", "Calculate Averages", "IF High Variance?") to document the flow.
14
+
15
+ Start with appropriate triggers:
16
+ - Manual Trigger for on-demand analysis
17
+ - Cron/Schedule Trigger for periodic analysis (daily/weekly reports)
18
+ - Webhook Trigger for event-driven analysis
19
+
20
+ Break complex workflows into modular sub-workflows using the Execute Workflow node for reusable components like "Outlier Detection" or "Data Preparation".
21
+
22
+ CRITICAL: For large datasets, use Split In Batches node to process items in chunks (e.g., 100 at a time) to prevent memory issues. Always test with realistic data volumes.
23
+
24
+ Example pattern:
25
+ - Trigger → HTTP Request (fetch data) → Spreadsheet File (parse CSV) → Set (clean fields) → Filter (remove nulls) → Code (analyze) → HTML (format report) → Email (send results)
26
+
27
+ ## Data Preparation Strategy
28
+
29
+ 1. **Fetch Data**: Use dedicated integration nodes or HTTP Request for APIs. Import cURL commands directly to HTTP node for complex APIs.
30
+ 2. **Parse & Convert**: Convert to JSON using Spreadsheet File node for CSV/Excel. Enable "Convert types where required" on condition nodes.
31
+ 3. **Clean Data**: Use Set node with "Keep Only Set" enabled to drop unused fields. Filter node for removing null values or focusing on data subsets.
32
+ 4. **Merge/Enrich**: Use Merge node by key or index to combine multiple sources. Choose correct merge mode to avoid mismatched items.
33
+
34
+ ## Analysis Implementation
35
+
36
+ Use Function node (not Function Item) when analysis needs all items as a whole (calculating totals, finding trends). Function Item operates per item only.
37
+
38
+ For AI-powered analysis, filter irrelevant content first to minimize tokens. Batch data into single prompts when possible.
39
+
40
+ Always pin data after external calls to test downstream logic without re-fetching. This saves API costs and speeds development.
41
+
42
+ ## Output & Integration
43
+
44
+ Format results appropriately:
45
+ - HTML/Markdown nodes for reports
46
+ - Set node to prepare specific output fields (totalSales, anomalyCount)
47
+ - Database nodes to store analysis history
48
+ - Webhook Response for API-triggered workflows
49
+
50
+ Use conditional branches (IF nodes) for post-analysis actions:
51
+ - Create tasks if anomalies detected
52
+ - Send alerts for critical thresholds
53
+ - Avoid infinite loops by using proper conditions
54
+
55
+ ## Recommended Nodes
56
+
57
+ ### HTTP Request (n8n-nodes-base.httpRequest)
58
+
59
+ **Purpose**: Fetch datasets from URLs or APIs
60
+
61
+ **Use Cases**:
62
+ - Pull data from REST APIs for analysis
63
+ - Fetch CSV/JSON files from URLs
64
+ - Query external data sources
65
+
66
+ **Best Practices**:
67
+ - Import cURL commands for complex requests
68
+ - Use authentication credentials properly
69
+ - Handle pagination for large datasets
70
+
71
+ ### Spreadsheet File (n8n-nodes-base.spreadsheetFile)
72
+
73
+ **Purpose**: Parse CSV/Excel files into JSON items for processing
74
+
75
+ **Use Cases**:
76
+ - Import CSV data from file uploads
77
+ - Process Excel spreadsheets
78
+ - Convert tabular data to JSON
79
+
80
+ **Best Practices**:
81
+ - Specify correct file format
82
+ - Handle header rows properly
83
+ - Test with various file encodings
84
+
85
+ ### Set / Edit Fields (n8n-nodes-base.set)
86
+
87
+ **Purpose**: Clean data, select relevant fields, rename columns, convert data types
88
+
89
+ **Key Setting**: "Keep Only Set" - drops all fields not explicitly defined
90
+
91
+ **Use Cases**:
92
+ - Remove unused columns to reduce data size
93
+ - Rename fields to standardized names
94
+ - Convert data types (string to number)
95
+ - Add calculated fields
96
+
97
+ **Best Practices**:
98
+ - Enable "Keep Only Set" to drop unused data
99
+ - Always verify output structure
100
+ - Use expressions for calculated fields
101
+
102
+ ### Filter (n8n-nodes-base.filter)
103
+
104
+ **Purpose**: Remove unwanted items based on conditions
105
+
106
+ **Use Cases**:
107
+ - Remove null values
108
+ - Filter outliers before analysis
109
+ - Focus on specific data subsets
110
+
111
+ **Best Practices**:
112
+ - Filter early to reduce processing load
113
+ - Use multiple conditions when needed
114
+ - Document filter logic clearly
115
+
116
+ ### IF (n8n-nodes-base.if)
117
+
118
+ **Purpose**: Branch workflow based on analysis results
119
+
120
+ **Use Cases**:
121
+ - Route anomalies vs normal data
122
+ - Trigger alerts for threshold breaches
123
+ - Create conditional outputs
124
+
125
+ **Best Practices**:
126
+ - Enable "Convert types where required" for comparisons
127
+ - Use clear condition names
128
+ - Handle both true and false branches
129
+
130
+ ### Code / Function (n8n-nodes-base.function)
131
+
132
+ **Purpose**: Custom JavaScript for calculations, statistics, anomaly detection
133
+
134
+ **Use Cases**:
135
+ - Calculate statistical measures (mean, median, std dev)
136
+ - Detect outliers and anomalies
137
+ - Perform complex transformations
138
+ - Implement custom algorithms
139
+
140
+ **Best Practices**:
141
+ - Use Function node (not Function Item) for whole-dataset operations
142
+ - Return proper data structure: \`return items\`
143
+ - Add comments to explain logic
144
+ - Test with edge cases
145
+
146
+ **Note**: Consider using the newer Code node (n8n-nodes-base.code) as Function node is deprecated.
147
+
148
+ ### Aggregate (n8n-nodes-base.aggregate)
149
+
150
+ **Purpose**: Group items, gather values into arrays, count occurrences by category
151
+
152
+ **Use Cases**:
153
+ - Group sales by region
154
+ - Count items by category
155
+ - Calculate sums and averages per group
156
+
157
+ **Best Practices**:
158
+ - Choose appropriate aggregation function
159
+ - Use grouping keys effectively
160
+ - Simplifies statistical calculations
161
+
162
+ ### Split In Batches (n8n-nodes-base.splitInBatches)
163
+
164
+ **Purpose**: Process large datasets in chunks to prevent memory overload
165
+
166
+ **Use Cases**:
167
+ - Handle datasets with 1000+ items
168
+ - Process API results in batches
169
+ - Prevent workflow timeouts
170
+
171
+ **Best Practices**:
172
+ - Set appropriate batch size (e.g., 100 items)
173
+ - Test with realistic data volumes
174
+ - Use loop logic properly
175
+
176
+ ### Merge (n8n-nodes-base.merge)
177
+
178
+ **Purpose**: Combine data from multiple sources by key/index
179
+
180
+ **Modes**:
181
+ - Merge by Key: Join data like database operations
182
+ - Merge by Index: Combine parallel data streams
183
+ - Wait mode: Synchronize parallel branches
184
+
185
+ **Use Cases**:
186
+ - Join customer data with transaction data
187
+ - Combine multiple API responses
188
+ - Enrich data from multiple sources
189
+
190
+ **Best Practices**:
191
+ - Choose correct merge mode
192
+ - Ensure matching keys exist
193
+ - Handle missing data gracefully
194
+
195
+ ### Database Nodes
196
+
197
+ **MySQL** (n8n-nodes-base.mySql):
198
+ - Purpose: Query MySQL databases for analysis data
199
+ - Use cases: Fetch historical data, store results
200
+
201
+ **Postgres** (n8n-nodes-base.postgres):
202
+ - Purpose: Query PostgreSQL databases
203
+ - Use cases: Complex analytical queries, time-series data
204
+
205
+ **MongoDB** (n8n-nodes-base.mongoDb):
206
+ - Purpose: Query NoSQL document databases
207
+ - Use cases: Unstructured data analysis, JSON documents
208
+
209
+ **Best Practices**:
210
+ - Use parameterized queries for security
211
+ - Query source data efficiently with proper indexes
212
+ - Store analysis results for historical tracking
213
+ - Use appropriate data types
214
+
215
+ ### Google Sheets (n8n-nodes-base.googleSheets)
216
+
217
+ **Purpose**: Read/write spreadsheet data
218
+
219
+ **Use Cases**:
220
+ - Import data for analysis
221
+ - Append summary statistics
222
+ - Build analysis logs
223
+ - Share results with stakeholders
224
+
225
+ **Best Practices**:
226
+ - Use range specifications efficiently
227
+ - Handle large sheets with batching
228
+ - Consider API rate limits
229
+
230
+ ### AI Agent (@n8n/n8n-nodes-langchain.agent)
231
+
232
+ **Purpose**: Leverage AI for text analysis, sentiment detection, complex pattern recognition
233
+
234
+ **Use Cases**:
235
+ - Sentiment analysis of customer feedback
236
+ - Text classification
237
+ - Extract insights from unstructured data
238
+ - Natural language processing
239
+
240
+ **Best Practices**:
241
+ - Filter irrelevant content first to minimize tokens
242
+ - Batch data into single prompts when possible
243
+ - Use structured output for consistency
244
+ - Consider API costs and latency
245
+
246
+ ### HTML (n8n-nodes-base.html)
247
+
248
+ **Purpose**: Generate formatted reports with tables and styling
249
+
250
+ **Use Cases**:
251
+ - Create analysis reports
252
+ - Build dashboards
253
+ - Color-code data quality scores
254
+ - Format tables with results
255
+
256
+ **Best Practices**:
257
+ - Use templates for consistent formatting
258
+ - Include visualizations where helpful
259
+ - Make reports mobile-friendly
260
+
261
+ ### Email (n8n-nodes-base.emailSend)
262
+
263
+ **Purpose**: Send analysis reports to stakeholders automatically
264
+
265
+ **Use Cases**:
266
+ - Scheduled report delivery
267
+ - Alert notifications
268
+ - Share findings with teams
269
+
270
+ **Best Practices**:
271
+ - Use clear subject lines
272
+ - Include summary in email body
273
+ - Attach detailed reports when needed
274
+ - Schedule appropriately
275
+
276
+ ## Common Pitfalls to Avoid
277
+
278
+ ### Data Type Mismatches
279
+
280
+ **Problem**: JSON data types matter. Comparing string vs number yields incorrect results. The comparison "5" > "10" is lexicographically true (wrong for numbers).
281
+
282
+ **Solution**:
283
+ - Always convert data types before comparisons
284
+ - Use Number() or parseInt() for numeric operations
285
+ - Enable "Convert types where required" on IF nodes
286
+ - Validate data types early in workflow
287
+ - Use proper type casting in Code nodes
288
+
289
+ ### Memory Issues with Large Datasets
290
+
291
+ **Problem**: Processing thousands of items at once can crash workflows or timeout.
292
+
293
+ **Solution**:
294
+ - Use Split In Batches node for datasets over 100 items
295
+ - Set appropriate batch sizes (50-100 items)
296
+ - Test with realistic data volumes during development
297
+ - Monitor memory usage in production
298
+ - Consider sub-workflows for complex processing
299
+
300
+ ### Not Pinning Data During Development
301
+
302
+ **Problem**: Re-fetching data from APIs repeatedly wastes time and costs money during development.
303
+
304
+ **Solution**:
305
+ - Always pin data after external calls
306
+ - Test downstream logic without re-fetching
307
+ - Saves API costs and speeds development
308
+ - Use manual triggers to control execution
309
+
310
+ ### Incorrect Aggregation Logic
311
+
312
+ **Problem**: Using Function Item instead of Function node for whole-dataset calculations.
313
+
314
+ **Solution**:
315
+ - Use Function node (not Function Item) for totals, averages, trends
316
+ - Function Item operates per item only
317
+ - Understand the difference between item-level and dataset-level operations
318
+ - Use Aggregate node for common operations
319
+
320
+ ### Missing Data Cleaning
321
+
322
+ **Problem**: Null values, inconsistent formats, or outliers skew analysis results.
323
+
324
+ **Solution**:
325
+ - Use Filter node to remove null values
326
+ - Standardize data formats early
327
+ - Handle missing data explicitly
328
+ - Use Set node to clean and normalize fields
329
+ - Document data quality assumptions
330
+
331
+ ### Poor Error Handling
332
+
333
+ **Problem**: Failed API calls or data issues break the entire workflow.
334
+
335
+ **Solution**:
336
+ - Use "Continue on Fail" setting appropriately
337
+ - Add IF nodes to check for empty datasets
338
+ - Implement error logging
339
+ - Use Error Trigger workflows for global handling
340
+ - Validate data quality before analysis
341
+
342
+ ### Hardcoded Values
343
+
344
+ **Problem**: Thresholds, API endpoints, or configuration values are hardcoded in nodes.
345
+
346
+ **Solution**:
347
+ - Store configuration in environment variables
348
+ - Use Google Sheets or databases for thresholds
349
+ - Makes workflows reusable and maintainable
350
+ - Enable non-technical users to adjust parameters
351
+
352
+ ### Inefficient Query Patterns
353
+
354
+ **Problem**: Fetching entire datasets when only summary data is needed.
355
+
356
+ **Solution**:
357
+ - Use database aggregation functions
358
+ - Filter data at the source
359
+ - Use appropriate indexes
360
+ - Implement pagination for large results
361
+ - Consider pre-aggregated views
362
+ `;
363
+ }
364
+ getDocumentation() {
365
+ return this.documentation;
366
+ }
367
+ }
368
+ exports.DataAnalysisBestPractices = DataAnalysisBestPractices;
369
+ //# sourceMappingURL=data-analysis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-analysis.js","sourceRoot":"","sources":["../../../../src/prompts/best-practices/guides/data-analysis.ts"],"names":[],"mappings":";;;AACA,oCAA6C;AAE7C,MAAa,yBAAyB;IAAtC;QACU,cAAS,GAAG,yBAAiB,CAAC,aAAa,CAAC;QAC5C,YAAO,GAAG,OAAO,CAAC;QAEV,kBAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiWjC,CAAC;IAKF,CAAC;IAHA,gBAAgB;QACf,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;CACD;AA1WD,8DA0WC"}
@@ -0,0 +1,7 @@
1
+ import type { BestPracticesDocument } from '../types';
2
+ export declare class DataExtractionBestPractices implements BestPracticesDocument {
3
+ readonly technique: "data_extraction";
4
+ readonly version = "1.0.0";
5
+ private readonly documentation;
6
+ getDocumentation(): string;
7
+ }