Skip to main content
skill CX Codex

crontap-heartbeat-for-cron — Claude Code skill

Adds a Crontap dead-man's-switch ping to a recurring job, so you hear about a crash or a silent stop. Built for unattended cron work.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add Crontap/skills --skill crontap-heartbeat-for-cron -a claude-code
Open on GitHub

What crontap-heartbeat-for-cron does

This skill wires a watchdog ping into a job that already runs on its own schedule. The job reports in after finishing, and once the period plus the grace window pass without a ping, that counts as a missed check-in. A separate /fail ping covers the case where the job broke and the code handled it.

Three tools do the work: create_heartbeat, get_heartbeat_pings and rotate_heartbeat_token. Creating a heartbeat returns a secret ping URL, which the skill tells you to store as a credential rather than paste into CI logs, source control or later agent messages. From there you add a success ping to the job and a /fail ping to its handled failure path, then read history for a single UTC day. Rotating the token kills both variants of the old URL at once, so the job needs the replacement before its next deadline.

One choice comes first: connect Crontap MCP at https://mcp.crontap.com/mcp, or set $CRONTAP_CLIENT_ID and $CRONTAP_API_KEY for the raw API. MCP access is available on every Crontap tier; the raw API needs Ultra. Worth knowing before you start — a heartbeat only notices silence. It cannot start or restart the job for you.

What it helps with

  • find out a nightly import never ran
  • tell a hard failure apart from a job that went quiet
  • size the grace window to real runtime jitter
  • read check-in history for one day
  • replace a leaked ping URL without losing monitoring

Example prompts for the agent

  • Add a heartbeat to the nightly import job with a 1440 minute period and 30 minutes of grace
  • Show the pings for heartbeat <heartbeat-id> on 2026-09-14
  • Rotate the token for heartbeat <heartbeat-id> after I confirm

How to install crontap-heartbeat-for-cron

1Skills CLI (Vercel)

npx skills add Crontap/skills --skill crontap-heartbeat-for-cron -a claude-code

2Manually: put the files in place

~/.claude/skills/crontap-heartbeat-for-cron/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/crontap-heartbeat-for-cron/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about crontap-heartbeat-for-cron

How do I install crontap-heartbeat-for-cron in Claude Code?

Run npx skills add Crontap/skills --skill crontap-heartbeat-for-cron -a claude-code. The skill lands at ~/.claude/skills/crontap-heartbeat-for-cron/SKILL.md.

What does crontap-heartbeat-for-cron do?

It attaches a watchdog ping to an existing recurring job, lets you inspect check-ins, and rotates the secret token when needed. If the job stops reporting, you get an alert.

What do I need before using it?

Either Crontap MCP connected at https://mcp.crontap.com/mcp, or $CRONTAP_CLIENT_ID and $CRONTAP_API_KEY for the raw API. The raw API path requires Ultra.

Source text

SKILL.md · MIT
---
name: crontap-heartbeat-for-cron
description: >
  Add a Crontap dead-man's-switch heartbeat to an existing recurring job,
  inspect check-ins, and rotate its secret token safely. Use when a user needs
  alerts for a cron job that fails explicitly or stops running.
license: MIT
metadata:
  version: "1.0.0"
  group: main
  order: 5
  title: Add a heartbeat to a recurring job
  summary: Add reliable check-ins to an existing recurring job and receive an alert when expected reports stop.
  bestFor: Missed jobs, grace periods, and explicit failures
  guide: https://crontap.com/heartbeats
  guideTitle: Heartbeat monitoring
  tools: create_heartbeat,get_heartbeat_pings,rotate_heartbeat_token
---

# Add a heartbeat to a recurring job

A heartbeat monitors a job that already has its own clock. The job pings after
successful work. Silence beyond the period and grace window becomes a missed
check-in, while the `/fail` variant reports explicit failure.

## Prerequisites

Before using the required tools, check whether they are available. If any are
missing, stop and offer the user exactly two choices:

1. Connect Crontap MCP at `https://mcp.crontap.com/mcp`. MCP access works on
   every Crontap tier.
2. Configure `$CRONTAP_CLIENT_ID` and `$CRONTAP_API_KEY` for the raw API. Raw
   API access requires Ultra.

Do not silently choose a path or continue until the user selects one.

- Know the job's real maximum interval, including expected jitter.
- Choose a grace window long enough for ordinary delay and runtime.
- Decide which component securely stores the returned ping URL.

## Workflow

1. Create the heartbeat with the expected period and grace.
2. Capture the returned ping URL once and store it as a secret.
3. Add a success ping only after the job completes successfully.
4. Add a `/fail` ping to the job's handled failure path.
5. Inspect ping history after deployment and after any incident.
6. Rotate the token only for compromise or planned credential rotation.

## MCP examples

Create a daily heartbeat with 30 minutes of grace:

```json
{
  "tool": "create_heartbeat",
  "arguments": {
    "name": "Nightly import",
    "periodMinutes": 1440,
    "graceMinutes": 30,
    "emailCooldownMinutes": 60
  }
}
```

The response contains a secret ping URL. Do not echo it into source control,
CI logs, support tickets, or later agent messages.

Inspect one UTC day:

```json
{
  "tool": "get_heartbeat_pings",
  "arguments": {
    "heartbeatId": "<heartbeat-id>",
    "day": "2026-09-14"
  }
}
```

Rotate after explicit confirmation:

```json
{
  "tool": "rotate_heartbeat_token",
  "arguments": {
    "heartbeatId": "<heartbeat-id>"
  }
}
```

Rotation invalidates both variants of the old URL immediately. Update the job
with the newly returned URL before its next deadline.

## Job integration

Use an environment variable such as `CRONTAP_HEARTBEAT_URL`.

```bash
run_the_job &&
  curl --fail --silent --show-error "$CRONTAP_HEARTBEAT_URL"
```

On a handled failure, call
`"$CRONTAP_HEARTBEAT_URL/fail?msg=bounded-error-summary"`. Keep messages free
of credentials, personal data, and large stack traces.

## REST fallback

REST requires Ultra API access. MCP does not.

```bash
curl --fail-with-body https://api.crontap.com/v1/heartbeat \
  -X POST \
  -H "ClientId: $CRONTAP_CLIENT_ID" \
  -H "ApiKey: $CRONTAP_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "name": "Nightly import",
    "periodMinutes": 1440,
    "graceMinutes": 30
  }'
```

## Verification

- Send one test success from the deployed job environment.
- Confirm the heartbeat moves from pending after an accepted ping.
- Exercise a safe failure path and verify a `fail` event without exposing the
  ping URL.
- Check that the period plus grace reflects the job's worst normal runtime.

## Safety and plan limits

- The ping URL is a credential. Anyone holding it can report activity.
- A heartbeat detects silence but does not start or restart the job.
- Starter heartbeat cadence and count limits differ from paid plans. Let the
  create response enforce the current account.
- On a plan-limit response, present its four-option ladder and the smallest
  viable option without inventing prices.

## Troubleshooting

- No deadline starts until the first accepted ping.
- Pings while paused record history but do not change deadlines.
- Repeated rapid pings may be rate limited while still returning HTTP 200.
- If the old URL stops working after rotation, that is expected. Deploy the
  replacement secret.

## References

- [Crontap Agent Skills catalogue](https://crontap.com/skills)
- [Crontap heartbeats](https://crontap.com/heartbeats)
- [Scheduled AI jobs](https://crontap.com/use-cases/scheduled-ai-jobs)
- [Cron job monitoring](https://crontap.com/cron-job-monitoring)
- [Live REST API reference](https://api.crontap.com/docs/)

© Crontap · MIT · Crontap/skills

Similar skills

All skills for DevOps and infrastructure →

From the same set6

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor