bps-kit 1.2.2 → 1.3.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 (51) hide show
  1. package/.bps-kit.json +4 -4
  2. package/README.md +3 -0
  3. package/implementation_plan.md.resolved +37 -0
  4. package/package.json +2 -2
  5. package/templates/agents-template/ARCHITECTURE.md +21 -9
  6. package/templates/agents-template/agents/automation-specialist.md +157 -0
  7. package/templates/agents-template/rules/GEMINI.md +2 -10
  8. package/templates/agents-template/workflows/automate.md +153 -0
  9. package/templates/skills_normal/n8n-code-javascript/BUILTIN_FUNCTIONS.md +764 -0
  10. package/templates/skills_normal/n8n-code-javascript/COMMON_PATTERNS.md +1110 -0
  11. package/templates/skills_normal/n8n-code-javascript/DATA_ACCESS.md +782 -0
  12. package/templates/skills_normal/n8n-code-javascript/ERROR_PATTERNS.md +763 -0
  13. package/templates/skills_normal/n8n-code-javascript/README.md +350 -0
  14. package/templates/skills_normal/n8n-code-javascript/SKILL.md +699 -0
  15. package/templates/skills_normal/n8n-code-python/COMMON_PATTERNS.md +794 -0
  16. package/templates/skills_normal/n8n-code-python/DATA_ACCESS.md +702 -0
  17. package/templates/skills_normal/n8n-code-python/ERROR_PATTERNS.md +601 -0
  18. package/templates/skills_normal/n8n-code-python/README.md +386 -0
  19. package/templates/skills_normal/n8n-code-python/SKILL.md +748 -0
  20. package/templates/skills_normal/n8n-code-python/STANDARD_LIBRARY.md +974 -0
  21. package/templates/skills_normal/n8n-expression-syntax/COMMON_MISTAKES.md +393 -0
  22. package/templates/skills_normal/n8n-expression-syntax/EXAMPLES.md +483 -0
  23. package/templates/skills_normal/n8n-expression-syntax/README.md +93 -0
  24. package/templates/skills_normal/n8n-expression-syntax/SKILL.md +516 -0
  25. package/templates/skills_normal/n8n-mcp-tools-expert/README.md +99 -0
  26. package/templates/skills_normal/n8n-mcp-tools-expert/SEARCH_GUIDE.md +374 -0
  27. package/templates/skills_normal/n8n-mcp-tools-expert/SKILL.md +642 -0
  28. package/templates/skills_normal/n8n-mcp-tools-expert/VALIDATION_GUIDE.md +442 -0
  29. package/templates/skills_normal/n8n-mcp-tools-expert/WORKFLOW_GUIDE.md +618 -0
  30. package/templates/skills_normal/n8n-node-configuration/DEPENDENCIES.md +789 -0
  31. package/templates/skills_normal/n8n-node-configuration/OPERATION_PATTERNS.md +913 -0
  32. package/templates/skills_normal/n8n-node-configuration/README.md +364 -0
  33. package/templates/skills_normal/n8n-node-configuration/SKILL.md +785 -0
  34. package/templates/skills_normal/n8n-validation-expert/ERROR_CATALOG.md +943 -0
  35. package/templates/skills_normal/n8n-validation-expert/FALSE_POSITIVES.md +720 -0
  36. package/templates/skills_normal/n8n-validation-expert/README.md +290 -0
  37. package/templates/skills_normal/n8n-validation-expert/SKILL.md +689 -0
  38. package/templates/skills_normal/n8n-workflow-patterns/README.md +251 -0
  39. package/templates/skills_normal/n8n-workflow-patterns/SKILL.md +411 -0
  40. package/templates/skills_normal/n8n-workflow-patterns/ai_agent_workflow.md +784 -0
  41. package/templates/skills_normal/n8n-workflow-patterns/database_operations.md +785 -0
  42. package/templates/skills_normal/n8n-workflow-patterns/http_api_integration.md +734 -0
  43. package/templates/skills_normal/n8n-workflow-patterns/scheduled_tasks.md +773 -0
  44. package/templates/skills_normal/n8n-workflow-patterns/webhook_processing.md +545 -0
  45. package/templates/vault/n8n-code-javascript/SKILL.md +10 -10
  46. package/templates/vault/n8n-code-python/SKILL.md +11 -11
  47. package/templates/vault/n8n-expression-syntax/SKILL.md +4 -4
  48. package/templates/vault/n8n-mcp-tools-expert/SKILL.md +9 -9
  49. package/templates/vault/n8n-node-configuration/SKILL.md +2 -2
  50. package/templates/vault/n8n-validation-expert/SKILL.md +3 -3
  51. package/templates/vault/n8n-workflow-patterns/SKILL.md +11 -11
@@ -0,0 +1,350 @@
1
+ # n8n Code JavaScript
2
+
3
+ Expert guidance for writing JavaScript code in n8n Code nodes.
4
+
5
+ ---
6
+
7
+ ## Purpose
8
+
9
+ Teaches how to write effective JavaScript in n8n Code nodes, avoid common errors, and use built-in functions effectively.
10
+
11
+ ---
12
+
13
+ ## Activates On
14
+
15
+ **Trigger keywords**:
16
+ - "javascript code node"
17
+ - "write javascript in n8n"
18
+ - "code node javascript"
19
+ - "$input syntax"
20
+ - "$json syntax"
21
+ - "$helpers.httpRequest"
22
+ - "DateTime luxon"
23
+ - "code node error"
24
+ - "webhook data code"
25
+ - "return format code node"
26
+
27
+ **Common scenarios**:
28
+ - Writing JavaScript code in Code nodes
29
+ - Troubleshooting Code node errors
30
+ - Making HTTP requests from code
31
+ - Working with dates and times
32
+ - Accessing webhook data
33
+ - Choosing between All Items and Each Item mode
34
+
35
+ ---
36
+
37
+ ## What You'll Learn
38
+
39
+ ### Quick Start
40
+ - Mode selection (All Items vs Each Item)
41
+ - Data access patterns ($input.all(), $input.first(), $input.item)
42
+ - Correct return format: `[{json: {...}}]`
43
+ - Webhook data structure (.body nesting)
44
+ - Built-in functions overview
45
+
46
+ ### Data Access Mastery
47
+ - $input.all() - Batch operations (most common)
48
+ - $input.first() - Single item operations
49
+ - $input.item - Each Item mode processing
50
+ - $node - Reference other workflow nodes
51
+ - **Critical gotcha**: Webhook data under `.body`
52
+
53
+ ### Common Patterns (Production-Tested)
54
+ 1. Multi-source Data Aggregation
55
+ 2. Regex Filtering & Pattern Matching
56
+ 3. Markdown Parsing & Structured Extraction
57
+ 4. JSON Comparison & Validation
58
+ 5. CRM Data Transformation
59
+ 6. Release Information Processing
60
+ 7. Array Transformation with Context
61
+ 8. Slack Block Kit Formatting
62
+ 9. Top N Filtering & Ranking
63
+ 10. String Aggregation & Reporting
64
+
65
+ ### Error Prevention
66
+ Top 5 errors to avoid:
67
+ 1. **Empty code / missing return** (38% of failures)
68
+ 2. **Expression syntax confusion** (using `{{}}` in code)
69
+ 3. **Incorrect return format** (missing array wrapper or json property)
70
+ 4. **Unmatched brackets** (string escaping issues)
71
+ 5. **Missing null checks** (crashes on undefined)
72
+
73
+ ### Built-in Functions
74
+ - **$helpers.httpRequest()** - Make HTTP requests
75
+ - **DateTime (Luxon)** - Advanced date/time operations
76
+ - **$jmespath()** - Query JSON structures
77
+ - **$getWorkflowStaticData()** - Persistent storage
78
+ - Standard JavaScript globals (Math, JSON, console)
79
+ - Available Node.js modules (crypto, Buffer, URL)
80
+
81
+ ---
82
+
83
+ ## File Structure
84
+
85
+ ```
86
+ n8n-code-javascript/
87
+ ├── SKILL.md (500 lines)
88
+ │ Overview, quick start, mode selection, best practices
89
+ │ - Mode selection guide (All Items vs Each Item)
90
+ │ - Data access patterns overview
91
+ │ - Return format requirements
92
+ │ - Critical webhook gotcha
93
+ │ - Error prevention overview
94
+ │ - Quick reference checklist
95
+
96
+ ├── DATA_ACCESS.md (400 lines)
97
+ │ Complete data access patterns
98
+ │ - $input.all() - Most common (26% usage)
99
+ │ - $input.first() - Very common (25% usage)
100
+ │ - $input.item - Each Item mode (19% usage)
101
+ │ - $node - Reference other nodes
102
+ │ - Webhook data structure (.body nesting)
103
+ │ - Choosing the right pattern
104
+ │ - Common mistakes to avoid
105
+
106
+ ├── COMMON_PATTERNS.md (600 lines)
107
+ │ 10 production-tested patterns
108
+ │ - Pattern 1: Multi-source Aggregation
109
+ │ - Pattern 2: Regex Filtering
110
+ │ - Pattern 3: Markdown Parsing
111
+ │ - Pattern 4: JSON Comparison
112
+ │ - Pattern 5: CRM Transformation
113
+ │ - Pattern 6: Release Processing
114
+ │ - Pattern 7: Array Transformation
115
+ │ - Pattern 8: Slack Block Kit
116
+ │ - Pattern 9: Top N Filtering
117
+ │ - Pattern 10: String Aggregation
118
+ │ - Pattern selection guide
119
+
120
+ ├── ERROR_PATTERNS.md (450 lines)
121
+ │ Top 5 errors with solutions
122
+ │ - Error #1: Empty Code / Missing Return (38%)
123
+ │ - Error #2: Expression Syntax Confusion (8%)
124
+ │ - Error #3: Incorrect Return Wrapper (5%)
125
+ │ - Error #4: Unmatched Brackets (6%)
126
+ │ - Error #5: Missing Null Checks
127
+ │ - Error prevention checklist
128
+ │ - Quick error reference
129
+ │ - Debugging tips
130
+
131
+ ├── BUILTIN_FUNCTIONS.md (450 lines)
132
+ │ Complete built-in function reference
133
+ │ - $helpers.httpRequest() API reference
134
+ │ - DateTime (Luxon) complete guide
135
+ │ - $jmespath() JSON querying
136
+ │ - $getWorkflowStaticData() persistent storage
137
+ │ - Standard JavaScript globals
138
+ │ - Available Node.js modules
139
+ │ - What's NOT available
140
+
141
+ └── README.md (this file)
142
+ Skill metadata and overview
143
+ ```
144
+
145
+ **Total**: ~2,400 lines across 6 files
146
+
147
+ ---
148
+
149
+ ## Coverage
150
+
151
+ ### Mode Selection
152
+ - **Run Once for All Items** - Recommended for 95% of use cases
153
+ - **Run Once for Each Item** - Specialized cases only
154
+ - Decision guide and performance implications
155
+
156
+ ### Data Access
157
+ - Most common patterns with usage statistics
158
+ - Webhook data structure (critical .body gotcha)
159
+ - Safe access patterns with null checks
160
+ - When to use which pattern
161
+
162
+ ### Error Prevention
163
+ - Top 5 errors covering 62%+ of all failures
164
+ - Clear wrong vs right examples
165
+ - Error prevention checklist
166
+ - Debugging tips and console.log usage
167
+
168
+ ### Production Patterns
169
+ - 10 patterns from real workflows
170
+ - Complete working examples
171
+ - Use cases and key techniques
172
+ - Pattern selection guide
173
+
174
+ ### Built-in Functions
175
+ - Complete $helpers.httpRequest() reference
176
+ - DateTime/Luxon operations (formatting, parsing, arithmetic)
177
+ - $jmespath() for JSON queries
178
+ - Persistent storage with $getWorkflowStaticData()
179
+ - Standard JavaScript and Node.js modules
180
+
181
+ ---
182
+
183
+ ## Critical Gotchas Highlighted
184
+
185
+ ### #1: Webhook Data Structure
186
+ **MOST COMMON MISTAKE**: Webhook data is under `.body`
187
+
188
+ ```javascript
189
+ // ❌ WRONG
190
+ const name = $json.name;
191
+
192
+ // ✅ CORRECT
193
+ const name = $json.body.name;
194
+ ```
195
+
196
+ ### #2: Return Format
197
+ **CRITICAL**: Must return array with json property
198
+
199
+ ```javascript
200
+ // ❌ WRONG
201
+ return {json: {result: 'success'}};
202
+
203
+ // ✅ CORRECT
204
+ return [{json: {result: 'success'}}];
205
+ ```
206
+
207
+ ### #3: Expression Syntax
208
+ **Don't use `{{}}` in Code nodes**
209
+
210
+ ```javascript
211
+ // ❌ WRONG
212
+ const value = "{{ $json.field }}";
213
+
214
+ // ✅ CORRECT
215
+ const value = $json.field;
216
+ ```
217
+
218
+ ---
219
+
220
+ ## Integration with Other Skills
221
+
222
+ ### n8n Expression Syntax
223
+ - **Distinction**: Expressions use `{{}}` in OTHER nodes
224
+ - **Code nodes**: Use JavaScript directly (no `{{}}`)
225
+ - **When to use each**: Code vs expressions decision guide
226
+
227
+ ### n8n MCP Tools Expert
228
+ - Find Code node: `search_nodes({query: "code"})`
229
+ - Get configuration: `get_node_essentials("nodes-base.code")`
230
+ - Validate code: `validate_node_operation()`
231
+
232
+ ### n8n Node Configuration
233
+ - Mode selection (All Items vs Each Item)
234
+ - Language selection (JavaScript vs Python)
235
+ - Understanding property dependencies
236
+
237
+ ### n8n Workflow Patterns
238
+ - Code nodes in transformation step
239
+ - Webhook → Code → API pattern
240
+ - Error handling in workflows
241
+
242
+ ### n8n Validation Expert
243
+ - Validate Code node configuration
244
+ - Handle validation errors
245
+ - Auto-fix common issues
246
+
247
+ ---
248
+
249
+ ## When to Use Code Node
250
+
251
+ **Use Code node when:**
252
+ - ✅ Complex transformations requiring multiple steps
253
+ - ✅ Custom calculations or business logic
254
+ - ✅ Recursive operations
255
+ - ✅ API response parsing with complex structure
256
+ - ✅ Multi-step conditionals
257
+ - ✅ Data aggregation across items
258
+
259
+ **Consider other nodes when:**
260
+ - ❌ Simple field mapping → Use **Set** node
261
+ - ❌ Basic filtering → Use **Filter** node
262
+ - ❌ Simple conditionals → Use **IF** or **Switch** node
263
+ - ❌ HTTP requests only → Use **HTTP Request** node
264
+
265
+ **Code node excels at**: Complex logic that would require chaining many simple nodes
266
+
267
+ ---
268
+
269
+ ## Success Metrics
270
+
271
+ **Before this skill**:
272
+ - Users confused by mode selection
273
+ - Frequent return format errors
274
+ - Expression syntax mistakes
275
+ - Webhook data access failures
276
+ - Missing null check crashes
277
+
278
+ **After this skill**:
279
+ - Clear mode selection guidance
280
+ - Understanding of return format
281
+ - JavaScript vs expression distinction
282
+ - Correct webhook data access
283
+ - Safe null-handling patterns
284
+ - Production-ready code patterns
285
+
286
+ ---
287
+
288
+ ## Quick Reference
289
+
290
+ ### Essential Rules
291
+ 1. Choose "All Items" mode (recommended)
292
+ 2. Access data: `$input.all()`, `$input.first()`, `$input.item`
293
+ 3. **MUST return**: `[{json: {...}}]` format
294
+ 4. **Webhook data**: Under `.body` property
295
+ 5. **No `{{}}` syntax**: Use JavaScript directly
296
+
297
+ ### Most Common Patterns
298
+ - Batch processing → $input.all() + map/filter
299
+ - Single item → $input.first()
300
+ - Aggregation → reduce()
301
+ - HTTP requests → $helpers.httpRequest()
302
+ - Date handling → DateTime (Luxon)
303
+
304
+ ### Error Prevention
305
+ - Always return data
306
+ - Check for null/undefined
307
+ - Use try-catch for risky operations
308
+ - Test with empty input
309
+ - Use console.log() for debugging
310
+
311
+ ---
312
+
313
+ ## Related Documentation
314
+
315
+ - **n8n Code Node Guide**: https://docs.n8n.io/code/code-node/
316
+ - **Built-in Methods Reference**: https://docs.n8n.io/code-examples/methods-variables-reference/
317
+ - **Luxon Documentation**: https://moment.github.io/luxon/
318
+
319
+ ---
320
+
321
+ ## Evaluations
322
+
323
+ **5 test scenarios** covering:
324
+ 1. Webhook body gotcha (most common mistake)
325
+ 2. Return format error (missing array wrapper)
326
+ 3. HTTP request with $helpers.httpRequest()
327
+ 4. Aggregation pattern with $input.all()
328
+ 5. Expression syntax confusion (using `{{}}`)
329
+
330
+ Each evaluation tests skill activation, correct guidance, and reference to appropriate documentation files.
331
+
332
+ ---
333
+
334
+ ## Version History
335
+
336
+ - **v1.0** (2025-01-20): Initial implementation
337
+ - SKILL.md with comprehensive overview
338
+ - DATA_ACCESS.md covering all access patterns
339
+ - COMMON_PATTERNS.md with 10 production patterns
340
+ - ERROR_PATTERNS.md covering top 5 errors
341
+ - BUILTIN_FUNCTIONS.md complete reference
342
+ - 5 evaluation scenarios
343
+
344
+ ---
345
+
346
+ ## Author
347
+
348
+ Conceived by Romuald Członkowski - [www.aiadvisors.pl/en](https://www.aiadvisors.pl/en)
349
+
350
+ Part of the n8n-skills collection.