Commit Graph

7 Commits

Author SHA1 Message Date
czlonkowski
4077036b23 feat: Complete Skill #7 - n8n Code Python
Implements comprehensive Python Code node guidance with critical focus on "NO external libraries" limitation.

## Skill #7 - n8n Code Python

**Critical Message**: Use JavaScript for 95% of use cases.

Python in n8n has NO external libraries (no requests, pandas, numpy).

### Files Created

**Core Skill Files (6 files, 4,205 lines total)**:

1. **SKILL.md** (748 lines)
   - When to use Python vs JavaScript (95% JavaScript recommendation)
   - Critical limitation: NO external libraries
   - Mode selection (All Items vs Each Item)
   - Data access overview (_input, _json, _node)
   - Return format requirements
   - Standard library overview

2. **DATA_ACCESS.md** (702 lines)
   - _input.all() - Process all items
   - _input.first() - Get first item
   - _input.item - Current item (Each Item mode only)
   - _node["Name"] - Reference other nodes
   - Webhook body structure (data under ["body"])
   - Pattern selection guide
   - Python vs JavaScript comparison

3. **STANDARD_LIBRARY.md** (974 lines)
   - Complete reference for available modules
   - json - JSON parsing and generation
   - datetime - Date/time operations
   - re - Regular expressions
   - base64 - Encoding/decoding
   - hashlib - Hashing (MD5, SHA256)
   - urllib.parse - URL operations
   - math, random, statistics
   - What's NOT available (requests, pandas, numpy, etc.)
   - Workarounds for missing libraries

4. **COMMON_PATTERNS.md** (794 lines)
   - 10 production-tested Python patterns
   - Multi-source data aggregation
   - Regex-based filtering
   - Markdown to structured data
   - JSON object comparison
   - CRM data transformation
   - Release notes processing
   - Array transformation
   - Dictionary lookup
   - Top N filtering
   - String aggregation
   - Python vs JavaScript pattern comparison

5. **ERROR_PATTERNS.md** (601 lines)
   - Top 5 Python-specific errors with solutions
   - Error #1: ModuleNotFoundError (THE critical Python error)
   - Error #2: Empty code / missing return
   - Error #3: KeyError (use .get() instead)
   - Error #4: IndexError (check bounds first)
   - Error #5: Incorrect return format
   - Error prevention checklist
   - Quick fix reference table
   - Testing patterns

6. **README.md** (386 lines)
   - Skill metadata and activation triggers
   - "JavaScript First" recommendation prominent
   - What this skill teaches
   - File structure overview
   - Integration with other skills
   - Success metrics checklist
   - Quick reference guide
   - Common use cases
   - Limitations and workarounds
   - Best practices

**Evaluations (5 scenarios)**:

1. **eval-001-module-import-error.json**
   - Tests understanding of external library limitation
   - Scenario: ModuleNotFoundError with requests
   - Expected: Recommend JavaScript or HTTP Request node

2. **eval-002-dictionary-keyerror.json**
   - Tests safe dictionary access with .get()
   - Scenario: KeyError when accessing missing field
   - Expected: Use .get() with default values

3. **eval-003-webhook-body-gotcha.json**
   - Tests webhook data under ["body"] understanding
   - Scenario: KeyError when accessing webhook data directly
   - Expected: Access via data.get("body", {})

4. **eval-004-return-format-error.json**
   - Tests proper return format requirement
   - Scenario: Returning plain dict instead of array
   - Expected: Return [{"json": {...}}]

5. **eval-005-standard-library-usage.json**
   - Tests knowledge of available modules
   - Scenario: What modules for JSON, hashing, dates, regex
   - Expected: json, hashlib, datetime, re (standard library only)

### Key Features

**Critical Limitations Emphasized**:
- NO external libraries (no requests, pandas, numpy)
- JavaScript recommended for 95% of use cases
- Only standard library available
- ModuleNotFoundError is #1 Python error

**Python-Specific Syntax**:
- Underscore prefix: _input, _json, _node (vs $ in JavaScript)
- Dictionary access: _json["body"]["field"] (vs dot notation)
- Safe access: .get() method with defaults

**Complete Standard Library Coverage**:
- 15+ modules documented with examples
- json, datetime, re, base64, hashlib, urllib.parse
- math, random, statistics, collections
- Clear list of what's NOT available
- Workarounds for missing functionality

**Production Patterns**:
- 10 tested patterns adapted from JavaScript
- Python-specific implementations
- List comprehensions and dictionary operations
- Standard library usage examples

**Error Prevention Focus**:
- Top 5 errors cover majority of failures
- ModuleNotFoundError prominently featured
- Safe dictionary access (.get())
- Proper return format emphasized
- Error prevention checklist

### Integration

Works seamlessly with:
- **n8n Code JavaScript**: Compare approaches, know when to use which
- **n8n Expression Syntax**: Different from {{}} expressions
- **n8n MCP Tools Expert**: Validate Code node configurations
- **n8n Workflow Patterns**: Code nodes in larger workflows
- **n8n Node Configuration**: Configure mode and connections

### Statistics

- **6 skill files**: 4,205 lines total
- **5 evaluations**: Cover critical Python scenarios
- **10 patterns**: Production-tested Python code
- **15+ modules**: Standard library coverage
- **5 top errors**: Prevention and solutions

### Design Principles

1. **JavaScript First**: 95% recommendation throughout
2. **Critical Limitation**: NO external libraries emphasized everywhere
3. **Safe Patterns**: .get() for dicts, bounds checking for lists
4. **Proper Format**: [{"json": {...}}] return format
5. **Standard Library**: Complete reference with examples
6. **Error Prevention**: Top 5 errors with solutions

### Recommendation

**Use JavaScript Code node for 95% of use cases.**

Use Python only when:
- Complex Python-specific logic required
- Python standard library features needed
- Team more comfortable with Python than JavaScript

For HTTP requests, date operations, and most transformations → Use JavaScript.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en
2025-10-20 14:33:50 +02:00
czlonkowski
74e662e1f5 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
2025-10-20 14:20:53 +02:00
czlonkowski
97e1d21793 feat: Complete Skill #5 - n8n Node Configuration (ALL 5 SKILLS COMPLETE!)
Implements operation-aware node configuration with progressive discovery.
Completes the final skill in the 5-skill n8n meta-skill collection.

Files created:
- 4 evaluations testing dependencies, operations, conditional fields, tool selection
- SKILL.md (692 lines) - Configuration workflow, progressive discovery, patterns
- DEPENDENCIES.md (671 lines) - displayOptions mechanism, dependency patterns
- OPERATION_PATTERNS.md (783 lines) - 20+ nodes with common configurations
- README.md (380 lines) - Skill metadata with usage statistics

Key features:
- Operation-aware configuration (resource + operation = requirements)
- Property dependencies (displayOptions show/hide rules)
- Progressive discovery (essentials → dependencies → info)
- Configuration workflow (identify → discover → configure → validate → iterate)
- 4 common node patterns (resource/operation, HTTP, database, conditional)
- Tool selection guide (get_node_essentials 91.7% success rate)
- Dependency troubleshooting (field visibility, conditional requirements)
- 20+ node configuration examples with gotchas

Progressive discovery strategy:
1. get_node_essentials (91.7% success, 18s avg from search)
2. get_property_dependencies (when dependencies unclear)
3. get_node_info (only when necessary, full schema)

Property dependency patterns:
- Boolean toggle (sendBody → body)
- Resource/operation cascade (different ops → different fields)
- Type-specific config (string vs number conditions)
- Method-specific fields (GET vs POST)

Common node patterns covered:
- HTTP Request (GET/POST/PUT/DELETE with auth, query, body)
- Webhook (basic/auth/response, $json.body gotcha)
- Slack (post/update/create channel)
- Gmail (send/get with filters)
- Postgres (query/insert/update with parameters)
- Set (fixed values/mapping with types)
- Code (per-item/all-items, no expressions!)
- IF (string/number/boolean, unary vs binary)
- Switch (rules with fallback)
- OpenAI (chat completion with system prompt)
- Schedule (daily/interval/cron with timezone)

Key insights:
- 91.7% configurations succeed with essentials only
- Average 56 seconds between configuration edits (iterative)
- 9,835 essentials calls vs fewer full schema calls
- 18 seconds average from node search to essentials
- Different operations = different requirements (always check!)

Top 5 gotchas documented:
1. Webhook data under $json.body (not $json)
2. POST needs sendBody: true
3. Slack channel format (#name for public)
4. SQL parameterized queries (prevent injection)
5. Schedule timezone must be explicit (DST handling)

displayOptions mechanism:
- show: Field appears when conditions match
- hide: Field disappears when conditions match
- AND logic: All conditions must match
- OR logic: Any value matches
- Nested: Parent value controls child structure

Total: ~2,526 lines across 8 files

Based on analysis of 38,287 workflow updates and 9,835 essentials calls.

🎉 ALL 5 CORE SKILLS NOW COMPLETE! 🎉

Skills completed:
1.  n8n Expression Syntax (1,275 lines)
2.  n8n MCP Tools Expert (1,325 lines)
3.  n8n Workflow Patterns (3,932 lines)
4.  n8n Validation Expert (2,553 lines)
5.  n8n Node Configuration (2,526 lines)

Total: ~11,611 lines across 36 files + 22 evaluations
All skills data-driven from 447,557 real MCP tool usage events.

🤖 Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en
2025-10-20 11:07:32 +02:00
czlonkowski
68770a2e14 feat: Complete Skill #4 - n8n Validation Expert
Implements comprehensive validation error interpretation and systematic fixing guidance.
Addresses the validation feedback loop problem (15,107 loops from 19,113 errors).

Files created:
- 4 evaluations testing error interpretation, false positives, auto-sanitization, validation loop
- SKILL.md (690 lines) - Validation philosophy, loop pattern, profiles, auto-sanitization
- ERROR_CATALOG.md (865 lines) - 9 error types with examples and fixes
- FALSE_POSITIVES.md (669 lines) - 6 false positive patterns with decision framework
- README.md (329 lines) - Skill metadata with telemetry statistics

Key features:
- Error severity levels (errors/warnings/suggestions)
- Validation loop pattern (2-3 iterations, 23s+58s average)
- 4 validation profiles (minimal/runtime/ai-friendly/strict)
- Auto-sanitization system (operator structure fixes)
- False positive recognition (~40% of warnings acceptable)
- Error distribution analysis (missing_required 45%, invalid_value 28%)
- Recovery strategies (progressive validation, error triage, clean connections)
- Decision framework for warning acceptance

Error catalog:
- missing_required (45%) - Required field not provided
- invalid_value (28%) - Value doesn't match allowed options
- type_mismatch (12%) - Wrong data type
- invalid_expression (8%) - Expression syntax errors
- invalid_reference (5%) - Referenced node doesn't exist
- operator_structure (2%) - Auto-fixed automatically

False positive patterns:
- Missing error handling (acceptable for dev/test)
- No retry logic (acceptable for internal APIs)
- Missing rate limiting (acceptable for low volume)
- Unbounded queries (acceptable for small datasets)
- Missing input validation (acceptable for trusted sources)
- Hardcoded credentials (never acceptable!)

Validation insights:
- 79% of validation errors lead to feedback loops
- Average 2-3 iterations to valid configuration
- 94% success rate within 3 iterations
- ai-friendly profile reduces false positives by 60%
- Auto-sanitization handles operator structure issues automatically

Total: ~2,553 lines across 8 files

Based on analysis of 19,113 validation errors and 15,107 feedback loops.

🤖 Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en
2025-10-20 11:00:47 +02:00
czlonkowski
651467dee6 feat: Complete Skill #3 - n8n Workflow Patterns
Implements comprehensive workflow pattern guidance from 31,917 real workflows.
Addresses the most common use case (813 webhook searches).

Files created:
- 5 evaluations testing pattern selection and implementation
- SKILL.md (486 lines) - Pattern overview, selection guide, workflow checklist
- webhook_processing.md (554 lines) - Webhook patterns, $json.body gotcha, auth
- http_api_integration.md (763 lines) - REST APIs, pagination, rate limiting
- database_operations.md (854 lines) - DB ops, batch processing, SQL injection prevention
- ai_agent_workflow.md (918 lines) - AI agents, 8 connection types, tool configuration
- scheduled_tasks.md (845 lines) - Cron schedules, timezone handling, monitoring
- README.md - Skill metadata with pattern statistics

Key features:
- 5 core patterns: Webhook (35%), HTTP API (892 templates), Database (456), AI (234), Scheduled (28%)
- Workflow creation checklist (planning → implementation → validation → deployment)
- Pattern selection guide with statistics
- Common gotchas documented (webhook $json.body, SQL injection, timezone, etc.)
- Error handling strategies for each pattern
- Performance optimization techniques
- Security best practices
- Testing approaches
- Real template examples

Critical insights:
- Webhook data under $json.body (not $json) - #1 gotcha
- Always use parameterized queries (SQL injection prevention)
- ANY node can be an AI tool (connect to ai_tool port)
- Set workflow timezone explicitly (DST handling)
- Authentication via credentials (never hardcode)

Pattern statistics:
- Trigger distribution: Webhook 35%, Schedule 28%, Manual 22%, Service 15%
- Transformation: Set 68%, Code 42%, IF 38%, Switch 18%
- Output: HTTP 45%, Slack 32%, Database 28%, Email 24%
- Complexity: Simple 42%, Medium 38%, Complex 20%

Total: ~4,420 lines across 12 files

Based on analysis of 31,917 real workflows and usage patterns.

🤖 Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en
2025-10-20 10:38:38 +02:00
czlonkowski
f7d34f2b8e feat: Complete Skill #2 - n8n MCP Tools Expert
Implements comprehensive guidance for using n8n-mcp MCP tools effectively.
This is the HIGHEST PRIORITY skill that addresses the 20% MCP tool failure rate.

Files created:
- 5 evaluations testing tool selection, nodeType formats, validation, and smart parameters
- SKILL.md (505 lines) - Core tool usage guide with telemetry insights
- SEARCH_GUIDE.md (243 lines) - Node discovery tools (search, essentials vs info)
- VALIDATION_GUIDE.md (377 lines) - Configuration validation and auto-sanitization
- WORKFLOW_GUIDE.md (385 lines) - Workflow management with 15 operation types
- README.md - Skill metadata emphasizing highest priority

Key features:
- Tool selection guide with success rates (search_nodes 99.9%, get_node_essentials 91.7%)
- nodeType format distinction (nodes-base.* vs n8n-nodes-base.*)
- Validation profiles explained (minimal/runtime/ai-friendly/strict)
- Smart parameters for IF/Switch nodes (branch="true", case=0)
- Auto-sanitization system for operator structures
- Telemetry insights (56s between edits, 18s search→essentials, 23s+58s validate→fix)
- AI connection types (8 types documented)

Total: ~1,650 lines across 10 files

Based on analysis of 447,557 real MCP tool usage events.

🤖 Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en
2025-10-20 10:26:40 +02:00
czlonkowski
9a5e0c0b89 feat: Complete Skill #1 - n8n Expression Syntax
## Skill #1 Complete - n8n Expression Syntax

 **4 Evaluations Created**:
- eval-001: Missing curly braces
- eval-002: Webhook body data access (critical!)
- eval-003: Code node vs expression confusion
- eval-004: Node reference syntax

 **4 Skill Files** (~1,115 lines total):
- SKILL.md (285 lines) - Core concepts, under 500 line limit
- COMMON_MISTAKES.md (380 lines) - 15 common errors with fixes
- EXAMPLES.md (450 lines) - 10 real working examples
- README.md - Skill metadata

## Key Features

🎯 **Critical Gotcha Highlighted**: Webhook data under .body
📚 **Real Examples**: From MCP testing log and templates
 **Quick Fixes**: Fast reference table for common errors
🔍 **Code vs Expression**: Clear distinction when NOT to use {{}}
 **Comprehensive**: Covers 95% of expression use cases

## Content Highlights

- Expression format ({{  }})
- Core variables ($json, $node, $now, $env)
- **Webhook data structure** (most common mistake!)
- When NOT to use expressions (Code nodes)
- Array/object access patterns
- Date/time formatting
- String manipulation
- Conditional logic

## Based on MCP Testing

All examples verified against real:
- Webhook node structure from get_node_essentials
- Template #2947 (Weather to Slack)
- Code node guide from tools_documentation
- Real error messages from validation

## Next: Skill #2 - n8n MCP Tools Expert

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en
2025-10-20 10:19:19 +02:00