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,386 @@
1
+ # n8n Code Python Skill
2
+
3
+ Expert guidance for writing Python code in n8n Code nodes.
4
+
5
+ ---
6
+
7
+ ## ⚠️ Important: JavaScript First
8
+
9
+ **Use JavaScript for 95% of use cases.**
10
+
11
+ Python in n8n has **NO external libraries** (no requests, pandas, numpy).
12
+
13
+ **When to use Python**:
14
+ - You have complex Python-specific logic
15
+ - You need Python's standard library features
16
+ - You're more comfortable with Python than JavaScript
17
+
18
+ **When to use JavaScript** (recommended):
19
+ - HTTP requests ($helpers.httpRequest available)
20
+ - Date/time operations (Luxon library included)
21
+ - Most data transformations
22
+ - When in doubt
23
+
24
+ ---
25
+
26
+ ## What This Skill Teaches
27
+
28
+ ### Core Concepts
29
+
30
+ 1. **Critical Limitation**: No external libraries
31
+ 2. **Data Access**: `_input.all()`, `_input.first()`, `_input.item`
32
+ 3. **Webhook Gotcha**: Data is under `_json["body"]`
33
+ 4. **Return Format**: Must return `[{"json": {...}}]`
34
+ 5. **Standard Library**: json, datetime, re, base64, hashlib, etc.
35
+
36
+ ### Top 5 Error Prevention
37
+
38
+ This skill emphasizes **error prevention**:
39
+
40
+ 1. **ModuleNotFoundError** (trying to import external libraries)
41
+ 2. **Empty code / missing return**
42
+ 3. **KeyError** (dictionary access without .get())
43
+ 4. **IndexError** (list access without bounds checking)
44
+ 5. **Incorrect return format**
45
+
46
+ These 5 errors are the most common in Python Code nodes.
47
+
48
+ ---
49
+
50
+ ## Skill Activation
51
+
52
+ This skill activates when you:
53
+ - Write Python in Code nodes
54
+ - Ask about Python limitations
55
+ - Need to know available standard library
56
+ - Troubleshoot Python Code node errors
57
+ - Work with Python data structures
58
+
59
+ **Example queries**:
60
+ - "Can I use pandas in Python Code node?"
61
+ - "How do I access webhook data in Python?"
62
+ - "What Python libraries are available?"
63
+ - "Write Python code to process JSON"
64
+ - "Why is requests module not found?"
65
+
66
+ ---
67
+
68
+ ## File Structure
69
+
70
+ ### SKILL.md (719 lines)
71
+ **Quick start** and overview
72
+ - When to use Python vs JavaScript
73
+ - Critical limitation (no external libraries)
74
+ - Mode selection (All Items vs Each Item)
75
+ - Data access overview
76
+ - Return format requirements
77
+ - Standard library overview
78
+
79
+ ### DATA_ACCESS.md (703 lines)
80
+ **Complete data access patterns**
81
+ - `_input.all()` - Process all items
82
+ - `_input.first()` - Get first item
83
+ - `_input.item` - Current item (Each Item mode)
84
+ - `_node["Name"]` - Reference other nodes
85
+ - Webhook body structure (critical gotcha!)
86
+ - Pattern selection guide
87
+
88
+ ### STANDARD_LIBRARY.md (850 lines)
89
+ **Available Python modules**
90
+ - json - JSON parsing
91
+ - datetime - Date/time operations
92
+ - re - Regular expressions
93
+ - base64 - Encoding/decoding
94
+ - hashlib - Hashing
95
+ - urllib.parse - URL operations
96
+ - math, random, statistics
97
+ - What's NOT available (requests, pandas, numpy)
98
+ - Workarounds for missing libraries
99
+
100
+ ### COMMON_PATTERNS.md (895 lines)
101
+ **10 production-tested patterns**
102
+ 1. Multi-source data aggregation
103
+ 2. Regex-based filtering
104
+ 3. Markdown to structured data
105
+ 4. JSON object comparison
106
+ 5. CRM data transformation
107
+ 6. Release notes processing
108
+ 7. Array transformation
109
+ 8. Dictionary lookup
110
+ 9. Top N filtering
111
+ 10. String aggregation
112
+
113
+ ### ERROR_PATTERNS.md (730 lines)
114
+ **Top 5 errors with solutions**
115
+ 1. ModuleNotFoundError (external libraries)
116
+ 2. Empty code / missing return
117
+ 3. KeyError (dictionary access)
118
+ 4. IndexError (list access)
119
+ 5. Incorrect return format
120
+ - Error prevention checklist
121
+ - Quick fix reference
122
+ - Testing patterns
123
+
124
+ ---
125
+
126
+ ## Integration with Other Skills
127
+
128
+ This skill works with:
129
+
130
+ ### n8n Expression Syntax
131
+ - Python uses code syntax, not {{}} expressions
132
+ - Data access patterns differ ($ vs _)
133
+
134
+ ### n8n MCP Tools Expert
135
+ - Use MCP tools to validate Code node configurations
136
+ - Check node setup with `get_node_essentials`
137
+
138
+ ### n8n Workflow Patterns
139
+ - Code nodes fit into larger workflow patterns
140
+ - Often used after HTTP Request or Webhook nodes
141
+
142
+ ### n8n Code JavaScript
143
+ - Compare Python vs JavaScript approaches
144
+ - Understand when to use which language
145
+ - JavaScript recommended for 95% of cases
146
+
147
+ ### n8n Node Configuration
148
+ - Configure Code node mode (All Items vs Each Item)
149
+ - Set up proper connections
150
+
151
+ ---
152
+
153
+ ## Success Metrics
154
+
155
+ After using this skill, you should be able to:
156
+
157
+ - [ ] **Know the limitation**: Python has NO external libraries
158
+ - [ ] **Choose language**: JavaScript for 95% of cases, Python when needed
159
+ - [ ] **Access data**: Use `_input.all()`, `_input.first()`, `_input.item`
160
+ - [ ] **Handle webhooks**: Access data via `_json["body"]`
161
+ - [ ] **Return properly**: Always return `[{"json": {...}}]`
162
+ - [ ] **Avoid KeyError**: Use `.get()` for dictionary access
163
+ - [ ] **Use standard library**: Know what's available (json, datetime, re, etc.)
164
+ - [ ] **Prevent errors**: Avoid top 5 common errors
165
+ - [ ] **Choose alternatives**: Use n8n nodes when libraries needed
166
+ - [ ] **Write production code**: Use proven patterns
167
+
168
+ ---
169
+
170
+ ## Quick Reference
171
+
172
+ ### Data Access
173
+ ```python
174
+ all_items = _input.all()
175
+ first_item = _input.first()
176
+ current_item = _input.item # Each Item mode only
177
+ other_node = _node["NodeName"]
178
+ ```
179
+
180
+ ### Webhook Data
181
+ ```python
182
+ webhook = _input.first()["json"]
183
+ body = webhook.get("body", {})
184
+ name = body.get("name")
185
+ ```
186
+
187
+ ### Safe Dictionary Access
188
+ ```python
189
+ # ✅ Use .get() with defaults
190
+ value = data.get("field", "default")
191
+
192
+ # ❌ Risky - may raise KeyError
193
+ value = data["field"]
194
+ ```
195
+
196
+ ### Return Format
197
+ ```python
198
+ # ✅ Correct format
199
+ return [{"json": {"result": "success"}}]
200
+
201
+ # ❌ Wrong - plain dict
202
+ return {"result": "success"}
203
+ ```
204
+
205
+ ### Standard Library
206
+ ```python
207
+ # ✅ Available
208
+ import json
209
+ import datetime
210
+ import re
211
+ import base64
212
+ import hashlib
213
+
214
+ # ❌ NOT available
215
+ import requests # ModuleNotFoundError!
216
+ import pandas # ModuleNotFoundError!
217
+ import numpy # ModuleNotFoundError!
218
+ ```
219
+
220
+ ---
221
+
222
+ ## Common Use Cases
223
+
224
+ ### Use Case 1: Process Webhook Data
225
+ ```python
226
+ webhook = _input.first()["json"]
227
+ body = webhook.get("body", {})
228
+
229
+ return [{
230
+ "json": {
231
+ "name": body.get("name"),
232
+ "email": body.get("email"),
233
+ "processed": True
234
+ }
235
+ }]
236
+ ```
237
+
238
+ ### Use Case 2: Filter and Transform
239
+ ```python
240
+ all_items = _input.all()
241
+
242
+ active = [
243
+ {"json": {**item["json"], "filtered": True}}
244
+ for item in all_items
245
+ if item["json"].get("status") == "active"
246
+ ]
247
+
248
+ return active
249
+ ```
250
+
251
+ ### Use Case 3: Aggregate Statistics
252
+ ```python
253
+ import statistics
254
+
255
+ all_items = _input.all()
256
+ amounts = [item["json"].get("amount", 0) for item in all_items]
257
+
258
+ return [{
259
+ "json": {
260
+ "total": sum(amounts),
261
+ "average": statistics.mean(amounts) if amounts else 0,
262
+ "count": len(amounts)
263
+ }
264
+ }]
265
+ ```
266
+
267
+ ### Use Case 4: Parse JSON String
268
+ ```python
269
+ import json
270
+
271
+ data = _input.first()["json"]["body"]
272
+ json_string = data.get("payload", "{}")
273
+
274
+ try:
275
+ parsed = json.loads(json_string)
276
+ return [{"json": parsed}]
277
+ except json.JSONDecodeError:
278
+ return [{"json": {"error": "Invalid JSON"}}]
279
+ ```
280
+
281
+ ---
282
+
283
+ ## Limitations and Workarounds
284
+
285
+ ### Limitation 1: No HTTP Requests Library
286
+ **Problem**: No `requests` library
287
+ **Workaround**: Use HTTP Request node or JavaScript
288
+
289
+ ### Limitation 2: No Data Analysis Library
290
+ **Problem**: No `pandas` or `numpy`
291
+ **Workaround**: Use list comprehensions and standard library
292
+
293
+ ### Limitation 3: No Database Drivers
294
+ **Problem**: No `psycopg2`, `pymongo`, etc.
295
+ **Workaround**: Use n8n database nodes (Postgres, MySQL, MongoDB)
296
+
297
+ ### Limitation 4: No Web Scraping
298
+ **Problem**: No `beautifulsoup4` or `selenium`
299
+ **Workaround**: Use HTML Extract node
300
+
301
+ ---
302
+
303
+ ## Best Practices
304
+
305
+ 1. **Use JavaScript for most cases** (95% recommendation)
306
+ 2. **Use .get() for dictionaries** (avoid KeyError)
307
+ 3. **Check lengths before indexing** (avoid IndexError)
308
+ 4. **Always return proper format**: `[{"json": {...}}]`
309
+ 5. **Access webhook data via ["body"]**
310
+ 6. **Use standard library only** (no external imports)
311
+ 7. **Handle empty input** (check `if items:`)
312
+ 8. **Test both modes** (All Items and Each Item)
313
+
314
+ ---
315
+
316
+ ## When Python is the Right Choice
317
+
318
+ Use Python when:
319
+ - Complex text processing (re module)
320
+ - Mathematical calculations (math, statistics)
321
+ - Date/time manipulation (datetime)
322
+ - Cryptographic operations (hashlib)
323
+ - You have existing Python logic to reuse
324
+ - Team is more comfortable with Python
325
+
326
+ Use JavaScript instead when:
327
+ - Making HTTP requests
328
+ - Working with dates (Luxon included)
329
+ - Most data transformations
330
+ - When in doubt
331
+
332
+ ---
333
+
334
+ ## Learning Path
335
+
336
+ **Beginner**:
337
+ 1. Read SKILL.md - Understand the limitation
338
+ 2. Try DATA_ACCESS.md examples - Learn `_input` patterns
339
+ 3. Practice safe dictionary access with `.get()`
340
+
341
+ **Intermediate**:
342
+ 4. Study STANDARD_LIBRARY.md - Know what's available
343
+ 5. Try COMMON_PATTERNS.md examples - Use proven patterns
344
+ 6. Learn ERROR_PATTERNS.md - Avoid common mistakes
345
+
346
+ **Advanced**:
347
+ 7. Combine multiple patterns
348
+ 8. Use standard library effectively
349
+ 9. Know when to switch to JavaScript
350
+ 10. Write production-ready code
351
+
352
+ ---
353
+
354
+ ## Support
355
+
356
+ **Questions?**
357
+ - Check ERROR_PATTERNS.md for common issues
358
+ - Review COMMON_PATTERNS.md for examples
359
+ - Consider using JavaScript instead
360
+
361
+ **Related Skills**:
362
+ - n8n Code JavaScript - Alternative (recommended for 95% of cases)
363
+ - n8n Expression Syntax - For {{}} expressions in other nodes
364
+ - n8n Workflow Patterns - Bigger picture workflow design
365
+
366
+ ---
367
+
368
+ ## Version
369
+
370
+ **Version**: 1.0.0
371
+ **Status**: Production Ready
372
+ **Compatibility**: n8n Code node (Python mode)
373
+
374
+ ---
375
+
376
+ ## Credits
377
+
378
+ Part of the n8n-skills project.
379
+
380
+ **Conceived by Romuald Członkowski**
381
+ - Website: [www.aiadvisors.pl/en](https://www.aiadvisors.pl/en)
382
+ - Part of [n8n-mcp project](https://github.com/czlonkowski/n8n-mcp)
383
+
384
+ ---
385
+
386
+ **Remember**: JavaScript is recommended for 95% of use cases. Use Python only when you specifically need Python's standard library features.