feat: Add n8n-code-javascript skill (Skill #6)

Complete expert guidance for writing JavaScript in n8n Code nodes.

Files added (6 skill files + 5 evaluations):
- SKILL.md (699 lines) - Quick start, mode selection, data access overview
- DATA_ACCESS.md (782 lines) - Complete data access patterns
- COMMON_PATTERNS.md (1,110 lines) - 10 production-tested patterns
- ERROR_PATTERNS.md (763 lines) - Top 5 errors covering 62%+ of failures
- BUILTIN_FUNCTIONS.md (764 lines) - Complete built-in function reference
- README.md (350 lines) - Skill metadata and overview

Total: 4,468 lines across 6 files + 5 evaluation scenarios

Key features:
- Data access patterns: $input.all(), $input.first(), $input.item
- Critical gotcha highlighted: Webhook data under .body
- Return format emphasized: [{json: {...}}]
- Top 5 error patterns with solutions (38%, 8%, 5%, 6% of failures)
- 10 production-tested patterns (multi-source aggregation, regex filtering, etc.)
- Complete built-in function reference ($helpers.httpRequest, DateTime, $jmespath)
- Mode selection guide (All Items vs Each Item)

Evaluations (5):
- eval-001: Webhook body gotcha (most common mistake)
- eval-002: Return format error (missing array wrapper)
- eval-003: HTTP requests with $helpers.httpRequest()
- eval-004: Aggregation pattern with reduce()
- eval-005: Expression syntax confusion (using {{}} in code)

Documentation updates:
- README.md: Updated from 5 to 7 skills
- plugin.json: Added code/javascript/python keywords
- marketplace.json: Updated description to reflect 7 skills

Ready for: Production use

🤖 Generated with Claude Code
Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en
This commit is contained in:
czlonkowski
2025-10-20 14:20:53 +02:00
parent 15285fb390
commit 74e662e1f5
14 changed files with 4634 additions and 7 deletions

View File

@@ -0,0 +1,21 @@
{
"id": "code-js-001",
"skills": ["n8n-code-javascript"],
"query": "I'm getting undefined when trying to access data from my webhook in a Code node. My code is: const name = $json.name; const email = $json.email; Why isn't this working?",
"expected_behavior": [
"Activate n8n-code-javascript skill",
"Explain that webhook data is nested under the .body property",
"Show correct syntax: $json.body.name and $json.body.email",
"Reference DATA_ACCESS.md for webhook structure details",
"Mention this is the #1 most common mistake",
"Optionally show alternative: const webhookData = $json.body; then access webhookData.name"
],
"expected_content": [
"webhook data",
".body",
"$json.body.name",
"DATA_ACCESS.md"
],
"priority": "high",
"notes": "This is the MOST common mistake. Skill must clearly explain .body nesting."
}

View File

@@ -0,0 +1,22 @@
{
"id": "code-js-002",
"skills": ["n8n-code-javascript"],
"query": "My Code node is showing an error: 'Return value must be an array of objects'. My code returns: return {json: {result: 'success', data: processedData}}; What's wrong?",
"expected_behavior": [
"Activate n8n-code-javascript skill",
"Explain the return format must be an ARRAY of objects",
"Show correct syntax: return [{json: {result: 'success', data: processedData}}];",
"Note the square brackets [] wrapping the object",
"Reference ERROR_PATTERNS.md #3 for detailed explanation",
"Show multiple items format as well",
"Emphasize this is error #3 in top 5 errors (5% of failures)"
],
"expected_content": [
"array",
"[{json:",
"ERROR_PATTERNS.md",
"square brackets"
],
"priority": "high",
"notes": "Return format error is 5% of all failures. Must clearly show array wrapper requirement."
}

View File

@@ -0,0 +1,25 @@
{
"id": "code-js-003",
"skills": ["n8n-code-javascript"],
"query": "How do I make an HTTP API call from inside a JavaScript Code node in n8n? I need to call an external API with authentication.",
"expected_behavior": [
"Activate n8n-code-javascript skill",
"Explain $helpers.httpRequest() built-in function",
"Show complete example with method, url, headers",
"Include authentication example (Bearer token or API key)",
"Show try-catch error handling pattern",
"Reference BUILTIN_FUNCTIONS.md for complete API reference",
"Mention this is async, needs await",
"Show both GET and POST examples if appropriate"
],
"expected_content": [
"$helpers.httpRequest",
"await",
"headers",
"Authorization",
"BUILTIN_FUNCTIONS.md",
"try-catch"
],
"priority": "medium",
"notes": "$helpers.httpRequest() is a key built-in function that many users need to learn."
}

View File

@@ -0,0 +1,25 @@
{
"id": "code-js-004",
"skills": ["n8n-code-javascript"],
"query": "I need to sum up all the 'amount' values from multiple items in my Code node. How do I access all items and calculate a total?",
"expected_behavior": [
"Activate n8n-code-javascript skill",
"Show $input.all() to get all items",
"Demonstrate reduce() function for summing",
"Include null handling (item.json.amount || 0)",
"Show complete return format with result",
"Reference COMMON_PATTERNS.md for aggregation patterns",
"Reference DATA_ACCESS.md for $input.all() details",
"Emphasize 'Run Once for All Items' mode",
"Optionally show additional aggregations (count, average)"
],
"expected_content": [
"$input.all()",
"reduce",
"COMMON_PATTERNS.md",
"DATA_ACCESS.md",
"All Items"
],
"priority": "high",
"notes": "Aggregation is a very common use case. Tests understanding of $input.all() and array methods."
}

View File

@@ -0,0 +1,26 @@
{
"id": "code-js-005",
"skills": ["n8n-code-javascript"],
"query": "I'm trying to access a field in my Code node but it's not working. My code is: const userName = '{{ $json.name }}'; I'm getting the literal string instead of the value. What am I doing wrong?",
"expected_behavior": [
"Activate n8n-code-javascript skill",
"Explain that {{ }} expression syntax does NOT work in Code nodes",
"Clarify distinction: {{ }} is for OTHER nodes (Set, IF, HTTP Request)",
"Show correct JavaScript syntax: const userName = $json.name;",
"Show JavaScript template literals for string interpolation: `Hello ${$json.name}`",
"Reference ERROR_PATTERNS.md #2 for detailed explanation",
"Emphasize this is error #2 in top 5 errors (8% of failures)",
"Provide comparison table of when to use expressions vs JavaScript"
],
"expected_content": [
"{{ }}",
"expression syntax",
"JavaScript",
"$json.name",
"template literals",
"ERROR_PATTERNS.md",
"backticks"
],
"priority": "high",
"notes": "Expression syntax confusion is 8% of failures. Critical to understand Code nodes use JavaScript, not expressions."
}