SuperAPI AI Directory

scheduled-task

General & other

View repository

Updated 10-16 01:35

About this skill

Scheduled Task Skill

⚠️ Core Principles

Principle 1: Prefer modifying existing tasks

When the user says "modify/change/adjust a scheduled task",never create a new task. Correct process: ① List tasks → ② Find the target task ID → ③ Call the update script to modify

Principle 2: IM sending = notification platform, not prompt

When the user says "send to DingTalk/Feishu/WeCom/Telegram/Discord", this is anotification delivery requirement, and you should set the notifyPlatforms field,do notwrite it into prompt。

After the task completes, the system willautomaticallysend Claude's execution result to the specified IM platform, with no need to additionally instruct "send to XX" in the prompt.

Correct approach:

  • prompt: "查询今天的天气并整理成报告" — only describe the action to be performed
  • notifyPlatforms: ["dingtalk"] — the system automatically sends the result to DingTalk

Incorrect approach:

  • prompt: "查询今天的天气并发送到钉钉群" — ❌ do not write IM sending into the prompt

Common trigger word mappings:

What the user says Corresponding notifyPlatforms value
Send to DingTalk/DingTalk group/DingTalk "dingtalk"
Send to Feishu/Lark "feishu"
Send to QQ/QQ group/QQ bot "qq"
Send to Telegram/TG/Telegram "telegram"
Send to Discord "discord"
Send to WeCom/WeCom "wecom"
Send to Yunxin/NetEase Yunxin/NIM "nim"
Send to Xiaomifeng/Xiaomifeng "xiaomifeng"

Principle 3: Correctly extract each field from the user's natural language

The user usually expresses all intentions in one sentence. You need to break it down into the various fields of the scheduled task,do notcram all content into prompt。

Field extraction mappings:

Component in the user's description Corresponding field Extraction method
Time/frequency (every day at 9 o'clock, Monday, every 30 minutes…) schedule Convert to cron/at/interval
The thing to do (core action) prompt Expand into a complete standalone instruction (see the prompt writing specification below)
Send to a certain IM (DingTalk, Feishu, TG…) notifyPlatforms Map to a platform array (see Principle 2),do notwrite into prompt
Task short name (can be inferred from the action) name Extract a short name
Involves a specific directory/project workingDirectory Extract the directory path
Expiry/deadline (only run until the end of the month, until March…) expiresAt Convert to "YYYY-MM-DD"
Execution environment (run in the sandbox…) executionMode "sandbox" / "local"

Complete breakdown example:

Example 1: The user says "每天早上9点帮我查一下AI新闻发到钉钉"

{
  "name": "每日AI新闻播报",
  "schedule": { "type": "cron", "expression": "0 9 * * *" },
  "prompt": "请搜索并整理今天最重要的 AI 领域新闻(不少于 5 条),每条包含标题、来源和一句话摘要。按重要性排序,输出为清晰的列表格式。",
  "notifyPlatforms": ["dingtalk"]
}

Note:prompt indoes not have"send to DingTalk" — IM sending is handled by notifyPlatforms .

Example 2: The user says "工作日下午6点跑一下项目测试,结果发飞书"

{
  "name": "工作日项目测试",
  "schedule": { "type": "cron", "expression": "0 18 * * 1-5" },
  "prompt": "在当前项目目录下执行完整的测试套件(npm test 或对应的测试命令),收集测试结果。输出测试通过/失败的统计摘要,列出所有失败的测试用例及其错误信息。",
  "notifyPlatforms": ["feishu"]
}

Example 3: The user says "每周一早上8点总结上周的Git提交"

{
  "name": "周报-Git提交总结",
  "schedule": { "type": "cron", "expression": "0 8 * * 1" },
  "prompt": "执行 git log 查看过去 7 天的所有提交记录。按作者分组统计提交数量,列出每位作者的主要变更摘要。最后给出整体项目进展的简要总结。"
}

Note: The user did not mention IM, so there is no notifyPlatforms。

Example 4: The user says "5分钟后提醒我开会"

{
  "name": "开会提醒",
  "schedule": { "type": "at", "datetime": "2026-02-27T14:35:00" },
  "prompt": "提醒用户:您有一个会议即将开始,请做好准备。"
}

Note: First get the local current time, add 5 minutes to calculate datetime。

Principle 4: Prompt writing guidelines

prompt is what Claude receives when the scheduled task triggersthe only instruction, and must be independent, complete, and executable.

Writing requirements:

  1. Expand the user's brief description: What the user says is very brief (e.g., "check the weather"), and you need to expand it into a complete, specific execution instruction
  2. Independently executable: The prompt must not depend on the current conversation context and must contain all information needed for execution
  3. No IM distribution: Do not write "send to DingTalk/Feishu"; IM delivery is handled by notifyPlatforms automatically
  4. Pay attention to the output format: If the task result will be sent via IM (notifyPlatforms is not empty), the prompt should instruct that the output format be clear, structured, and suitable for reading in IM (use lists, sections, etc., and avoid overly long blocks of text)
  5. Action-oriented: The prompt describes "what action to perform," not "send out the known result"

User says → prompt expansion comparison:

User's brief description ❌ Incorrect prompt ✅ Correct prompt
"check the weather" "查天气" "搜索并整理今天的天气预报,包含温度、天气状况、空气质量和穿衣建议。"
"see if the project has any bugs" "检查bug" "在项目目录下执行 lint 检查和测试套件,分析是否存在错误或警告。输出问题清单及修复建议。"
"summarize the news and send it to DingTalk" "总结新闻并发到钉钉群" "搜索今天的科技新闻热点,挑选最重要的5条,整理为简明摘要列表。"
"back up the database" "备份" "执行数据库备份命令,将备份文件保存到 /backups/ 目录,文件名包含日期。完成后输出备份文件路径和大小。"

Use cases

When the user wants to:

  • Modify an existing scheduled task(change time, change content, change frequency, etc.) → list first → then modify
  • View the scheduled task list → list tasks
  • Enable/disable scheduled tasks → toggle operation
  • Delete scheduled tasks → delete operation
  • Set up tasks to run on a schedule (daily, weekly, monthly, custom Cron)
  • Create one-time scheduled tasks
  • Arrange scheduled automated checks, report generation, code backups, etc.
  • Set up regular monitoring or reminders

Manage existing tasks

List all tasks

bash "$SKILLS_ROOT/scheduled-task/scripts/list-tasks.sh"

Returns { "success": true, "tasks": [...] }, and each task contains fields such as id、name、enabled、schedule、prompt、state etc. Find the idof the target task based on the task name or description, for subsequent modify/delete operations.

Modify a task (provide only the fields that need to be changed)

First get the task ID via list, then pass in only the fields that need to be modified (unprovided fields keep their original values):

cat > /tmp/update-task.json <<'JSON'
{
  "schedule": { "type": "cron", "expression": "0 10 * * *" }
}
JSON

bash "$SKILLS_ROOT/scheduled-task/scripts/update-task.sh" "<task_id>" @/tmp/update-task.json

Modifiable fields

Field Description
name Task name
description Detailed description
schedule Schedule configuration (see "Schedule types" below)
prompt The instruction Claude receives when the task runs
workingDirectory Execution directory
systemPrompt Custom system prompt
executionMode "auto" / "local" / "sandbox"
expiresAt Expiration date "YYYY-MM-DD" or null(no expiration)
notifyPlatforms The IM platform to which results are automatically sent after the task is completed (see "Principle 2")
enabled Whether to enable

Enable / disable task

bash "$SKILLS_ROOT/scheduled-task/scripts/toggle-task.sh" "<task_id>" true   # 启用
bash "$SKILLS_ROOT/scheduled-task/scripts/toggle-task.sh" "<task_id>" false  # 禁用

The response contains the warning field (may be TASK_AT_PAST、TASK_EXPIRED), informing the user that the task may not trigger.

Delete task

⚠️ Irreversible, please clearly confirm with the user before executing.

bash "$SKILLS_ROOT/scheduled-task/scripts/delete-task.sh" "<task_id>"

Create a new task

⚠️ If the user wants to modify an existing task,do not use the create script, please use the "Modify task" flow above.

Step 1: Collect information

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

  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 working directory of the current session
  5. Notification platform(optional) — send a notification after the task is completed

Step 2: Build JSON and execute 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 * * The 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

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

When the payload contains Chinese,do notpass the entire JSON directly as a command-line argument. Please 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 the 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 ❌ The IM platform to automatically send results to after the task is completed:["dingtalk","feishu","wecom","qq","telegram","discord","nim","xiaomifeng"](default []). Set this field when the user says "send to DingTalk/Feishu/WeCom/QQ/TG",do notwrite it into the prompt
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")
  • 📋 Execution content summary
  • 💡 Tip: users can manage this in "Settings → Scheduled Tasks"

Important Notes

  • IM Notification Separation: When the user mentions sending to IM platforms such as "DingTalk/Feishu/WeCom/TG/Discord", just set the notifyPlatforms field, and the system will automatically push the task execution results to the corresponding platform.Do notwrite "send to XX" into the prompt,prompt only describe what the task itself should do
  • Prioritize modification: When the user says "change the time/content of task XX", first use list to find the task id, then use update to modify it;do not create a new task
  • Encoding safety (must-read on Windows): payloads containing Chinese must preferentially use the @file method to avoid garbled titles/prompts caused by command-line argument encoding
  • Relative time (must-read on Windows): When the user says relative times such as "in X minutes / 9 AM tomorrow / this afternoon", first use a local command to get the current local time, then convert to the target time. Do not directly guess the current time, and do not use UTC time.
  • Creation order (prevent expiration): When the user requests a short-delay one-time task such as "in 1 minute / in 5 minutes", create the scheduled task immediately first, then perform any time-consuming operations; do not first search online, summarize content, and then create the task.
  • Prompt boundary:prompt only describes "the action to be performed when the task is triggered" (see "Principle Four"); do not execute the task in advance and write static results into the prompt, and do not write IM sending into the prompt.
  • Recommended commands (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 a 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
  • Automatic disabling: Tasks that fail 5 times in a row are automatically disabled
  • One-time tasks:type: "at" tasks are automatically disabled after execution
  • Cowork session: Each execution creates a new Cowork session (with a title prefixed "[Scheduled]"), and execution details can be viewed in the Cowork list