SuperAPI AI Directory

scheduled-task

Office & productivity

View repository

Updated 10-16 08:51

About this skill

Scheduled Task Skill

Use Cases

When the user wants to:

  • Set up scheduled tasks (daily, weekly, monthly, custom Cron)
  • Create one-time scheduled tasks
  • Schedule automated checks, report generation, code backups, etc.
  • Set up recurring monitoring or reminders

Create scheduled task

Step 1: Gather Information

First confirm the following information with the user (if not provided by the user):

  1. Task name(required) — short description
  2. Execution content(required) — the prompt instruction Claude receives when the task runs
  3. Execution frequency(required) — one-time, daily, weekly, monthly, or custom Cron
  4. Working directory(optional) — defaults to the current session's working directory
  5. Notification platform(optional) — send a notification after the task completes

Step 2: Build JSON and Run the Script

Schedule Types

One-time execution (at):

{ "type": "at", "datetime": "2026-03-15T09:00:00" }

Cron expression (cron) — 5-field format: minute hour day month weekday

{ "type": "cron", "expression": "0 9 * * *" }

Common Cron examples:

Expression Meaning
0 9 * * * Every day at 9:00
0 8 * * 1 Every Monday at 8:00
0 9 * * 1-5 Weekdays at 9:00
0 0 1 * * 1st of every month at 0:00
*/30 * * * * Every 30 minutes
0 * * * * Every hour on the hour
0 9,18 * * * Every day at 9:00 and 18:00

Run the script to create the task (recommended:@file approach, to avoid Windows Chinese encoding issues)

When the payload contains Chinese,do notpass the entire JSON directly as a command-line argument.
First write it to a UTF-8 file, then use @文件路径 to pass it to the script.

cat > /tmp/scheduled-task.json <<'JSON'
{
  "name": "任务名称",
  "schedule": { "type": "cron", "expression": "0 9 * * *" },
  "prompt": "任务运行时 Claude 将执行的详细指令...",
  "workingDirectory": "/path/to/project"
}
JSON

bash "$SKILLS_ROOT/scheduled-task/scripts/create-task.sh" @/tmp/scheduled-task.json

Field descriptions

Field Required Description
name ✅ Short task name
prompt ✅ The instruction Claude receives when the task runs (should be clear and complete)
schedule ✅ Schedule configuration (see type descriptions above)
workingDirectory ❌ Execution directory (default empty)
description ❌ Detailed description (default empty)
systemPrompt ❌ Custom system prompt (default empty)
executionMode ❌ "auto" / "local" / "sandbox"(default "local")
expiresAt ❌ Expiration date "YYYY-MM-DD"(default null, no expiration)
notifyPlatforms ❌ Notification platform array:["dingtalk","feishu","telegram","discord"](default [])
enabled ❌ Whether to enable immediately (default true)

Step 3: Confirm the Result

The script returns a JSON response:

  • Success:{ "success": true, "task": { "id": "...", "name": "...", ... } }
  • Failure:{ "success": false, "error": "错误信息" }

Confirm the following information with the user:

  • ✅ Task name and ID
  • ⏰ Execution frequency (human-readable format, e.g. "every day at 9:00 AM")
  • 📋 Execution content summary
  • 💡 Prompt the user that they can manage it in "Settings → Scheduled Tasks"

Important Notes

  • Encoding safety (must-read for Windows): For payloads containing Chinese, you must prioritize using the @file method to avoid garbled titles/prompts caused by command-line argument encoding
  • Relative time (must-read on Windows): When the user says "in X minutes / tomorrow morning at 9 / this afternoon", etc., first use a local command to get the current local time, then convert the target time. Do not directly guess the current time, and do not use UTC time.
  • Creation order (to prevent expiration): When the user requests a short-delay one-time task such as "in 1 minute / in 5 minutes", immediately create the scheduled task first, then perform any time-consuming operations; do not first search online or summarize content and then create the task.
  • Prompt boundaries:prompt should describe "the action to execute when the task is triggered"; do not execute the task in advance and write static results into the prompt. Example: write "after the time arrives, retrieve yesterday's AI news and send a summary"; do not first organize the news list and then stuff it into the prompt.
  • Recommended command (cross-platform):
    node -e 'const d=new Date();const p=n=>String(n).padStart(2,"0");console.log(`${d.getFullYear()}-${p(d.getMonth()+1)}-${p(d.getDate())}T${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`)'
    
  • Automatic execution: When the scheduled task runs, all tool calls are automatically approved (auto-approve), with no manual approval required
  • Independent operation:prompt is the only instruction Claude receives when the task runs independently, and it should be written clearly and completely
  • Automatically disabled: Tasks that fail 5 times in a row are automatically disabled
  • One-time task:type: "at" 's task is automatically disabled after execution
  • Cowork session: Each execution creates a new Cowork session (with the title prefix "[Scheduled]"), and execution details can be viewed in the Cowork list