Skip to content
Back to search

claude-scheduler

MarketplaceWorks with Claude CodeGitHub

Put Claude on autopilot

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/jshchnz--claude-code-scheduler/badge.svg)](/listings/jshchnz--claude-code-scheduler)

HTML

<a href="/listings/jshchnz--claude-code-scheduler"><img src="/api/listings/jshchnz--claude-code-scheduler/badge.svg" alt="findsafeskills safety rating" /></a>

Install

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

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

> Requires Claude Code v1.0.33+ · Works on macOS, Linux, Windows

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 18 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. {
  2. "name": "claude-scheduler",
  3. "owner": {
  4. "name": "jshchnz"
  5. },
  6. "metadata": {
  7. "description": "Task scheduling plugin for Claude Code"
  8. },
  9. "plugins": [
  10. {
  11. "name": "scheduler",
  12. "source": "./",
  13. "description": "Schedule recurring Claude Code tasks with cron expressions. Supports daily reviews, weekly audits, and custom schedules using cron syntax or natural language.",
  14. "version": "0.1.0",
  15. "keywords": ["scheduler", "cron", "automation", "launchd", "crontab"]
  16. }
  17. ]
  18. }
README.md · README · 262 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # claude-code-scheduler
  2. <p align="center">
  3. <img src="claude-code-scheduler-icon.png" alt="A robot sitting at a desk with a calendar, checklist, alarm clock, and laptop - representing automated task scheduling" width="280">
  4. </p>
  5. **Put Claude on autopilot.** Schedule code reviews, security audits, and anything else - Claude Code runs them automatically, even while you sleep.
  6. [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
  7. ## Install
  8. ```
  9. /plugin marketplace add jshchnz/claude-code-scheduler
  10. /plugin install scheduler@claude-code-scheduler
  11. ```
  12. > Requires Claude Code v1.0.33+ · Works on macOS, Linux, Windows
  13. ## See It In Action
  14. ```
  15. Schedule a code review every weekday at 9am to check for bugs,
  16. security issues, and missing tests
  17. ```
  18. That's it. Claude creates the task, runs automatically at 9am, logs the results, and waits for you when you arrive.
  19. ## What Can You Schedule?
  20. ### One-Time Tasks
  21. Schedule something once—it runs and cleans itself up:
  22. - "today at 3pm remind me to deploy"
  23. - "tomorrow morning run the test suite"
  24. - "next Tuesday at 2pm review the API changes"
  25. - "January 15th check the quarterly metrics"
  26. ### Recurring Tasks
  27. Automate your workflow—runs reliably even when Claude Code isn't open:
  28. - "every weekday at 9am review yesterday's code"
  29. - "every Monday at 10am check for security vulnerabilities"
  30. - "daily at 6pm summarize what I accomplished"
  31. - "every 4 hours check API health"
  32. ### Autonomous Tasks
  33. For tasks that need to make changes (edit files, run commands, make commits), Claude will ask:
  34. ```
  35. You: Every Friday at 5pm, clean up unused imports and commit the changes
  36. Claude: Does this task need to run autonomously (edit files, run commands)?
  37. → Yes, run fully autonomous
  38. → No, read-only analysis only
  39. You: Yes
  40. Claude: ✓ Task created with autonomous execution enabled
  41. ```
  42. This adds `--dangerously-skip-permissions` to the scheduled command, allowing Claude to run without permission prompts.
  43. ### Git Worktree Mode (Isolated Branches)
  44. For tasks that make changes, you can run them in isolated git worktrees. Changes are committed to a new branch and pushed for review—your main branch stays clean.
  45. ```
  46. You: Every night at 2am, refactor deprecated API calls and push for review
  47. Claude: Should this run in an isolated git worktree?
  48. → Yes, create branch and push changes
  49. → No, run in main working directory
  50. You: Yes
  51. Claude: ✓ Task created with worktree isolation
  52. Branch prefix: claude-task/
  53. Remote: origin
  54. ```
  55. **How it works:**
  56. 1. Task triggers → creates fresh worktree with new branch
  57. 2. Claude runs in the worktree (isolated from main)
  58. 3. Changes are committed and pushed to remote
  59. 4. Worktree is cleaned up after successful push
  60. 5. You review the PR at your convenience
  61. **What happens:**
  62. - `branchPrefix: "claude-task/"` → branches named like `claude-task/task-abc123-1234567890`
  63. - `remoteName: "origin"` → pushes to your default remote
  64. If push fails (no remote, auth issues), the worktree is kept at `~/.worktrees/` for manual review.
  65. ## Features
  66. - **Natural language** — "every weekday at 9am" just works
  67. - **One-time & recurring** — reminders or automated workflows
  68. - **Autonomous mode** — tasks can edit files, run commands, make commits
  69. - **Git worktree isolation** — run tasks in isolated branches, auto-push for review
  70. - **Cross-platform** — macOS (launchd), Linux (crontab), Windows (Task Scheduler)
  71. - **Native schedulers** — reliable, survives restarts
  72. - **Auto-cleanup** — one-time tasks delete themselves after running
  73. ## Commands
  74. These slash commands are available for direct access, but you can also just ask Claude naturally.
  75. | Command | Description |
  76. |---------|-------------|
  77. | `/scheduler:schedule-add` | Create a new scheduled task |
  78. | `/scheduler:schedule-list` | View all scheduled tasks |
  79. | `/scheduler:schedule-remove <id>` | Remove a scheduled task |
  80. | `/scheduler:schedule-status` | Check scheduler health |
  81. | `/scheduler:schedule-run <id>` | Run a task immediately |
  82. | `/scheduler:schedule-logs [id]` | View execution history |
  83. ## Examples
  84. Just tell Claude what you want:
  85. ### Daily Code Review
  86. ```
  87. Schedule a code review every weekday at 9am. Review commits from the last 24 hours, check for bugs, security issues, error handling gaps, and code that needs comments. Summarize with file:line references.
  88. ```
  89. ### Security Vulnerability Scan
  90. ```
  91. Every Monday at 10am, do a security audit: check for outdated dependencies with known CVEs, scan for hardcoded secrets or API keys, and flag unsafe patterns.
  92. ```
  93. ### Tech Debt Tracker
  94. ```
  95. Every Friday at 2pm find all TODO, FIXME, HACK, and XXX comments. List by file with line numbers and identify the 3 highest priority items.
  96. ```
  97. ### Dependency Health Check
  98. ```
  99. Every Thursday at 10am check for outdated dependencies. List packages with available updates, flag breaking changes, and recommend safe updates.
  100. ```
  101. ### Dead Code Finder
  102. ```
  103. Every Wednesday at 3pm find dead code: unused functions, unreachable branches, commented-out code, and unused imports. List by file with line numbers.
  104. ```
  105. ---
  106. ## Viewing Execution History
  107. See what your scheduled tasks have done:
  108. ```
  109. /scheduler:schedule-logs
  110. ```
  111. ```
  112. | Time | Task | Status | Duration |
  113. |-------------------|-------------------|--------|----------|
  114. | Jan 5 9:00 AM | Daily Code Review | OK | 45s |
  115. | Jan 5 6:00 PM | Backup Reminder | OK | 12s |
  116. | Jan 4 9:00 AM | Daily Code Review | OK | 38s |
  117. ```
  118. Select any row to see the full output from that execution. You can also view a specific task directly:
  119. ```
  120. /scheduler:schedule-logs daily-review --full
  121. ```
  122. Logs are stored at `~/.claude/logs/<task-id>.log`.
  123. ## Configuration
  124. Tasks are stored in JSON files:
  125. - **Project-level:** `.claude/schedules.json`
  126. - **Global:** `~/.claude/schedules.json`
  127. Example task structure:
  128. ```json
  129. {
  130. "id": "daily-review",
  131. "name": "Daily Code Review",
  132. "enabled": true,
  133. "trigger": {
  134. "type": "cron",
  135. "expression": "0 9 * * 1-5",
  136. "timezone": "local"
  137. },
  138. "execution": {
  139. "command": "Review yesterday's commits",
  140. "workingDirectory": ".",
  141. "timeout": 300,
  142. "skipPermissions": true,
  143. "worktree": {
  144. "enabled": false,
  145. "branchPrefix": "claude-task/",
  146. "remoteName": "origin"
  147. }
  148. },
  149. "tags": ["code-quality", "daily"]
  150. }
  151. ```
  152. ### Worktree Options
  153. | Option | Default | Description |
  154. |--------|---------|-------------|
  155. | `enabled` | `false` | Run task in isolated git worktree |
  156. | `branchPrefix` | `"claude-task/"` | Prefix for created branches |
  157. | `remoteName` | `"origin"` | Git remote to push to |
  158. | `basePath` | (auto) | Custom path for worktrees |
  159. ## How It Works
  160. 1. You ask Claude to schedule something
  161. 2. Claude asks if the task needs autonomous execution (file edits, commands, etc.)
  162. 3. Plugin registers it with your OS's native scheduler
  163. 4. At the scheduled time, runs `claude -p "your command"` (with `--dangerously-skip-permissions` for autonomous tasks)
  164. 5. Output is logged to `~/.claude/logs/<task-id>.log`
  165. 6. One-time tasks automatically delete themselves after running
  166. ## Troubleshooting
  167. **Task not running?**
  168. 1. Check status: `/scheduler:schedule-status`
  169. 2. Verify it's enabled: `/scheduler:schedule-list`
  170. 3. Check logs: `/scheduler:schedule-logs <task-id>`
  171. **Common issues:**
  172. | Problem | Solution |
  173. |---------|----------|
  174. | Task never runs | Ensure `claude` CLI is in PATH |
  175. | Directory not found | Use absolute paths |
  176. | Permission denied | Check file permissions |
  177. **Platform debugging:**
  178. ```bash
  179. # macOS
  180. launchctl list | grep com.claude.schedule
  181. # Linux
  182. crontab -l | grep claude
  183. # Windows
  184. schtasks /query /tn "ClaudeSchedule*"
  185. ```
  186. ## Contributing
  187. Issues and PRs welcome! [Open an issue](https://github.com/jshchnz/claude-code-scheduler/issues)
  188. ## License
  189. MIT
src/utils/shell.ts · Bundled script · 52 lines · 1 finding marked
  1. /**
  2. * Shell escaping utilities for safe command generation
  3. */
  4. /**
  5. * Escape a string for safe embedding in a single-quoted bash string.
  6. * Single quotes in bash prevent all expansion, making this the safest approach.
  7. *
  8. * Examples:
  9. * shellEscape('foo') -> "'foo'"
  10. * shellEscape("it's") -> "'it'\\''s'"
  11. * shellEscape('$HOME') -> "'$HOME'" (no expansion)
  12. * shellEscape('"; rm -rf /') -> "'\"'; rm -rf /'"
    • Note: Quoted as data in code: Runs `rm -rf` against a root or home-directory path
    • Line 13 on GitHub
  13. *
  14. * The technique: wrap in single quotes, escape any internal single quotes
  15. * by ending the string, adding an escaped quote, and starting a new string.
  16. * 'it'\''s' = 'it' + \' + 's' = it's
  17. */
  18. export function shellEscape(str: string): string {
  19. // Replace each single quote with: end quote, escaped quote, start quote
  20. return "'" + str.replace(/'/g, "'\\''") + "'";
  21. }
  22. /**
  23. * Sanitize a string to contain only safe characters for display in comments.
  24. * Removes shell metacharacters and control characters while preserving
  25. * common punctuation used in task names.
  26. */
  27. export function sanitizeForComment(str: string): string {
  28. // First replace newlines with spaces
  29. let result = str.replace(/\n/g, ' ');
  30. // Remove shell metacharacters: $ ` # \ | & < > and control chars
  31. // Keep: alphanumeric, spaces, common punctuation like : ; ( ) [ ] { } @ ' " - _ . , ! ?
  32. result = result.replace(/[$`#\\|&<>]/g, '');
  33. return result;
  34. }
  35. /**
  36. * Validate that a string matches a safe identifier pattern
  37. */
  38. export function isSafeIdentifier(str: string, pattern: RegExp): boolean {
  39. return pattern.test(str);
  40. }
  41. // Validation patterns for git operations
  42. export const GIT_REF_PATTERN = /^[a-zA-Z0-9/_.-]+$/;
  43. export const GIT_REMOTE_PATTERN = /^[a-zA-Z0-9_.-]+$/;
  44. // Validation pattern for filesystem paths (conservative)
  45. export const SAFE_PATH_PATTERN = /^[a-zA-Z0-9/_. ~-]+$/;

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.