@n8n/workflow-sdk 0.9.0 → 0.10.1

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 +50 -4
@@ -0,0 +1,270 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KnowledgeBaseBestPractices = void 0;
4
+ const types_1 = require("../types");
5
+ class KnowledgeBaseBestPractices {
6
+ constructor() {
7
+ this.technique = types_1.WorkflowTechnique.KNOWLEDGE_BASE;
8
+ this.version = '1.0.0';
9
+ this.documentation = `# Best Practices: Knowledge Base Workflows
10
+
11
+ ## Workflow Design
12
+
13
+ ### Architecture Pattern
14
+ - **Separate Workflows**: Split into two distinct parts:
15
+ - **Ingestion Workflow**: Processes and indexes documents into vector database (triggered on new content or schedule)
16
+ - **Query Workflow**: Retrieves relevant information and generates answers (triggered by user queries)
17
+ - **Modular Design**: Use Execute Workflow node to call query workflow from multiple channels (chat, API, Slack, etc.)
18
+
19
+ ### Trigger Strategy
20
+ - **Ingestion Triggers**: File Watchers (Google Drive, S3), Schedule triggers for periodic re-indexing
21
+ - **Query Triggers**: Chat Trigger, Webhook, Slack Trigger based on input channel
22
+
23
+ ### Data Type Handling
24
+ - Use Switch/If nodes or Code node to route different file types to appropriate extraction branches
25
+ - Separate processing paths for PDFs, databases, web pages, etc.
26
+
27
+ ## Core Processing Pipeline
28
+
29
+ ### Document Processing
30
+ 1. **Fetch Documents**: Google Drive/Dropbox/S3 nodes, HTTP Request node, Database nodes
31
+ 2. **Load & Split**: Default Data Loader → Recursive Character Text Splitter
32
+ - Chunk size: 500-1000 characters (~200 tokens)
33
+ - Overlap: 10-15% to preserve context
34
+ 3. **Generate Embeddings**: Embeddings node (OpenAI/HuggingFace/Cohere)
35
+ - **Critical**: Use same model for indexing and queries
36
+ - Example: text-embedding-ada-002 (1536 dimensions)
37
+
38
+ ### Vector Store Configuration
39
+ - **Insert Mode**:
40
+ - Use upsert with unique IDs (document ID + chunk number)
41
+ - Include metadata (source, title, page number)
42
+ - Clear namespace option for complete replacement
43
+ - **Query Mode**:
44
+ - Top-K limit: 3-5 results typically optimal
45
+ - Apply similarity score threshold to filter irrelevant matches
46
+
47
+ ### LLM Integration
48
+ - **Agent Approach**: AI Agent node with Vector Store Tool
49
+ - Configure clear tool description: "Company Knowledge Base – use this to find relevant policy documents"
50
+ - Connect Window Buffer Memory for conversation history
51
+ - **Direct Query**: Vector Store (Get Many) → OpenAI Chat Model with crafted prompt
52
+ - **System Prompt**: "Answer using only the information from our knowledge base. If you don't find an answer in the provided documents, say you don't know."
53
+ - **Temperature**: 0-0.3 for factual accuracy
54
+
55
+ ## Recommended Nodes
56
+
57
+ ### Document Handling
58
+
59
+ **Google Drive** (n8n-nodes-base.googleDrive):
60
+ - Purpose: File triggers and retrieval from Google Drive
61
+ - Use cases: Monitor folders for new documents, fetch specific files
62
+ - Best practices: Use triggers for automatic ingestion, handle file types appropriately
63
+
64
+ **HTTP Request** (n8n-nodes-base.httpRequest):
65
+ - Purpose: Fetch documents from URLs/APIs
66
+ - Use cases: Pull content from web pages, download files from APIs
67
+ - Best practices: Handle authentication, check response formats
68
+
69
+ **Notion** (n8n-nodes-base.notion):
70
+ - Purpose: Retrieve content from Notion databases and pages
71
+ - Use cases: Index company wikis, documentation in Notion
72
+ - Best practices: Use appropriate API version, handle nested content
73
+
74
+ **Postgres** (n8n-nodes-base.postgres):
75
+ - Purpose: Query database content for indexing
76
+ - Use cases: Index structured data, retrieve records for embedding
77
+ - Best practices: Use efficient queries, batch large datasets
78
+
79
+ ### AI Processing Chain
80
+
81
+ **Document Default Data Loader** (@n8n/n8n-nodes-langchain.documentDefaultDataLoader):
82
+ - Purpose: Load documents into LangChain format
83
+ - Use cases: Initial document processing, format conversion
84
+ - Best practices: Handle various document types, preserve metadata
85
+
86
+ **Text Splitter Recursive Character** (@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter):
87
+ - Purpose: Split documents into manageable chunks
88
+ - Configuration:
89
+ - Chunk size: 500-1000 characters (~200 tokens)
90
+ - Overlap: 10-15% to preserve context
91
+ - Best practices: Test chunk sizes for optimal retrieval quality, ensure context preservation
92
+
93
+ **Embeddings OpenAI** (@n8n/n8n-nodes-langchain.embeddingsOpenAi):
94
+ - Purpose: Generate vector embeddings for text
95
+ - Model options:
96
+ - text-embedding-3-small (newer, cost-effective)
97
+ - text-embedding-ada-002 (1536 dimensions, widely used)
98
+ - **Critical**: Use same model for indexing and queries
99
+ - Best practices: Choose model based on quality/cost tradeoffs, maintain consistency
100
+
101
+ ### Vector Stores
102
+
103
+ **Vector Store Pinecone** (@n8n/n8n-nodes-langchain.vectorStorePinecone):
104
+ - Purpose: Pinecone vector database integration
105
+ - Use cases: Production knowledge bases, scalable deployments
106
+ - Best practices: Use namespaces for organization, set appropriate index dimensions
107
+
108
+ **Vector Store Qdrant** (@n8n/n8n-nodes-langchain.vectorStoreQdrant):
109
+ - Purpose: Qdrant vector database integration
110
+ - Use cases: Self-hosted vector storage, high-performance search
111
+ - Best practices: Configure collections properly, use filters for metadata
112
+
113
+ **Vector Store Supabase** (@n8n/n8n-nodes-langchain.vectorStoreSupabase):
114
+ - Purpose: Supabase pgvector integration
115
+ - Use cases: PostgreSQL-based vector storage, integrated with existing Supabase projects
116
+ - Best practices: Ensure pgvector extension is enabled, use proper indexing
117
+
118
+ **Vector Store In Memory** (@n8n/n8n-nodes-langchain.vectorStoreInMemory):
119
+ - Purpose: In-memory vector storage for testing
120
+ - Use cases: Development, testing, small datasets
121
+ - Best practices: Not for production, data lost on restart
122
+
123
+ ### Agent & LLM
124
+
125
+ **AI Agent** (@n8n/n8n-nodes-langchain.agent):
126
+ - Purpose: Orchestrate tool use and LLM interactions
127
+ - Configuration: Connect Vector Store Tool, add memory
128
+ - Best practices: Configure clear tool descriptions, use appropriate prompts
129
+
130
+ **Tool Vector Store** (@n8n/n8n-nodes-langchain.toolVectorStore):
131
+ - Purpose: Vector store tool for agents
132
+ - Configuration: "Company Knowledge Base – use this to find relevant policy documents"
133
+ - Best practices: Use descriptive tool names, set appropriate retrieval limits (3-5 results)
134
+
135
+ **OpenAI** (@n8n/n8n-nodes-langchain.openAi):
136
+ - Purpose: Chat model for generating responses
137
+ - Configuration:
138
+ - Temperature: 0-0.3 for factual Q&A
139
+ - System prompt: "Answer using only the information from our knowledge base"
140
+ - Best practices: Use low temperature for accuracy, instruct to admit when unsure
141
+
142
+ **Memory Window Buffer** (@n8n/n8n-nodes-langchain.memoryBufferWindow):
143
+ - Purpose: Maintain conversation history
144
+ - Configuration: 3-5 message turns typically sufficient
145
+ - Best practices: Balance context preservation with token limits
146
+
147
+ ### Utility
148
+
149
+ **Switch** (n8n-nodes-base.switch):
150
+ - Purpose: Route by file type or content type
151
+ - Use cases: Different processing for PDFs vs text vs images
152
+ - Best practices: Always define default case, use clear conditions
153
+
154
+ **Execute Workflow** (n8n-nodes-base.executeWorkflow):
155
+ - Purpose: Call sub-workflows for modular design
156
+ - Use cases: Reuse query workflow across channels, separate ingestion logic
157
+ - Best practices: Design for reusability, pass appropriate parameters
158
+
159
+ ## Common Pitfalls to Avoid
160
+
161
+ ### Critical Mistakes
162
+
163
+ **Inconsistent Embeddings**:
164
+ - **Problem**: Using different embedding models for indexing vs queries breaks semantic search
165
+ - **Solution**: Always use the same model throughout (e.g., text-embedding-ada-002 for both)
166
+ - Document which model is used in workflow description
167
+
168
+ **Vector Dimension Mismatch**:
169
+ - **Problem**: Index dimensions don't match embedding model output, causing errors
170
+ - **Solution**: Ensure vector store index dimensions match embedding model output exactly
171
+ - Common: ada-002 = 1536 dimensions, text-embedding-3-small = 1536 dimensions
172
+
173
+ **Missing Updates**:
174
+ - **Problem**: Not updating or removing outdated vectors leads to conflicting information
175
+ - **Solution**: Implement update/delete mechanisms with unique IDs
176
+ - Use document ID + chunk number as unique identifier
177
+ - Schedule regular re-indexing for changing content
178
+
179
+ **Treating Vector DB as Full Database**:
180
+ - **Problem**: Using vector stores for general data storage instead of semantic search
181
+ - **Solution**: Vector DBs are for semantic search only, not bulk data storage
182
+ - Store full documents in traditional databases, only embeddings in vector store
183
+
184
+ ### Performance Issues
185
+
186
+ **Oversized Chunks**:
187
+ - **Problem**: Large chunks dilute relevance and exceed token limits
188
+ - **Solution**: Keep chunks to 500-1000 characters (~200 tokens)
189
+ - Test different sizes to find optimal retrieval quality
190
+
191
+ **Undersized Chunks**:
192
+ - **Problem**: Too small chunks lose necessary context
193
+ - **Solution**: Ensure chunks have sufficient context to be meaningful
194
+ - Use 10-15% overlap between chunks
195
+
196
+ **Too Many Retrieved Documents**:
197
+ - **Problem**: Retrieving 10+ documents overwhelms LLM and reduces accuracy
198
+ - **Solution**: Limit to 3-5 results for optimal quality
199
+ - Use similarity thresholds to filter irrelevant matches
200
+
201
+ **UI Overload**:
202
+ - **Problem**: Indexing thousands of chunks freezes workflow editor
203
+ - **Solution**: Run large indexing jobs in production mode, not editor
204
+ - Consider batch processing for very large datasets
205
+
206
+ ### Configuration Errors
207
+
208
+ **No Metadata**:
209
+ - **Problem**: Missing source/date metadata makes results less interpretable
210
+ - **Solution**: Always include metadata (source, title, page number, date)
211
+ - Helps users understand context of retrieved information
212
+
213
+ **No Unique IDs**:
214
+ - **Problem**: Can't update specific documents, causes duplicates
215
+ - **Solution**: Use document ID + chunk number as unique identifier
216
+ - Enables targeted updates and deletions
217
+
218
+ **High Temperature**:
219
+ - **Problem**: Creative temperature settings cause hallucinations in factual Q&A
220
+ - **Solution**: Use temperature 0-0.3 for factual responses
221
+ - Higher temperatures (0.7-1.0) only for creative tasks
222
+
223
+ **Generic Tool Descriptions**:
224
+ - **Problem**: Vague descriptions cause agents to misuse tools
225
+ - **Solution**: Use specific, descriptive tool names
226
+ - Good: "Company HR Policy Knowledge Base"
227
+ - Bad: "Knowledge base"
228
+
229
+ ### Data Management
230
+
231
+ **Stale Data**:
232
+ - **Problem**: Outdated information in knowledge base leads to wrong answers
233
+ - **Solution**: Schedule regular re-indexing or implement change detection
234
+ - Use document timestamps to track freshness
235
+
236
+ **No Namespace Separation**:
237
+ - **Problem**: Mixing unrelated domains in same index reduces accuracy
238
+ - **Solution**: Use namespaces to separate different knowledge domains
239
+ - Example: "hr-policies", "technical-docs", "customer-faqs"
240
+
241
+ **Ignoring Token Limits**:
242
+ - **Problem**: Combined length of query + context + response exceeds model limits
243
+ - **Solution**: Monitor total token usage, limit context appropriately
244
+ - GPT-4: 8k/32k tokens, GPT-3.5: 4k/16k tokens
245
+
246
+ **Security Gaps**:
247
+ - **Problem**: Sending sensitive data without access control or encryption
248
+ - **Solution**: Implement proper access controls, use secure connections
249
+ - Consider data classification and access restrictions
250
+
251
+ ## Best Practices Summary
252
+
253
+ 1. **Always use consistent embedding models** throughout the pipeline
254
+ 2. **Design modular workflows** for reusability across channels
255
+ 3. **Include metadata** for better context and filtering
256
+ 4. **Implement proper update/delete mechanisms** with unique IDs
257
+ 5. **Test chunk sizes** for optimal retrieval quality (500-1000 characters)
258
+ 6. **Run large indexing operations** in production mode
259
+ 7. **Set appropriate retrieval limits** (3-5 results) and similarity thresholds
260
+ 8. **Use low temperature** (0-0.3) for factual responses
261
+ 9. **Secure sensitive data** with proper access controls
262
+ 10. **Monitor and update** regularly to prevent stale information
263
+ `;
264
+ }
265
+ getDocumentation() {
266
+ return this.documentation;
267
+ }
268
+ }
269
+ exports.KnowledgeBaseBestPractices = KnowledgeBaseBestPractices;
270
+ //# sourceMappingURL=knowledge-base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knowledge-base.js","sourceRoot":"","sources":["../../../../src/prompts/best-practices/guides/knowledge-base.ts"],"names":[],"mappings":";;;AACA,oCAA6C;AAE7C,MAAa,0BAA0B;IAAvC;QACU,cAAS,GAAG,yBAAiB,CAAC,cAAc,CAAC;QAC7C,YAAO,GAAG,OAAO,CAAC;QAEV,kBAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8PjC,CAAC;IAKF,CAAC;IAHA,gBAAgB;QACf,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;CACD;AAvQD,gEAuQC"}
@@ -0,0 +1,7 @@
1
+ import type { BestPracticesDocument } from '../types';
2
+ export declare class MonitoringBestPractices implements BestPracticesDocument {
3
+ readonly technique: "monitoring";
4
+ readonly version = "1.0.0";
5
+ private readonly documentation;
6
+ getDocumentation(): string;
7
+ }
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MonitoringBestPractices = void 0;
4
+ const types_1 = require("../types");
5
+ class MonitoringBestPractices {
6
+ constructor() {
7
+ this.technique = types_1.WorkflowTechnique.MONITORING;
8
+ this.version = '1.0.0';
9
+ this.documentation = `# Best Practices: Monitoring Workflows
10
+
11
+ ## Workflow Design
12
+
13
+ Structure monitoring workflows with a Schedule Trigger for periodic checks, HTTP Request or appropriate check nodes for service status, and IF/Switch nodes for conditional alerting. Always enable error handling to prevent workflow crashes when services are down.
14
+
15
+ CRITICAL: Enable "Continue On Fail" or "Never Error" mode on check nodes - otherwise the workflow stops exactly when you need alerts. This is the most common monitoring mistake.
16
+
17
+ Example pattern for website monitoring:
18
+ - Schedule Trigger (every 5 minutes) → HTTP Request (check status) → IF (status != 200?) → Send alert
19
+ - Always test both success and failure paths during development
20
+
21
+ For monitoring multiple services, store URLs/endpoints in Google Sheets or databases and loop through them rather than duplicating workflows.
22
+
23
+ ## Scheduling
24
+
25
+ Configure appropriate check intervals based on criticality:
26
+ - Critical services: 1-5 minutes
27
+ - Important services: 10-15 minutes
28
+ - Non-critical: 30-60 minutes
29
+
30
+ Set correct time zones in Workflow Settings for daily/weekly schedules. Use crontab.guru to verify complex Cron expressions.
31
+
32
+ ## Service Status Checking
33
+
34
+ Configure HTTP Request nodes with:
35
+ - Timeout: Set to a few seconds to prevent hanging
36
+ - Include Headers & Status: Access response codes for condition evaluation
37
+ - Retry on Fail: 2-3 retries with 1s delay to filter transient failures
38
+ - Authentication: Use credential system, never hardcode secrets
39
+
40
+ For non-HTTP monitoring:
41
+ - Databases: Use Query nodes (MySQL, Postgres) for health checks
42
+ - Systems: Execute Command node for ping or custom scripts
43
+ - APIs: Check specific endpoints, not just base URLs
44
+
45
+ ## Alert Configuration
46
+
47
+ Implement multi-channel alerting for critical services to ensure visibility. Configure notifications with useful context.
48
+
49
+ Message content should include:
50
+ - Service name/URL
51
+ - Failure time: {{$now}}
52
+ - Error details: {{$json["statusCode"]}}
53
+ - Example: "⚠️ Website XYZ DOWN (status 500) at {{new Date().toISOString()}}"
54
+
55
+ Avoid alert storms by:
56
+ - Tracking state changes (only alert when status changes)
57
+ - Throttling repeated alerts (e.g., re-alert after 30 minutes)
58
+ - Storing last known status in Google Sheets or database
59
+
60
+ ## Error Handling & Failsafes
61
+
62
+ Implement multiple layers of error handling:
63
+
64
+ 1. Node-level: Enable "Continue On Fail" on check nodes
65
+ 2. Workflow-level: Create Error Trigger workflow to catch monitoring failures
66
+ 3. Heartbeat: Ping external service (healthchecks.io) to verify monitoring is running
67
+
68
+ Configure Error Workflow in settings to alert when monitoring itself fails - otherwise you have blind spots.
69
+
70
+ ## Logging & State Management
71
+
72
+ Log check results for trend analysis and uptime calculation. Store in Google Sheets (append row) or database with:
73
+ - Timestamp
74
+ - Service identifier
75
+ - Status (up/down)
76
+ - Response time
77
+ - Error details if applicable
78
+
79
+ Maintain current status dashboard by updating a status table/sheet that shows at-a-glance health of all monitored services.
80
+
81
+ ## Recommended Nodes
82
+
83
+ ### Schedule Trigger (n8n-nodes-base.scheduleTrigger)
84
+
85
+ Purpose: Periodic workflow execution at fixed intervals or Cron schedules
86
+
87
+ Configuration:
88
+ - Set appropriate intervals based on service criticality
89
+
90
+ ### HTTP Request (n8n-nodes-base.httpRequest)
91
+
92
+ Purpose: Check website/API availability and response codes
93
+
94
+ Critical settings:
95
+ - Enable "Continue On Fail" to handle errors gracefully
96
+ - Set timeout to prevent hanging (2-5 seconds typical)
97
+ - Configure retries for transient failure filtering
98
+
99
+ ### IF (n8n-nodes-base.if)
100
+
101
+ Purpose: Evaluate service health and route to appropriate action
102
+
103
+ Common conditions:
104
+ - {{$json["statusCode"]}} equals 200 (service up)
105
+ - {{$json["statusCode"]}} not equals 200 (service down)
106
+
107
+ ### Send Email (n8n-nodes-base.emailSend)
108
+
109
+ Purpose: Email alerts for service issues
110
+
111
+ Configure with SMTP credentials and clear subject lines for quick issue identification.
112
+
113
+ ### Messaging Integration Nodes
114
+
115
+ - Slack (n8n-nodes-base.slack)
116
+ - Microsoft Teams (n8n-nodes-base.microsoftTeams)
117
+ - Telegram (n8n-nodes-base.telegram)
118
+ - Discord (n8n-nodes-base.discord)
119
+
120
+ Purpose: Real-time alerts to team communication channels
121
+
122
+ ### Twilio (n8n-nodes-base.twilio)
123
+
124
+ Purpose: SMS/phone alerts for critical system failures requiring immediate attention
125
+
126
+ ### Database & Storage Nodes
127
+
128
+ - Google Sheets (n8n-nodes-base.googleSheets)
129
+ - MySQL (n8n-nodes-base.mySql)
130
+ - PostgreSQL (n8n-nodes-base.postgres)
131
+
132
+ Purpose: Store monitoring configuration, log results, track state changes
133
+
134
+ ### Execute Workflow (n8n-nodes-base.executeWorkflow)
135
+
136
+ Purpose: Modular monitoring design with sub-workflows for different service types
137
+
138
+ ## Common Pitfalls to Avoid
139
+
140
+ ### No Error Handling on Check Nodes
141
+
142
+ Without "Continue On Fail", the workflow crashes when services are down - exactly when you need alerts. This makes monitoring useless at the critical moment.
143
+
144
+ ### Alert Storms
145
+
146
+ Sending alerts every check interval creates fatigue. Implement state tracking to alert only on status changes, not every failed check.
147
+
148
+ ### Incorrect Schedule Configuration
149
+
150
+ Cron expression mistakes can cause workflows to run at wrong times or not at all. A Cron like "* * * * *" runs every minute (not every hour!). Always test schedules.
151
+
152
+ ### Hardcoded Credentials
153
+
154
+ Never hardcode API keys, passwords, or sensitive URLs directly in nodes. Use n8n's credential manager for security and maintainability.
155
+
156
+ ### Missing Recovery Notifications
157
+
158
+ Not sending "service recovered" messages leaves teams uncertain about incident resolution. Track state changes bidirectionally.
159
+
160
+ ### Resource Exhaustion
161
+
162
+ Monitoring too many services in one workflow or setting intervals too frequent can overload n8n. Split large monitoring lists across multiple workflows.
163
+
164
+ ### No Monitoring of Monitoring
165
+
166
+ If the monitoring workflow fails, you're blind to service issues. Implement Error Trigger workflows and external heartbeat monitoring for the monitoring system itself.`;
167
+ }
168
+ getDocumentation() {
169
+ return this.documentation;
170
+ }
171
+ }
172
+ exports.MonitoringBestPractices = MonitoringBestPractices;
173
+ //# sourceMappingURL=monitoring.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"monitoring.js","sourceRoot":"","sources":["../../../../src/prompts/best-practices/guides/monitoring.ts"],"names":[],"mappings":";;;AACA,oCAA6C;AAE7C,MAAa,uBAAuB;IAApC;QACU,cAAS,GAAG,yBAAiB,CAAC,UAAU,CAAC;QACzC,YAAO,GAAG,OAAO,CAAC;QAEV,kBAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wKA6JsI,CAAC;IAKzK,CAAC;IAHA,gBAAgB;QACf,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;CACD;AAtKD,0DAsKC"}
@@ -0,0 +1,7 @@
1
+ import type { BestPracticesDocument } from '../types';
2
+ export declare class NotificationBestPractices implements BestPracticesDocument {
3
+ readonly technique: "notification";
4
+ readonly version = "1.0.0";
5
+ private readonly documentation;
6
+ getDocumentation(): string;
7
+ }
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotificationBestPractices = void 0;
4
+ const types_1 = require("../types");
5
+ class NotificationBestPractices {
6
+ constructor() {
7
+ this.technique = types_1.WorkflowTechnique.NOTIFICATION;
8
+ this.version = '1.0.0';
9
+ this.documentation = `# Best Practices: Notification Workflows
10
+
11
+ ## Workflow Design
12
+
13
+ Structure notification workflows in a clear sequence. Keep each part modular with nodes dedicated to specific purposes.
14
+
15
+ \`\`\`mermaid
16
+ graph LR
17
+ A[Trigger] --> B[Data Retrieval/Processing]
18
+ B --> C[Condition Check]
19
+ C --> D[Notification Action]
20
+ D --> E[Post-Notification: logging/tracking]
21
+ \`\`\`
22
+
23
+ Choose between event-based triggers (webhooks, form submissions, CRM events) for immediate notifications or scheduled triggers (Cron) for periodic condition monitoring.
24
+
25
+ CRITICAL: Multi-channel notifications should branch from a single condition check to multiple notification nodes in parallel, not duplicate the entire workflow. This enables easy extension and maintenance.
26
+
27
+ Example pattern:
28
+ \`\`\`mermaid
29
+ graph LR
30
+ A[Webhook/Schedule Trigger] --> B[Fetch Data]
31
+ B --> C[If: threshold exceeded]
32
+ C -->|true| D[Email]
33
+ C -->|true| E[Slack]
34
+ C -->|true| F[SMS]
35
+ C -->|false| G[End/Log]
36
+ \`\`\`
37
+ Result: Single workflow handles all channels efficiently with consistent logic
38
+
39
+ ## Condition Logic & Filtering
40
+
41
+ Use IF nodes for simple checks without code. For complex conditions (multiple fields, array filtering), use Code nodes to script the logic and filter items that need alerts.
42
+
43
+ Always include empty notification prevention - check that alert-worthy items exist (items.length > 0) before proceeding to notification nodes. Route the false branch to end the workflow or log "no alert needed".
44
+
45
+ ## Message Construction
46
+
47
+ Use expressions to inject dynamic data into messages. The expression \`{{ $json.fieldName }}\` pulls data from input items.
48
+
49
+ Format messages appropriately for each channel:
50
+ - Email: Support HTML or plain text, use clear subject lines
51
+ - Slack: Use markdown-like formatting, \\n for newlines
52
+ - SMS: Keep concise due to character limits, plain text only
53
+
54
+ ## Alert Management
55
+
56
+ Consider alert aggregation - send one message listing multiple items rather than individual alerts.
57
+
58
+ Add logging nodes to track sent notifications for audit trails and duplicate prevention. Consider using error handling paths with Continue on Fail settings for redundancy.
59
+
60
+ ## Recommended Nodes
61
+
62
+ ### Trigger Nodes
63
+
64
+ **Service-specific triggers** (e.g., n8n-nodes-base.googleSheetsTrigger, n8n-nodes-base.crmTrigger):
65
+ - Purpose: Direct integration with specific services for event-based notifications
66
+ - Use cases: New row in Google Sheets, CRM record updates
67
+ - When to use: When specific trigger node is available
68
+
69
+ **Webhook** (n8n-nodes-base.webhook):
70
+ - Purpose: Event-based notifications triggered by external systems
71
+ - Use cases: Form submissions, CRM events, API webhooks
72
+ - When to use: When there is no dedicated trigger node and external service supports webhooks
73
+
74
+ **Schedule Trigger** (n8n-nodes-base.scheduleTrigger):
75
+ - Purpose: Periodic monitoring and batch notifications
76
+ - Use cases: Daily reports, threshold monitoring, scheduled alerts
77
+ - When to use: For regular checks rather than immediate alerts, or as a polling mechanism when webhooks are not available
78
+
79
+ **Form Trigger** (n8n-nodes-base.formTrigger):
80
+ - Purpose: User-submitted data triggering notifications
81
+ - Use cases: Contact forms, feedback submissions
82
+ - When to use: For workflows initiated by user input via forms
83
+
84
+ ### Notification Nodes
85
+
86
+ **Send Email** (n8n-nodes-base.emailSend):
87
+ - Purpose: Detailed alerts with attachments and HTML formatting
88
+ - Use cases: Reports, detailed notifications, formal communications
89
+ - Configuration: SMTP settings, use App Passwords for Gmail
90
+ - Best practice: Use clear subject lines with key information
91
+
92
+ **Slack** (n8n-nodes-base.slack):
93
+ - Purpose: Team notifications in channels or direct messages
94
+ - Use cases: Team alerts, status updates, incident notifications
95
+ - Configuration: Bot token with chat:write scope, bot must be invited to channel
96
+ - Best practice: Use markdown formatting, channel IDs (starting with C) not names
97
+
98
+ **Telegram** (n8n-nodes-base.telegram):
99
+ - Purpose: Instant messaging alerts to individuals or groups
100
+ - Use cases: Personal notifications, bot interactions
101
+ - Configuration: Bot token from BotFather
102
+ - Best practice: Use chat ID for direct messages
103
+
104
+ **Twilio** (n8n-nodes-base.twilio):
105
+ - Purpose: SMS/WhatsApp critical alerts
106
+ - Use cases: High-priority alerts, two-factor authentication, critical incidents
107
+ - Configuration: Account SID, Auth Token, verified phone numbers
108
+ - Best practice: Keep messages concise, use international format (+1234567890)
109
+
110
+ **HTTP Request** (n8n-nodes-base.httpRequest):
111
+ - Purpose: Custom webhooks (Microsoft Teams, Discord, custom APIs)
112
+ - Use cases: Integration with services without dedicated nodes
113
+
114
+ ### Logic & Processing
115
+
116
+ **IF** (n8n-nodes-base.if):
117
+ - Purpose: Simple threshold checks and condition routing
118
+ - Use cases: Check if notification criteria met
119
+ - Best practice: Include empty notification prevention (items.length > 0)
120
+
121
+ **Switch** (n8n-nodes-base.switch):
122
+ - Purpose: Route notifications based on severity/type
123
+ - Use cases: Different channels for different alert levels
124
+ - Best practice: Always define Default case for unexpected values
125
+
126
+ **Set** (n8n-nodes-base.set):
127
+ - Purpose: Prepare alert messages and structure data
128
+ - Use cases: Format notification content, add metadata
129
+ - Best practice: Use to centralize message construction logic
130
+ `;
131
+ }
132
+ getDocumentation() {
133
+ return this.documentation;
134
+ }
135
+ }
136
+ exports.NotificationBestPractices = NotificationBestPractices;
137
+ //# sourceMappingURL=notification.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.js","sourceRoot":"","sources":["../../../../src/prompts/best-practices/guides/notification.ts"],"names":[],"mappings":";;;AACA,oCAA6C;AAE7C,MAAa,yBAAyB;IAAtC;QACU,cAAS,GAAG,yBAAiB,CAAC,YAAY,CAAC;QAC3C,YAAO,GAAG,OAAO,CAAC;QAEV,kBAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyHjC,CAAC;IAKF,CAAC;IAHA,gBAAgB;QACf,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;CACD;AAlID,8DAkIC"}
@@ -0,0 +1,7 @@
1
+ import type { BestPracticesDocument } from '../types';
2
+ export declare class SchedulingBestPractices implements BestPracticesDocument {
3
+ readonly technique: "scheduling";
4
+ readonly version = "1.0.0";
5
+ private readonly documentation;
6
+ getDocumentation(): string;
7
+ }