本文へ移動
cccskills
無料GitHub で公開

cron-decision

Decision framework for agents to determine WHEN and WHETHER to use Claude Code's native cron scheduler (CronCreate/CronList/CronDelete) vs OS cron, GitHub Actions, or simple Task() delegation.

インストール方法を見る

含まれるファイル(10)

  • SKILL.md9.1 KB
  • commands/cron-decision.md113 B
  • hooks/post-execute.cjs179 B
  • hooks/pre-execute.cjs285 B
  • references/research-requirements.md837 B
  • rules/cron-decision.md587 B
  • schemas/input.schema.json715 B
  • schemas/output.schema.json385 B
  • scripts/main.cjs585 B
  • templates/implementation-template.md289 B

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

<!-- Agent: developer | Task: #task-23 | Session: 2026-03-15 -->

Cron Decision Skill

Official docs: https://code.claude.com/docs/en/scheduled-tasks

Purpose

Help agents decide when and whether to use Claude Code's native cron scheduler (CronCreate/CronList/CronDelete) versus alternatives like OS cron (crontab), GitHub Actions scheduled workflows, or simple one-shot Task() delegation.

Using the wrong scheduling mechanism leads to:

  • Silent task loss (session expiry kills CronCreate tasks)
  • Missed precision requirements (CronCreate has up to 15-min jitter)
  • Over-engineering (using GitHub Actions for a simple session heartbeat)

Quick Checklist (Run Before Any Scheduling Decision)

Answer these 5 questions in order. The FIRST "yes" that hits a stop condition determines your tool.

  1. Is the task a one-time operation?

    • YES → Use TaskCreate or Task(). Stop here. CronCreate is for recurring work only.
  2. Must the task survive terminal/session close?

    • YES → Use OS cron (crontab -e) or GitHub Actions. CronCreate is session-scoped and dies when Claude Code closes.
  3. Does the task require sub-15-minute precision or hard time guarantees?

    • YES → Use OS cron or GitHub Actions. CronCreate fires with up to 10% jitter (max 15 min).
  4. Is this a heartbeat loop or session-scoped health check?

    • YES → Use CronCreate. This is its primary intended use case.
  5. Is this triggered by an event rather than a clock?

    • YES → Use a hook (PreToolUse/PostToolUse) or an event listener, not a scheduler at all.

Decision Matrix

ScenarioRecommended ToolReason
Periodic background monitoring during active sessionCronCreateSession-scoped is fine; this is CronCreate's primary use case
Agent ecosystem heartbeat (health checks, memory sizes)CronCreate via heartbeat-orchestratorUse dedicated orchestrator, not raw CronCreate
One-time task (now or delayed)Task() or TaskCreateCron is for recurring work only
Nightly backup or data pipelineOS cron (crontab -e)Must survive terminal close
CI/CD pipeline triggerGitHub Actions schedule:Cloud-run, no terminal dependency
Data refresh every 4 hours during developmentCronCreateSession-scoped is acceptable for dev workflows
Production scheduled jobOS cron or GitHub ActionsNever rely on session-scoped for production
Event-driven reaction (file change, hook trigger)Hook (PreToolUse/PostToolUse)Time-based scheduler is wrong tool for events
User-requested one-off analysisTask()Single execution, no recurrence needed
Weekly report generation (must run unattended)GitHub ActionsUnattended, cloud-run, persistent
Session index rebuild during developmentCronCreateSession-scoped is fine; fires while Claude is open
Reflection queue drain checkCronCreate via heartbeat-orchestratorPart of heartbeat ecosystem

Heartbeat Integration Note

If the recurring task is agent ecosystem monitoring (health checks, memory rotation, stuck task detection, reflection queue), do not use raw CronCreate directly.

Instead, delegate to heartbeat-orchestrator or invoke the /heartbeat-start command:

// CORRECT: Delegate heartbeat ecosystem to the dedicated orchestrator
// Router: spawn heartbeat-orchestrator agent
// OR user: /heartbeat-start

// WRONG: Manually wiring raw CronCreate for ecosystem health
CronCreate({
  schedule: '*/30 * * * *',
  task: 'Check agent health...',
});

The heartbeat-orchestrator manages:

  • All 7 heartbeat loops
  • Auto-reschedule (prevents silent 3-day expiry)
  • Session restart detection and re-registration
  • Coordinated observability via heartbeat-session-ping.json

Exception: Use raw CronCreate only for custom, non-ecosystem recurring tasks that are not part of the standard heartbeat loops.


CronCreate Constraints (Critical Before Using)

ConstraintDetail
Session-scopedDies when terminal closes — no persistence across restarts
3-day auto-expirySelf-deletes silently after 3 days (reschedule before day 2.5)
JitterFires up to 10% of period late (max 15 min)
No catch-upMissed fires are NOT replayed
50-task capMax 50 concurrent scheduled tasks per session
Fire-between-turnsFires only when Claude is idle, not mid-response
No extended syntaxL, W, ?, MON-style names are NOT supported

When to Use Each Tool

Use CronCreate when

  • Task is session-scoped (acceptable to lose on terminal close)
  • Monitoring, health checks, or periodic index refreshes during active development
  • 15-minute jitter is acceptable
  • Task fits within the 50-task session cap (stay under 10 for headroom)

Use OS cron (crontab -e) when

  • Task must run even when Claude Code is closed
  • Sub-minute precision is required
  • Production data pipelines, backups, or server maintenance

Use GitHub Actions schedule: when

  • Task must run unattended in CI/CD environment
  • Fully cloud-run with no terminal dependency
  • Cross-repo or deployment-related scheduling
  • Audit trail and run history are required

Use Task() or TaskCreate when

  • One-time execution (even if delayed)
  • Event-driven (not time-driven)

Use a hook when

  • Triggered by a tool call event (PreToolUse/PostToolUse), not a clock

Quick Reference: CronCreate API

// Schedule a recurring task (standard 5-field cron expression)
CronCreate({ schedule: '*/30 * * * *', task: 'Heartbeat check prompt here' });

// List active cron tasks (verify what is registered)
CronList();

// Remove a scheduled task by ID
CronDelete({ id: 'abc12345' });

Common schedules:

ExpressionMeaning
*/30 * * * *Every 30 minutes
*/5 * * * *Every 5 minutes (minimum recommended)
0 * * * *Every hour on the hour
0 2 * * *Every day at 2am local time
0 3 * * 0Every Sunday at 3am

When to Invoke

Skill({ skill: 'cron-decision' });

Invoke before:

  • Setting up any recurring task (to choose the right tool)
  • Creating a CronCreate schedule (to verify constraints are acceptable)
  • Deciding between GitHub Actions, OS cron, and session-scoped scheduling

Do NOT invoke for:

  • One-time task delegation (use TaskCreate directly)
  • Heartbeat ecosystem setup (use heartbeat-orchestrator or /heartbeat-start)

Related Skills and Agents

  • scheduled-tasks — Full CronCreate implementation reference with heartbeat patterns
  • heartbeat — Start the full 7-loop heartbeat ecosystem
  • heartbeat-orchestrator agent — Manages ecosystem heartbeat loops

Memory Protocol (MANDATORY)

Before starting: Read .claude/context/memory/learnings.md for previous scheduling decisions.

After completing:

  • New scheduling pattern discovered → .claude/context/memory/learnings.md
  • Scheduling issue found → .claude/context/memory/issues.md
  • Architecture decision made → .claude/context/memory/decisions.md

ASSUME INTERRUPTION: If it's not in memory, it didn't happen.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Ensure accessibility in UI components including semantic HTML, ARIA attributes, keyboard navigation, and WCAG 2.2 AA compliance.

日本語の概要は準備中です。原文の説明を表示しています。

oimiragieo/agent-studio432026年7月14日 更新

Use when you want to improve response quality through meta-cognitive reasoning. Applies 15+ reasoning methods to reconsider and refine initial outputs.

日本語の概要は準備中です。原文の説明を表示しています。

oimiragieo/agent-studio432026年7月14日 更新

N-round opposing-stance debates for trade-off analysis. Assigns pro/con roles to agents, runs structured debate rounds with quality scoring, and produces a moderator synthesis with confidence-rated recommendation. Generalizable to architecture, technology, security, and design decisions.

日本語の概要は準備中です。原文の説明を表示しています。

oimiragieo/agent-studio432026年7月14日 更新

Force adversarial code review stance that eliminates confirmation bias — reviewer must find issues or re-analyze

日本語の概要は準備中です。原文の説明を表示しています。

oimiragieo/agent-studio432026年7月14日 更新

Creates specialized AI agents on-demand when no existing agent matches a request. Use when the Router cannot find a suitable agent for a task. Enables self-evolution by generating persistent agents.

日本語の概要は準備中です。原文の説明を表示しています。

oimiragieo/agent-studio432026年7月14日 更新

LLM-as-judge evaluation framework with 5-dimension rubric (accuracy, groundedness, coherence, completeness, helpfulness) for scoring AI-generated content quality with weighted composite scores and evidence citations

日本語の概要は準備中です。原文の説明を表示しています。

oimiragieo/agent-studio432026年7月14日 更新

oimiragieo のスキルをすべて見る

このスキルの問題を報告する