Generate headless Claude Code cron jobs with safety.
npx skills add https://github.com/notque/vexjoy-agent --skill headless-cron-creator
Generate headless Claude Code cron jobs from a task description and schedule. Creates a wrapper script with safety mechanisms (lockfile, budget cap, dry-run default, logging) and installs crontab entries. All crontab mutations go through scripts/crontab-manager.py, which writes to temp files and creates timestamped backups in ~/.claude/crontab-backups/ before every change -- never pipe directly to crontab - because a mid-stream pipe failure wipes the entire crontab.
Extract job parameters from the user's request.
Required parameters:
reddit-automod, feed-health-check)Optional parameters (with defaults):
cd before running (default: current repo root)2.00; user may override)Bash Read; user may override){workdir}/cron-logs/{name})Human-readable schedule conversion -- use off-minutes (7, 23, 47) instead of :00/:30 because every cron job on the system fires at round minutes, creating load spikes:
| Human Input | Cron Expression |
|-------------|----------------|
| every 12 hours | 7 */12 * * * |
| twice daily | 7 8,20 * * * |
| hourly | 23 * * * * |
| daily at 6am | 7 6 * * * |
| weekly on sunday | 7 9 * * 0 |
| every 30 minutes | */30 * * * * |
Gate: All required parameters extracted. Proceed to Phase 2.
Create the wrapper script using crontab-manager.py generate-wrapper. Embed the prompt via bash heredoc to avoid escaping issues.
python3 ~/.claude/scripts/crontab-manager.py generate-wrapper \
--name "{name}" \
--prompt "{prompt}" \
--schedule "{schedule}" \
--workdir "{workdir}" \
--budget "{budget}" \
--allowed-tools "{allowed_tools}"
Review the generated script. Verify it contains:
set -euo pipefailflock lockfile -- prevents concurrent runs of the same job--permission-mode auto -- never use --dangerously-skip-permissions (auto is sufficient) or --bare (breaks OAuth/keychain auth)--max-budget-usd -- caps spend per run (default 2.00 USD)--no-session-persistence--allowedToolstee to per-run timestamped log file--executePIPESTATUS[0]Do not use the CronCreate tool -- it is session-scoped (dies when the session ends, auto-expires after 7 days). Use system crontab via crontab-manager.py instead.
Gate: Script generated and reviewed. Proceed to Phase 3.
Verify the generated script meets cron best practices.
bash -n scripts/{name}-cron.sh # syntax check
cron-job-auditor checks:set -e)flock)tee, LOG_DIR)cd)claude -- cron has minimal PATH, so all commands must use absolute paths)Gate: All checks pass. Proceed to Phase 4.
Install the crontab entry. Every entry gets a # claude-cron: <tag> marker so crontab-manager.py can identify and manage only its own entries without touching non-Claude crontab lines. All paths in the crontab entry must be absolute because cron has minimal PATH.
python3 ~/.claude/scripts/crontab-manager.py add \
--tag "{name}" \
--schedule "{schedule}" \
--command "{absolute_script_path} --execute >> {logdir}/cron.log 2>&1" \
--dry-run
python3 ~/.claude/scripts/crontab-manager.py add \
--tag "{name}" \
--schedule "{schedule}" \
--command "{absolute_script_path} --execute >> {logdir}/cron.log 2>&1"
python3 ~/.claude/scripts/crontab-manager.py verify --tag "{name}"
Gate: Entry installed and verified. Proceed to Phase 5.
Summarize the created cron job and print the exact commands to test and manage it.
Output:
python3 ~/.claude/scripts/crontab-manager.py list # see all claude cron jobs
python3 ~/.claude/scripts/crontab-manager.py verify --tag {name} # health check
python3 ~/.claude/scripts/crontab-manager.py remove --tag {name} # uninstall
To modify an existing wrapper script, regenerate it with --force rather than editing in place.
Cause: A cron entry with this tag is already installed.
Solution: Either remove --tag {name} first, or choose a different name.
Cause: Cron has minimal PATH; claude isn't in it.
Solution: generate-wrapper resolves the absolute path to claude at generation time.
If the path changes, regenerate the wrapper with --force.
Cause: System crontab service issue.
Solution: Check crontab -l manually. Restore from ~/.claude/crontab-backups/.
scripts/crontab-manager.py -- all crontab mutations (add, remove, list, verify, generate-wrapper)skills/infrastructure/cron-job-auditor/SKILL.md -- validation checks for generated scriptsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
Replace with description of the skill and when Claude should use it.
Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill content", or needs guidance on skill structure, progressive disclosure, or skill development best practices for Claude Code plugins.
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
Use when creating new skills, editing existing skills, or verifying skills work before deployment
Take notque/headless-cron-creator from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.