axiom-coding-agent-setup 1.0.0 → 1.0.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.
- package/.agents/skills/ai-integration/SKILL.md +314 -0
- package/.agents/skills/deployment-patterns/SKILL.md +408 -0
- package/.agents/skills/mcp-builder/SKILL.md +292 -0
- package/.agents/skills/n8n-patterns/SKILL.md +272 -0
- package/.agents/templates/ai-engineering-python.md +508 -0
- package/.agents/templates/fullstack-ai-nextjs.md +632 -0
- package/AGENTS.md +5 -3
- package/README.md +20 -6
- package/bin/cli.js +21 -9
- package/docs/npx-cli-setup-guide.md +318 -0
- package/package.json +2 -2
- /package/{.axiom → .agents}/engineering.md +0 -0
- /package/{.axiom → .agents}/stack.md +0 -0
- /package/{.axiom → .agents}/workflow.md +0 -0
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mcp-builder
|
|
3
|
+
description: Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services. Use when building MCP servers to integrate external APIs or services, in Python (FastMCP) or Node/TypeScript (MCP SDK).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# MCP Server Development Guide
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Create MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. The quality of an MCP server is measured by how well it enables LLMs to accomplish real-world tasks.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## When to Use This Skill
|
|
15
|
+
|
|
16
|
+
- Building integrations between LLMs and external APIs
|
|
17
|
+
- Creating tools that Claude/opencode can use to access services
|
|
18
|
+
- Wrapping third-party services (GitHub, Notion, databases, etc.)
|
|
19
|
+
- Building internal tools for your team
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## High-Level Workflow
|
|
24
|
+
|
|
25
|
+
### Phase 1: Deep Research and Planning
|
|
26
|
+
|
|
27
|
+
**API Coverage vs. Workflow Tools:**
|
|
28
|
+
Balance comprehensive API endpoint coverage with specialized workflow tools. When uncertain, prioritize comprehensive API coverage.
|
|
29
|
+
|
|
30
|
+
**Tool Naming:**
|
|
31
|
+
- Use clear, descriptive names
|
|
32
|
+
- Consistent prefixes: `github_create_issue`, `github_list_repos`
|
|
33
|
+
- Action-oriented naming
|
|
34
|
+
|
|
35
|
+
**Context Management:**
|
|
36
|
+
- Return focused, relevant data
|
|
37
|
+
- Support filtering/pagination
|
|
38
|
+
- Concise tool descriptions
|
|
39
|
+
|
|
40
|
+
### Phase 2: Implementation
|
|
41
|
+
|
|
42
|
+
**Recommended Stack:**
|
|
43
|
+
- **Language**: TypeScript (excellent SDK support, static typing)
|
|
44
|
+
- **Transport**: Streamable HTTP for remote, stdio for local
|
|
45
|
+
|
|
46
|
+
**For TypeScript:**
|
|
47
|
+
- MCP TypeScript SDK: `@modelcontextprotocol/sdk`
|
|
48
|
+
- Use Zod for input validation
|
|
49
|
+
- Define output schemas for structured responses
|
|
50
|
+
|
|
51
|
+
**For Python:**
|
|
52
|
+
- FastMCP framework: `fastmcp`
|
|
53
|
+
- Use Pydantic for input validation
|
|
54
|
+
|
|
55
|
+
### Phase 3: Testing
|
|
56
|
+
|
|
57
|
+
- Test with MCP Inspector: `npx @modelcontextprotocol/inspector`
|
|
58
|
+
- Verify each tool works as expected
|
|
59
|
+
- Test error handling paths
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## TypeScript Implementation
|
|
64
|
+
|
|
65
|
+
### Project Setup
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
mkdir my-mcp-server
|
|
69
|
+
cd my-mcp-server
|
|
70
|
+
npm init -y
|
|
71
|
+
npm install @modelcontextprotocol/sdk zod
|
|
72
|
+
npm install -D @types/node typescript
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Basic Server Structure
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
// src/index.ts
|
|
79
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
80
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
81
|
+
import {
|
|
82
|
+
CallToolRequestSchema,
|
|
83
|
+
ListToolsRequestSchema,
|
|
84
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
|
85
|
+
import { z } from "zod";
|
|
86
|
+
|
|
87
|
+
// Define input schemas
|
|
88
|
+
const SearchSchema = z.object({
|
|
89
|
+
query: z.string().describe("Search query string"),
|
|
90
|
+
limit: z.number().optional().default(10).describe("Max results to return"),
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// Create server
|
|
94
|
+
const server = new Server(
|
|
95
|
+
{
|
|
96
|
+
name: "my-api-server",
|
|
97
|
+
version: "1.0.0",
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
capabilities: {
|
|
101
|
+
tools: {},
|
|
102
|
+
},
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
// List available tools
|
|
107
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
108
|
+
return {
|
|
109
|
+
tools: [
|
|
110
|
+
{
|
|
111
|
+
name: "search_items",
|
|
112
|
+
description: "Search for items in the system",
|
|
113
|
+
inputSchema: {
|
|
114
|
+
type: "object",
|
|
115
|
+
properties: {
|
|
116
|
+
query: {
|
|
117
|
+
type: "string",
|
|
118
|
+
description: "Search query string",
|
|
119
|
+
},
|
|
120
|
+
limit: {
|
|
121
|
+
type: "number",
|
|
122
|
+
description: "Max results to return",
|
|
123
|
+
default: 10,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
required: ["query"],
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
};
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// Handle tool calls
|
|
134
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
135
|
+
const { name, arguments: args } = request.params;
|
|
136
|
+
|
|
137
|
+
if (name === "search_items") {
|
|
138
|
+
const parsed = SearchSchema.safeParse(args);
|
|
139
|
+
if (!parsed.success) {
|
|
140
|
+
throw new Error(`Invalid arguments: ${parsed.error.message}`);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Implement your search logic here
|
|
144
|
+
const results = await searchItems(parsed.data.query, parsed.data.limit);
|
|
145
|
+
|
|
146
|
+
return {
|
|
147
|
+
content: [
|
|
148
|
+
{
|
|
149
|
+
type: "text",
|
|
150
|
+
text: JSON.stringify(results, null, 2),
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
// Start server
|
|
160
|
+
async function main() {
|
|
161
|
+
const transport = new StdioServerTransport();
|
|
162
|
+
await server.connect(transport);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
main().catch(console.error);
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Python Implementation (FastMCP)
|
|
171
|
+
|
|
172
|
+
### Project Setup
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
mkdir my-mcp-server
|
|
176
|
+
cd my-mcp-server
|
|
177
|
+
python -m venv venv
|
|
178
|
+
source venv/bin/activate # Windows: venv\Scripts\activate
|
|
179
|
+
pip install fastmcp
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Basic Server Structure
|
|
183
|
+
|
|
184
|
+
```python
|
|
185
|
+
# server.py
|
|
186
|
+
from fastmcp import FastMCP
|
|
187
|
+
from pydantic import BaseModel, Field
|
|
188
|
+
from typing import Optional
|
|
189
|
+
|
|
190
|
+
# Create MCP server
|
|
191
|
+
mcp = FastMCP("my-api-server")
|
|
192
|
+
|
|
193
|
+
# Define input model
|
|
194
|
+
class SearchInput(BaseModel):
|
|
195
|
+
query: str = Field(description="Search query string")
|
|
196
|
+
limit: Optional[int] = Field(default=10, description="Max results to return")
|
|
197
|
+
|
|
198
|
+
# Define tool
|
|
199
|
+
@mcp.tool()
|
|
200
|
+
async def search_items(query: str, limit: int = 10) -> str:
|
|
201
|
+
"""
|
|
202
|
+
Search for items in the system.
|
|
203
|
+
|
|
204
|
+
Args:
|
|
205
|
+
query: Search query string
|
|
206
|
+
limit: Maximum number of results to return
|
|
207
|
+
|
|
208
|
+
Returns:
|
|
209
|
+
JSON string with search results
|
|
210
|
+
"""
|
|
211
|
+
# Implement your search logic
|
|
212
|
+
results = await perform_search(query, limit)
|
|
213
|
+
return json.dumps(results, indent=2)
|
|
214
|
+
|
|
215
|
+
# Add more tools...
|
|
216
|
+
|
|
217
|
+
if __name__ == "__main__":
|
|
218
|
+
mcp.run()
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Best Practices
|
|
224
|
+
|
|
225
|
+
### Tool Design
|
|
226
|
+
|
|
227
|
+
1. **Clear Descriptions**: Write descriptions as if explaining to a junior developer
|
|
228
|
+
2. **Actionable Errors**: Error messages should suggest how to fix the issue
|
|
229
|
+
3. **Consistent Naming**: Use verb_noun pattern (e.g., `create_issue`, `list_repos`)
|
|
230
|
+
4. **Input Validation**: Always validate and sanitize inputs
|
|
231
|
+
5. **Pagination**: Support pagination for list operations
|
|
232
|
+
|
|
233
|
+
### Error Handling
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
// Good error message
|
|
237
|
+
throw new Error(
|
|
238
|
+
`Repository "${repo}" not found. ` +
|
|
239
|
+
`Check the repository name and ensure you have access. ` +
|
|
240
|
+
`Format: owner/repo-name`
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
// Bad error message
|
|
244
|
+
throw new Error("Not found");
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Response Format
|
|
248
|
+
|
|
249
|
+
```typescript
|
|
250
|
+
// Return structured data when possible
|
|
251
|
+
return {
|
|
252
|
+
content: [
|
|
253
|
+
{
|
|
254
|
+
type: "text",
|
|
255
|
+
text: JSON.stringify({
|
|
256
|
+
success: true,
|
|
257
|
+
data: results,
|
|
258
|
+
count: results.length,
|
|
259
|
+
}, null, 2),
|
|
260
|
+
},
|
|
261
|
+
],
|
|
262
|
+
};
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## Testing with MCP Inspector
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
# Install inspector globally
|
|
271
|
+
npm install -g @modelcontextprotocol/inspector
|
|
272
|
+
|
|
273
|
+
# Run your server with inspector
|
|
274
|
+
mcp-inspector node build/index.js
|
|
275
|
+
|
|
276
|
+
# For Python
|
|
277
|
+
mcp-inspector python server.py
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
The inspector provides:
|
|
281
|
+
- Interactive tool testing
|
|
282
|
+
- Request/response inspection
|
|
283
|
+
- Error debugging
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## Resources
|
|
288
|
+
|
|
289
|
+
- **MCP Specification**: https://modelcontextprotocol.io/
|
|
290
|
+
- **TypeScript SDK**: https://github.com/modelcontextprotocol/typescript-sdk
|
|
291
|
+
- **Python SDK**: https://github.com/modelcontextprotocol/python-sdk
|
|
292
|
+
- **FastMCP**: https://github.com/jlowin/fastmcp
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: n8n-workflow-patterns
|
|
3
|
+
description: Best practices and patterns for building production-ready n8n workflows. Use when designing, building, or debugging n8n automation workflows.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# n8n Workflow Patterns Guide
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
n8n is a workflow automation platform that connects apps and services. This skill covers patterns for building maintainable, reliable, and scalable workflows.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## When to Use This Skill
|
|
15
|
+
|
|
16
|
+
- Designing new n8n workflows
|
|
17
|
+
- Refactoring existing workflows for better reliability
|
|
18
|
+
- Debugging failing workflows
|
|
19
|
+
- Building integrations between services
|
|
20
|
+
- Creating scheduled automation
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Core Principles
|
|
25
|
+
|
|
26
|
+
### 1. Workflow Design Patterns
|
|
27
|
+
|
|
28
|
+
**Single Responsibility**
|
|
29
|
+
Each workflow should do one thing well. Complex automations should be split into multiple workflows connected via:
|
|
30
|
+
- Execute Workflow node
|
|
31
|
+
- Webhook triggers
|
|
32
|
+
- n8n API
|
|
33
|
+
|
|
34
|
+
**Fail-Fast and Loud**
|
|
35
|
+
- Use Error Trigger workflows for centralized error handling
|
|
36
|
+
- Never silently swallow errors
|
|
37
|
+
- Send notifications on failures
|
|
38
|
+
|
|
39
|
+
**Idempotency**
|
|
40
|
+
Design workflows to be safely re-runnable:
|
|
41
|
+
- Check if action already performed before doing it
|
|
42
|
+
- Use deduplication keys
|
|
43
|
+
- Handle duplicate webhook calls gracefully
|
|
44
|
+
|
|
45
|
+
### 2. Node Patterns
|
|
46
|
+
|
|
47
|
+
**HTTP Request Node**
|
|
48
|
+
```
|
|
49
|
+
Best Practices:
|
|
50
|
+
- Always set timeout (default 5 min is often too long)
|
|
51
|
+
- Handle 4xx and 5xx errors explicitly
|
|
52
|
+
- Use pagination for large datasets
|
|
53
|
+
- Implement retry logic for transient failures
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Code Node**
|
|
57
|
+
```javascript
|
|
58
|
+
// Good: Input validation
|
|
59
|
+
const input = $input.first().json;
|
|
60
|
+
if (!input.email) {
|
|
61
|
+
throw new Error('Email is required');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Good: Error handling with context
|
|
65
|
+
try {
|
|
66
|
+
const result = await someAsyncOperation();
|
|
67
|
+
return [{ json: result }];
|
|
68
|
+
} catch (error) {
|
|
69
|
+
// Log context for debugging
|
|
70
|
+
console.error('Operation failed:', { input: input.id, error: error.message });
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Function Node (Legacy)**
|
|
76
|
+
Prefer Code Node over Function Node in new workflows.
|
|
77
|
+
|
|
78
|
+
### 3. Data Handling
|
|
79
|
+
|
|
80
|
+
**Passing Data Between Nodes**
|
|
81
|
+
```javascript
|
|
82
|
+
// Access previous node data
|
|
83
|
+
const items = $input.all();
|
|
84
|
+
const firstItem = $input.first().json;
|
|
85
|
+
|
|
86
|
+
// Reference specific node output
|
|
87
|
+
const data = $('Node Name').first().json;
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Transforming Data**
|
|
91
|
+
```javascript
|
|
92
|
+
// Map over items
|
|
93
|
+
const results = items.map(item => ({
|
|
94
|
+
json: {
|
|
95
|
+
id: item.json.id,
|
|
96
|
+
name: item.json.name.toUpperCase(),
|
|
97
|
+
processed: true,
|
|
98
|
+
}
|
|
99
|
+
}));
|
|
100
|
+
return results;
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 4. Error Handling
|
|
104
|
+
|
|
105
|
+
**Try-Catch Pattern**
|
|
106
|
+
```javascript
|
|
107
|
+
try {
|
|
108
|
+
// Risky operation
|
|
109
|
+
const result = await riskyCall();
|
|
110
|
+
return [{ json: { success: true, data: result } }];
|
|
111
|
+
} catch (error) {
|
|
112
|
+
// Return error in structured format
|
|
113
|
+
return [{
|
|
114
|
+
json: {
|
|
115
|
+
success: false,
|
|
116
|
+
error: error.message,
|
|
117
|
+
timestamp: new Date().toISOString(),
|
|
118
|
+
}
|
|
119
|
+
}];
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Error Workflow**
|
|
124
|
+
Create a dedicated workflow for error handling:
|
|
125
|
+
- Trigger: Error Trigger node
|
|
126
|
+
- Actions: Log to database, send Slack/email notification, retry logic
|
|
127
|
+
|
|
128
|
+
### 5. Credential Management
|
|
129
|
+
|
|
130
|
+
**Security Best Practices**
|
|
131
|
+
- Never hardcode credentials in Code nodes
|
|
132
|
+
- Always use n8n credential system
|
|
133
|
+
- Rotate credentials regularly
|
|
134
|
+
- Use least-privilege access for service accounts
|
|
135
|
+
|
|
136
|
+
**Custom Credentials**
|
|
137
|
+
For custom APIs, create a generic credential type or use HTTP Request node with OAuth.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Workflow Architecture Patterns
|
|
142
|
+
|
|
143
|
+
### Pattern 1: Webhook Receiver
|
|
144
|
+
```
|
|
145
|
+
Webhook Node → Validation → Processing → Response
|
|
146
|
+
↓
|
|
147
|
+
Error Handler
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Use for: Real-time integrations, external service callbacks
|
|
151
|
+
|
|
152
|
+
### Pattern 2: Scheduled Job
|
|
153
|
+
```
|
|
154
|
+
Schedule Trigger → Data Fetch → Transform → Action → Notification
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Use for: Daily reports, data sync, cleanup tasks
|
|
158
|
+
|
|
159
|
+
### Pattern 3: Event-Driven Chain
|
|
160
|
+
```
|
|
161
|
+
Trigger → Filter → Enrich → Route → Multiple Actions
|
|
162
|
+
↙ ↓ ↘
|
|
163
|
+
Action1 Action2 Action3
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Use for: Complex automation with conditional branches
|
|
167
|
+
|
|
168
|
+
### Pattern 4: Workflow Orchestration
|
|
169
|
+
```
|
|
170
|
+
Main Workflow → Execute Workflow (Sub-workflow 1)
|
|
171
|
+
→ Execute Workflow (Sub-workflow 2)
|
|
172
|
+
→ Aggregate Results
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Use for: Complex multi-step processes, reusable components
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Debugging Workflows
|
|
180
|
+
|
|
181
|
+
### Enable Execution Logging
|
|
182
|
+
```
|
|
183
|
+
Settings → Log Execution → Enable
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Use Debug Nodes
|
|
187
|
+
Insert Set nodes to inspect data at specific points:
|
|
188
|
+
```javascript
|
|
189
|
+
// Debug node output
|
|
190
|
+
{
|
|
191
|
+
"debug_stage": "after_api_call",
|
|
192
|
+
"raw_response": $input.first().json,
|
|
193
|
+
"item_count": $input.all().length
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Common Issues
|
|
198
|
+
|
|
199
|
+
**Issue: Data not passing between nodes**
|
|
200
|
+
- Check if previous node outputs items
|
|
201
|
+
- Verify item structure matches expected input
|
|
202
|
+
- Use Code node to inspect `$input`
|
|
203
|
+
|
|
204
|
+
**Issue: Workflow times out**
|
|
205
|
+
- Add pagination for large datasets
|
|
206
|
+
- Use Split In Batches node
|
|
207
|
+
- Consider splitting into multiple workflows
|
|
208
|
+
|
|
209
|
+
**Issue: Rate limiting**
|
|
210
|
+
- Add Wait nodes between API calls
|
|
211
|
+
- Implement exponential backoff
|
|
212
|
+
- Use queue-based processing
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Performance Optimization
|
|
217
|
+
|
|
218
|
+
### Batch Processing
|
|
219
|
+
```
|
|
220
|
+
Split In Batches (100 items/batch) → Process → Wait 1s → Loop
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Parallel Processing
|
|
224
|
+
```
|
|
225
|
+
→ Process A
|
|
226
|
+
Split → Route → Process B
|
|
227
|
+
→ Process C
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Caching
|
|
231
|
+
Use the Static Data feature to cache:
|
|
232
|
+
- Access tokens
|
|
233
|
+
- Reference data
|
|
234
|
+
- Configuration
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Code Node Utilities
|
|
239
|
+
|
|
240
|
+
### Common Helpers
|
|
241
|
+
```javascript
|
|
242
|
+
// Date formatting
|
|
243
|
+
const now = new Date().toISOString();
|
|
244
|
+
const formatted = new Date().toLocaleDateString('en-US');
|
|
245
|
+
|
|
246
|
+
// Generate unique ID
|
|
247
|
+
const id = Date.now().toString(36) + Math.random().toString(36).substr(2);
|
|
248
|
+
|
|
249
|
+
// Sleep function
|
|
250
|
+
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
251
|
+
|
|
252
|
+
// Retry wrapper
|
|
253
|
+
async function withRetry(fn, maxAttempts = 3) {
|
|
254
|
+
for (let i = 0; i < maxAttempts; i++) {
|
|
255
|
+
try {
|
|
256
|
+
return await fn();
|
|
257
|
+
} catch (error) {
|
|
258
|
+
if (i === maxAttempts - 1) throw error;
|
|
259
|
+
await sleep(1000 * (i + 1)); // Exponential backoff
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## Resources
|
|
268
|
+
|
|
269
|
+
- **n8n Docs**: https://docs.n8n.io/
|
|
270
|
+
- **Workflow Templates**: https://n8n.io/workflows
|
|
271
|
+
- **Community Forum**: https://community.n8n.io/
|
|
272
|
+
- **Node Reference**: https://docs.n8n.io/integrations/builtin/
|