Skip to content
alyn
rrezartprebreza

Scheduled Tasks skill

Use when creating or reviewing @Scheduled jobs, cron/time-zone configuration, overlapping runs or multi-instance scheduling. Not for Spring Batch chunk/restart mechanics or arbitrary async dispatch.

$npx skills add rrezartprebreza/spring-boot-skills --skill scheduled-tasks
View this skill on GitHubrrezartprebreza/spring-boot-skills/skills/spring-boot-3/scheduled-tasks/SKILL.md
Pack stars
353
Pack installs
3k
Alyn Score
54/99
Updated
4 h ago
License
MIT
– views – installs via Alyn

rrezartprebreza

Scheduled Tasks

Install Scheduled Tasks

Pick your agent. Every command is ready to paste.

$npx skills add rrezartprebreza/spring-boot-skills --skill scheduled-tasks

The open skills CLI detects your agents (Claude Code, Cursor, Codex and 70+ more) and installs to the right folder. Add -g to install globally.

01

Install it

Run the command above, or upload the folder in Claude.

02

Ask naturally

Describe the task. Your agent loads scheduled-tasks when the request matches its description.

03

Name it if needed

If it does not trigger, say “use the scheduled-tasks skill”. In Codex, type $scheduled-tasks.

The skill itself

SKILL.md

FolderGitHub

Scheduled Tasks

Spring Boot 3 baseline

Use Framework 6 scheduling APIs and the project's Boot BOM; the template uses Java 17. Reactive scheduled methods and virtual-thread scheduling require the appropriate Framework 6.1+/Boot 3.2+ baseline. Do not copy those features into older Boot 3 applications.

Trigger contract

Establish schedule, time zone, maximum run duration, missed-run behavior and replica count before choosing an implementation. Enable scheduling once. Spring cron has six fields, including seconds. Specify a zone rather than relying on a deployment host default, and test daylight-saving transitions when the business contract uses local time.

Fixed delay measures from completion; fixed rate follows a start-time cadence. Neither is a cluster-wide lock. Adding @Async detaches completion from the scheduled invocation and can allow overlapping work. Multiple scheduled declarations or bean instances can also duplicate execution. Do not change an existing cadence just to hide a slow job.

StaleOrderSchedule is a thin, disabled-by-default cron adapter. Supply a Clock and a SweepAction bean; enable @EnableScheduling in configuration. Good configuration requires an explicit cron to enable it; the bad example starts untracked duplicate work.

Replicas and durable work

Every application instance can register the trigger. Decide whether all replicas may work, one leader triggers, or workers claim disjoint persisted items. Reuse existing coordination (for example a clustered scheduler or a tested lease library); do not invent a JVM boolean lock or call Redis SETNX without ownership, expiry and stale-owner handling.

A lease can expire while the original worker is still running. Use idempotent effects and, where stale owners can corrupt state, fencing checked by the protected resource. A lock alone does not provide exactly-once effects. Persist progress and retry intent for mandatory work; Spring's in-process schedule does not replay missed fires after downtime.

Keep the scheduling adapter small. Let a separate service claim a bounded batch and enforce tenant boundaries and transaction rules. Avoid one transaction over an unbounded scan or a remote call. Handle uncertain external outcomes with provider idempotency or reconciliation. The template's SweepAction is an application integration point, not an implemented lock or queue.

Operations and verification

Set runtime and I/O limits. Observe last successful completion, duration, failures and backlog age using bounded metric labels. Logging an exception is not a retry or an alerting policy. Use the project's scheduler shutdown policy and deployment grace period; interruption does not automatically roll back remote effects. Virtual threads still need downstream limits; fixed-delay tasks on SimpleAsyncTaskScheduler share its scheduler thread.

Test cron parsing and disabled configuration without waiting for wall-clock runs. Inject a Clock into time-dependent work. Add integration tests for competing replicas, lease expiry, partial failure and restart when using coordination. The included fixture checks the adapter and trigger registration only; it does not implement distributed scheduling.

Gotchas

  • Agent uses a five-field Unix cron - include Spring's seconds field and verify next fire times.
  • Agent assumes @Scheduled runs once across replicas - define explicit coordination or safe duplicate work.
  • Agent adds @Async to fix a slow timer - bound and test overlapping execution instead.
  • Agent relies on a lease for exactly-once effects - account for expiry, stale owners and duplicates.
  • Agent silently enables a destructive maintenance job - require explicit configuration and authorization.
  • Agent tests timing with long sleeps - use a fixed Clock and direct trigger calculations.

Official sources

Tips for Scheduled Tasks

  • • Start a fresh session after installing so your agent picks up the new skill.
  • • It bundles reference files. The agent reads them only when needed, so they cost no context until then.
  • • It is part of a pack with 30 skills. Install only the ones you need with --skill to keep triggers precise.
  • • If two skills overlap, mention the one you want by name.

Questions about Scheduled Tasks

What does the Scheduled Tasks skill do?

Use when creating or reviewing @Scheduled jobs, cron/time-zone configuration, overlapping runs or multi-instance scheduling. Not for Spring Batch chunk/restart mechanics or arbitrary async dispatch.

How do I install Scheduled Tasks?

Run "npx skills add rrezartprebreza/spring-boot-skills --skill scheduled-tasks" in your project. The skills CLI installs it for Claude Code, Cursor, Codex and 70+ other agents. In Claude on the web, upload the skill folder as a ZIP under Customize > Skills.

Does Scheduled Tasks work in Cursor and Codex?

Yes. Scheduled Tasks uses the open SKILL.md format, so it works in Claude Code, Claude, Cursor, OpenAI Codex, Gemini CLI, GitHub Copilot and other agents that support agent skills.

Is Scheduled Tasks free?

Scheduled Tasks is open source on GitHub under the MIT license. It is free to install; check the license before commercial use.

Who made Scheduled Tasks?

Scheduled Tasks is published by rrezartprebreza in the rrezartprebreza/spring-boot-skills repository, together with 29 other skills.

Similar skills. From other creators.