# 让 Claude 帮你打夜班Claude Code 定时任务完全指南：5 种方案对比

- 状态 / Status: 已发布 / Published
- 时间 / Time: 2026-02-09T00:03:20+08:00
- 作者 / Author: -
- 主题 / Topics: AI / AI, 工具 / Tools
- 原文 / Source: https://mp.weixin.qq.com/s/jfYdSVD3of1bjtIxQl2jtA

⚠️ 免责声明：本文所有信息均来自公开互联网资源，仅供参考和学习用途。

---

⚠️ 免责声明：本文所有信息均来自公开互联网资源，仅供参考和学习用途。文中涉及的工具、项目和数据均来自 GitHub、Reddit、Hacker News 等公开平台，请以官方最新信息为准。

🤖 让 Claude 帮你打夜班

Claude Code 定时任务完全指南：5 种方案对比

2026年1月最新 · 开源方案全解析 · 从入门到实战

📋 TL;DR 速查表 | Cheatsheet

推荐 claude-code-scheduler · Claude Code 原生插件 · 自然语言创建任务 · ⭐39

Mac runCLAUDErun · macOS 原生应用 · 图形界面 · 免费

CI/CD claude-code-action · GitHub Actions · PR/Issue 自动化

终端 claude-tasks · Go TUI 工具 · Discord/Slack 通知

极简 claude-code-schedule · Rust CLI · 一行命令搞定

ChatGPT 有 Scheduled Tasks，Grok 有定期提醒，Perplexity 有 Spaces 自动更新——但 Claude 官方一直没有定时任务功能。于是 开源社区动手了 。本文盘点 5 种主流方案 ，从 GitHub Actions 到 macOS 原生应用，总有一款适合你。

"I found myself frequently wanting to schedule tasks in Claude Code."

「我发现自己经常想在 Claude Code 里安排定时任务。」—— claude-code-scheduler 作者

✦ ✦ ✦

一 为什么 Claude 需要定时任务？

很多开发者都有这样的痛点：

1 白天限额紧张 ：Claude Pro 有使用限制，高峰期经常"手痒却不能用"

2 重复性工作多 ：每天早上手动跑代码审查、安全扫描、死代码检测

3 夜间闲置浪费 ：限额凌晨刷新，但人要睡觉啊

"I built this after realizing I was manually running the same Claude prompts every single day."

「每天手动跑同样的 Claude 提示词太烦了，就做了这个。」—— runCLAUDErun 作者

🎯 典型使用场景

✦ 每日代码审查 ：每天早上 9 点自动 review 昨天的 commits

✦ 安全扫描 ：每周日凌晨扫描代码安全漏洞

✦ 死代码检测 ：每周三凌晨找出未使用的函数和 imports

✦ 晨间 Standup 准备 ：工作日 8:30 分析过去 24 小时的 git log

✦ Hacker News 情感分析 ：每天 9 点抓取 Top 10 帖子做分析

✦ ✦ ✦

二 方案一：claude-code-scheduler ⭐ 强烈推荐

🏆 为什么推荐？

这是 Claude Code 原生插件 ，直接集成到 Claude Code 中，支持自然语言创建定时任务——最接近「ChatGPT Tasks」的体验！

📋 项目信息

GitHub： github.com/jshchnz/claude-code-scheduler

Stars： 39 （最受欢迎的方案）

类型： Claude Code 官方插件

平台： macOS、Linux、Windows

价格： 免费开源（MIT）

🛠️ 安装方式

/plugin marketplace add jshchnz/claude-code-scheduler /plugin install scheduler@claude-code-scheduler

⚠️ 注意： 需要 Claude Code v1.0.33 或更高版本

✨ 核心亮点

直接在 Claude Code 中用 自然语言 创建任务：

"Schedule a code review every weekday at 9am to check for bugs, security issues, and missing tests."

「安排每个工作日早上 9 点进行代码审查，检查 bug、安全问题和缺失的测试。」

Claude 会自动创建任务，每天 9am 自动运行！

🔥 自主执行模式（Autonomous Mode）

对于需要 修改文件 的任务，Claude 会询问：

You: Every Friday at 5pm, clean up unused imports and commit the changes

Claude: Does this task need to run autonomously (edit files, run commands)?

→ Yes , run fully autonomous

→ No , read-only analysis only

✓ Task created with autonomous execution enabled

⌨️ 常用命令

/scheduler:schedule-add · 创建新任务

/scheduler:schedule-list · 查看所有任务

/scheduler:schedule-remove <id> · 删除任务

/scheduler:schedule-run <id> · 立即运行

/scheduler:schedule-logs · 查看执行历史

🔧 跨平台支持

✦ macOS ：使用 launchd 系统调度

✦ Linux ：使用 crontab

✦ Windows ：使用 Task Scheduler

✦ ✦ ✦

三 方案二：runCLAUDErun（macOS 专属）

💻 适合人群

Mac 用户、不喜欢命令行、想要 图形界面 的开发者

📋 项目信息

官网： runclauderun.com

Product Hunt： 已上线

最新版本： v2.4.1（2025年11月17日）

系统要求： macOS 10.13+，支持 Apple Silicon 和 Intel

价格： 完全免费

✨ 核心功能

1 原生 macOS 应用 ：干净的界面，融入 Mac 工作流

2 后台执行 ：使用 macOS 的 launchd 系统调度，即使关闭应用任务也会触发

3 灵活调度 ：支持一次性、每日、每周、自定义间隔

4 本地运行 ：所有数据存在本地， 无云依赖

5 完整日志 ：查看所有历史执行记录和输出

"Way easier than dealing with cron jobs. I can actually understand what's running when."

「比搞 cron jobs 简单太多了，我终于能看懂什么时候运行什么任务了。」—— Sarah Chen, DevOps 工程师

📥 安装步骤

1 从 GitHub Releases 下载 .dmg 文件

2 打开 DMG，拖动到 Applications 文件夹

3 首次运行可能需要在「系统设置 → 隐私与安全性」中允许

⚠️ 前提条件： 需要已安装 Claude Code CLI 并完成认证

✦ ✦ ✦

四 方案三：claude-code-action（GitHub Actions）

🔧 适合场景

CI/CD 自动化、PR 自动审查、Issue 自动响应、 团队协作工作流

📋 项目信息

GitHub： github.com/anthropics/claude-code-action

官方： Anthropic 官方出品

类型： GitHub Actions

认证： 支持 Anthropic API、Amazon Bedrock、Google Vertex AI

🚀 核心功能

✦ 交互式代码助手 ：回答代码、架构、编程问题

✦ 代码审查 ：分析 PR 变更并提供改进建议

✦ 代码实现 ：简单修复、重构，甚至新功能开发

✦ PR/Issue 集成 ：无缝支持 GitHub 评论和 PR review

⚡ 快速安装

在 Claude Code 终端运行：

/install-github-app

这个命令会引导你完成 GitHub App 安装和密钥配置。

📅 定时任务配置（社区增强版）

有开发者 fork 了官方仓库，增加了 定时任务和任务调度 工作流：

📋 社区增强版

GitHub： github.com/TheMntnKing/claude-code-action

新增： Claude recurring tasks 和 task scheduler workflows

🕐 手动触发延迟任务示例

通过 GitHub Actions 手动触发，设置延迟时间：

✦ +60min ："Plan the database schema for the new user profile feature."

✦ +180min ："Implement the backend API endpoints based on the schema."

✦ +300min ："Write integration tests and create a draft PR."

"Running it in an isolated branch without having to keep my local machine on gives me more peace of mind to actually get some sleep."

「在隔离分支上运行，不用一直开着本地机器，让我可以安心睡觉了。」—— Reddit 用户

✦ ✦ ✦

五 方案四：claude-tasks（终端 TUI 工具）

🖥️ 适合人群

终端控、喜欢 TUI 界面、需要 Discord/Slack 通知 的开发者

📋 项目信息

GitHub： github.com/kylemclaren/claude-tasks

语言： Go + TypeScript

最新版本： v0.4.2（2026年1月16日）

平台： macOS、Linux、Windows

价格： 免费开源（MIT）

✨ 核心功能

✦ Cron 调度 ：支持 6 字段 cron 表达式（ 秒级精度 ）

✦ 实时 TUI ：漂亮的终端界面，实时更新、进度条

✦ Webhook 通知 ：任务结果自动推送到 Discord/Slack

✦ 用量追踪 ：可视化监控 Anthropic API 使用量

✦ 用量阈值 ：超过阈值自动跳过任务，保护配额

🛠️ 安装方式

快速安装（推荐）：

curl -fsSL https://raw.githubusercontent.com/kylemclaren/claude-tasks/main/install.sh | bash

从源码构建：

git clone https://github.com/kylemclaren/claude-tasks.git cd claude-tasks go build -o claude-tasks ./cmd/claude-tasks

⌨️ 快捷键

a · 添加新任务

e · 编辑选中任务

d · 删除任务（需确认）

t · 启用/禁用任务

r · 立即运行任务

/ · 搜索/过滤任务

Enter · 查看任务输出历史

📅 Cron 格式示例

0 * * * * * · 每分钟

0 0 9 * * * · 每天 9:00 AM

0 30 8 * * 1-5 · 工作日 8:30 AM

0 0 */2 * * * · 每 2 小时

0 0 9 * * 0 · 每周日 9:00 AM

✦ ✦ ✦

六 方案五：claude-code-schedule（极简 Rust CLI）

🎯 一句话定位

睡前运行一行命令，第二天早上 限额已刷新 。

📋 项目信息

Crates.io： crates.io/crates/claude-code-schedule

作者： Ian Macalinao（@simplyianm）

语言： Rust（142 行代码）

下载量： 548

价格： 免费开源（Apache 2.0）

🎯 使用场景

"Run this tool before going to bed to ensure Claude Code gets used overnight. This refreshes your rate limits so you start each workday with a clean slate."

「睡前运行这个工具，确保 Claude Code 在夜间被使用。这样第二天上班时限额就刷新了。」

🛠️ 安装与使用

安装：

cargo install claude-code-schedule

使用：

# 默认早上 6:00 运行 ccschedule # 指定时间 ccschedule --time 05:30 # 自定义消息 ccschedule --message "Start the day by reviewing code quality"

📋 典型工作流

睡前 在终端运行 ccschedule

睡觉 让它在夜间自动运行

醒来 Claude 已经跑完，限额已刷新

开始工作 满血复活的限额等着你

✦ ✦ ✦

七 五种方案对比：怎么选？

📊 功能对比表

claude-code-scheduler · 原生插件 · 自然语言 · ✅ 自主执行 · 全平台 · ⭐39

runCLAUDErun · macOS GUI · 最低学习成本 · ❌ 无自主执行 · 仅 Mac

claude-code-action · GitHub Actions · CI/CD 集成 · ✅ 官方出品 · 全平台

claude-tasks · TUI 终端 · Webhook 通知 · ✅ 用量监控 · 全平台

claude-code-schedule · 极简 CLI · 一行命令 · 最轻量 · 全平台

🎯 选择建议

✅ 如果你是...

✦ Claude Code 深度用户 → claude-code-scheduler

✦ Mac 小白用户 → runCLAUDErun

✦ 团队 CI/CD 需求 → claude-code-action

✦ 终端控 + 需要通知 → claude-tasks

✦ 只想刷限额 → claude-code-schedule

"You could also just do 'sleep 600 | claude < prompt.md' if you're feeling brave."

「你也可以直接用 'sleep 600 | claude < prompt.md'，如果你够勇的话。」—— Reddit 用户 lionmeetsviking

✦ ✦ ✦

八 实战示例：开发者怎么用？

示例 1：每日代码审查

时间： 每天下午 6 点

Prompt：

"Review any uncommitted changes in this repo. Check for bugs, edge cases, and potential improvements."

示例 2：每周安全扫描

时间： 每周日早上 9 点

Prompt：

"Audit code for common security issues: SQL injection, XSS, insecure dependencies, hardcoded secrets."

示例 3：死代码检测

时间： 每周三凌晨 3 点

Prompt：

"Find dead code: unused functions, unreachable branches, commented-out code, and unused imports. List by file with line numbers."

示例 4：晨间 Standup 准备

时间： 工作日早上 8:30

Prompt：

"Analyze git log from the last 24 hours. Summarize what was done, what's in progress, and flag any blockers."

✦ ✦ ✦

九 SOP Checklist：部署前检查清单

📋 通用检查项

☐ Claude Code CLI 已安装并认证

☐ Claude Pro/Max 订阅有效

☐ 确认工作目录正确

☐ 测试 prompt 手动运行成功

✅ claude-code-scheduler 检查项

☐ Claude Code 版本 ≥ v1.0.33

☐ 插件安装成功（运行 /scheduler:schedule-status ）

☐ 自主执行任务需确认权限

✅ runCLAUDErun 检查项

☐ macOS 版本 ≥ 10.13

☐ 「系统设置 → 隐私与安全性」已授权

☐ Claude Code CLI 路径正确

✅ claude-code-action 检查项

☐ GitHub App 已安装到仓库

☐ ANTHROPIC_API_KEY 已添加到 Secrets

☐ workflow 文件权限配置正确

☐ 触发条件测试通过

✅ claude-tasks 检查项

☐ Go 版本 ≥ 1.24（如从源码编译）

☐ Webhook URL 配置正确（可选）

☐ 用量阈值设置合理

⚠️ 安全提醒： 永远不要在代码中硬编码 API Key！使用环境变量或 GitHub Secrets。

🎯 你会选哪个方案？

评论区聊聊你的使用场景和心得体会！

📚 参考来源：

1. GitHub: jshchnz/claude-code-scheduler

2. GitHub: anthropics/claude-code-action

3. runCLAUDErun 官网

4. GitHub: kylemclaren/claude-tasks

5. Crates.io: claude-code-schedule

6. Reddit r/ClaudeAI 社区讨论

7. Hacker News: Show HN 讨论帖

8. Anthropic 官方博客：Enabling Claude Code to work more autonomously

参考原文信息列表：

1. https://github.com/jshchnz/claude-code-scheduler

2. https://github.com/anthropics/claude-code-action

3. https://github.com/TheMntnKing/claude-code-action

4. https://runclauderun.com

5. https://github.com/kylemclaren/claude-tasks

6. https://crates.io/crates/claude-code-schedule

7. https://github.com/macalinao/claude-code-schedule

8. https://www.reddit.com/r/ClaudeAI/comments/xxxxxxx/built_a_simple_scheduler_for_claude_code/

9. https://www.reddit.com/r/ClaudeAI/comments/xxxxxxx/claude_now_works_my_night_shift/

10. https://news.ycombinator.com/item?id=xxxxxxxx

11. https://www.anthropic.com/news/enabling-claude-code-to-work-more-autonomously

12. https://mcpmarket.com/Agent-Skills (Claude Code Scheduler Skill)

13. https://vibe.forem.com/willwnekowicz/runclauderun-scheduler-for-claude-code

✨

— END —
