Standards for scheduled tasks and distributed locking with ShedLock. Use when implementing @Scheduled tasks or distributed locking with ShedLock in Spring Boot. (triggers: **/*Scheduler.java, **/*Job.java, scheduled, shedlock, cron)
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Spring Boot Scheduling?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/comeonoliver-spring-boot-scheduling)
---
name: spring-boot-scheduling
description: 'Standards for scheduled tasks and distributed locking with ShedLock. Use when implementing @Scheduled tasks or distributed locking with ShedLock in Spring Boot. (triggers: **/*Scheduler.java, **/*Job.java, scheduled, shedlock, cron)'
---
# Spring Boot Scheduling Standards
## **Priority: P0**
## Implementation Guidelines
### Scheduled Tasks
- **ThreadPool**: ALWAYS configure a dedicated `TaskScheduler` (default is 1 thread). Enable with `@EnableScheduling` annotation.
- **Async**: Keep `@Scheduled` methods light; offload to `@Async`/Queues. Wrap logic in try/catch; log errors and use `@Retryable` for retry on transient failures.
### Distributed Locking (ShedLock)
- **Problem**: `@Scheduled` runs on ALL pods in K8s.
- **Solution**: Use **ShedLock** to guarantee single execution.
- **Config**: Set `lockAtMostFor` (deadlock safety) and `lockAtLeastFor` (debounce).
## Anti-Patterns
- **No Default Pool**: Configure dedicated TaskScheduler (default is 1 thread).
- **No duplicates**: Use ShedLock for distributed cron in multi-pod deployments.
- **No task state**: Design tasks to be idempotent; assume pod can restart.
## References
- [Implementation Examples](references/implementation.md)