56 results available
Sign in
Skills directory

cron

encoredev

·

Last changed
Hardened

This skill has been hardened by Chainguard

Last changed

This version passed the hardening gate. Hardening applied 4 targeted changes and preserved all other text. Classified findings before hardening: 0. Classified findings closed: 0. Classified findings remaining: 0. Unclassified scanner findings remaining: 0. Review findings closed: 6. Review findings remaining: 1.


Open before hardening

None

Open after hardening

None


Expand
File
Group
Subtype
Severity
Status

No findings available

0 findings


SKILL.md

Encore Cron Jobs

Instructions

A CronJob declaration in Encore.ts ties a schedule to an existing api(...) endpoint. The endpoint runs at the chosen cadence. Declare the CronJob at package level — not inside a function. The target endpoint must take no request parameters, as in the example below.

import { CronJob } from "encore.dev/cron";
import { api } from "encore.dev/api";

// 1. The endpoint to call (typically internal: expose: false)
export const aggregateDailyOrders = api(
  { expose: false },
  async (): Promise<void> => {
    // Aggregation logic
  }
);

// 2. Package-level cron declaration
const _ = new CronJob("aggregate-daily-orders", {
  title: "Aggregate orders for the previous day",
  schedule: "0 2 * * *",  // 02:00 UTC every day
  endpoint: aggregateDailyOrders,
});

Schedule Formats

FieldExampleDescription

every

"1h", "30m", "6h"

Simple interval. Must divide 24h evenly — "7h" is invalid.

schedule

"0 9 * * 1"

Standard cron expression (5 fields, UTC).

Specify exactly one of every or schedule per CronJob declaration.

Common cron expressions

CronMeaning

"0 * * * *"

Every hour, on the hour

"0 2 * * *"

Daily at 02:00 UTC

"0 0 * * 0"

Weekly on Sunday at midnight UTC

"0 4 15 * *"

04:00 UTC on the 15th of each month

Important behaviour

  • Cron jobs do not execute when running locally with encore run. Only deployed environments fire crons.
  • Because crons fire only in deployed environments, test the endpoint by calling it directly before deploying. For destructive jobs, consider a dry run mode or batch limits.
  • The cron endpoint should be expose: false so it can't be triggered externally. This blocks public access only: other services in the app can still call it, so keep it safe under unexpected or repeated internal calls and rely on its own checks rather than on who the caller is.
  • All times in schedule are UTC. Convert from local time when designing the schedule.
  • The endpoint must already exist at module load — declare it before the CronJob.

Guidelines

  • Use every for "run on a regular interval" (must divide 24h).
  • Use schedule for specific times of day or days of week.
  • Keep endpoint logic idempotent: a cron may fire late or be retried in a redeploy window.
  • For event-driven background work (not time-driven), use the encore-pubsub skill instead.

Install

Install with chainctl
chainctl skill install public/encoredev/cron:latest
Get started with chainctl
View source

Harden your own skills

Bring Chainguard's hardening pipeline to your first-party skills — custom rulesets, automated remediation, full audit trail.

Provenance

Upstream sourcehttps://github.com/encoredev/skills
Upstream commitcb69bb1f246274419aed69c84ee5815955c4c499
OCI reference

skills.cgr.dev/public/github.com/encoredev/encore/cron:latest

License

Apache-2.0

Files

HARDENING.md

LICENSE

SKILL.md


The trusted source for open source

Talk to an expert
PrivacyTerms

Product

Chainguard ContainersChainguard LibrariesChainguard VMsChainguard OS PackagesChainguard ActionsChainguard Agent SkillsIntegrationsPricing
© 2026 Chainguard, Inc. All Rights Reserved.
Chainguard® and the Chainguard logo are registered trademarks of Chainguard, Inc. in the United States and/or other countries.
The other respective trademarks mentioned on this page are owned by the respective companies and use of them does not imply any affiliation or endorsement.