Scheduling Claude Code Agents and Skills: Converting n8n Workflows to AI-Powered Automation
If you’re coming from n8n or other workflow automation tools, you might be wondering how to schedule Claude Code agents or skills to run automatically. While Claude Code doesn’t have built-in scheduling, there are several powerful options to trigger AI-powered workflows on demand or on a schedule.
The Challenge
Claude Code is primarily an interactive CLI tool. Unlike n8n’s trigger nodes, there’s no native way to say “run this skill every day at 9am.” But with headless mode and external schedulers, you can build robust automated workflows.
Option 1: Headless Mode + Cron
The simplest approach uses Claude’s -p flag for non-interactive execution:
1
2
3
4
5
# Run daily at 9am
0 9 * * * claude -p "Run the daily-report skill" --allowedTools "Bash,Read,Write"
# Invoke a specific skill
0 9 * * * claude -p "/my-skill" --dangerously-skip-permissions
The -p (or --print) flag runs Claude without interaction—it reads the prompt, executes the task, and returns the result to stdout.
Option 2: GitHub Actions
For repository-based workflows, GitHub Actions provides excellent scheduling:
1
2
3
4
5
6
7
8
9
10
11
12
13
name: Scheduled Claude Task
on:
schedule:
- cron: '0 9 * * *' # Daily at 9am UTC
workflow_dispatch: # Manual trigger
jobs:
run-claude:
runs-on: ubuntu-latest
steps:
- uses: anthropics/claude-code-action@v1
with:
prompt: "Run the analytics report skill"
This approach is ideal for tasks tied to your codebase—documentation updates, code analysis, or automated PR reviews.
Option 3: claudecron MCP Server
The claudecron MCP server lets Claude schedule its own tasks:
1
claude mcp add claudecron -s user -- npx -y claudecron
Once installed, Claude can:
- Run bash commands on a schedule
- Trigger tasks when files change
- Execute AI tasks on specific events
This is the closest thing to native scheduling—Claude itself manages the automation.
Option 4: runCLAUDErun (macOS)
For macOS users who prefer a GUI, runCLAUDErun provides a native app for scheduling Claude Code tasks without dealing with cron syntax.
Option 5: claude-mcp-scheduler
The claude-mcp-scheduler runs AI tasks unattended on schedules. It’s designed for:
- Hourly reports
- Daily analysis
- Deployment on headless servers, VMs, or containers
Option 6: Keep n8n as the Orchestrator (Recommended)
Here’s the hybrid approach I recommend: use n8n for scheduling and triggers, call Claude for the intelligent work:
1
2
3
4
┌─────────┐ HTTP/Exec ┌─────────────┐
│ n8n │ ──────────────────→│ claude -p │
│ trigger │ │ "run skill" │
└─────────┘ └─────────────┘
In n8n, use an Execute Command node:
1
claude -p "Process the uploaded files in /data/inbox" --json
This gives you:
- n8n’s robust scheduling and webhook triggers
- Visual workflow builder for complex orchestration
- Claude’s reasoning for the actual work
- Easy error handling and retries
Converting n8n Concepts to Claude
| n8n Concept | Claude Equivalent |
|---|---|
| Trigger node | External scheduler (cron, n8n, GitHub Actions) |
| HTTP Request | MCP server or curl in skill |
| Code node | Skill instructions + Bash tool |
| IF/Switch | Claude’s reasoning |
| Loop | Claude iterates naturally |
Creating a Scheduled Skill
Here’s an example skill that could replace an n8n workflow:
.claude/skills/daily-report.md:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
---
name: daily-report
description: Generate daily analytics report
allowed-tools:
- Bash
- Read
- Write
---
## Instructions
1. Fetch data from the API using curl
2. Process and analyze the results
3. Generate a markdown report
4. Save to /reports/daily-{date}.md
Trigger it with:
1
claude -p "/daily-report" --dangerously-skip-permissions
Practical Example: Daily Metrics Report
Here’s a complete setup using cron and a Claude skill:
1. Create the skill (.claude/skills/metrics-report.md):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
---
name: metrics-report
description: Fetch and analyze daily metrics
allowed-tools:
- Bash
- Read
- Write
---
Fetch metrics from our API, analyze trends, and generate a report.
1. Call the metrics API: `curl -s https://api.example.com/metrics`
2. Compare with yesterday's data in /data/metrics/
3. Identify anomalies or significant changes
4. Write report to /reports/metrics-{date}.md
5. If anomalies found, append to /alerts/pending.md
2. Schedule with cron:
1
2
3
4
5
# Edit crontab
crontab -e
# Add daily 6am execution
0 6 * * * cd /path/to/project && claude -p "/metrics-report" --dangerously-skip-permissions >> /var/log/claude-metrics.log 2>&1
3. Optional: Add notification hook
Create a hook to notify you when the report completes:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
"hooks": {
"Stop": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "curl -X POST https://hooks.slack.com/... -d '{\"text\": \"Metrics report complete\"}'"
}
]
}
]
}
}
Conclusion
While Claude Code doesn’t have native scheduling, the combination of headless mode and external schedulers gives you everything you need. My recommendation:
- Simple tasks: Use cron +
claude -p - Complex orchestration: Keep n8n as the trigger, call Claude for AI work
- Repo-based automation: Use GitHub Actions
- Self-scheduling: Try claudecron MCP server
The key insight is that Claude excels at the thinking part of automation—understanding context, making decisions, handling edge cases. Let specialized tools handle the scheduling, and let Claude do what it does best.