scala-java-time-handling
Working with Java's LocalDate and LocalDateTime in Scala for temporal tokenization
Works with
Agent Skills format with YAML frontmatter. Claude Code reads it as-is.
---
name: "scala-java-time-handling"
description: "Working with Java's LocalDate and LocalDateTime in Scala for temporal tokenization"
license: "MIT"
---
# Java Time API in Scala
## Import Statements
```scala
import java.time.{LocalDate, LocalDateTime}
import java.time.format.DateTimeFormatter
```
## Creating Formatters
```scala
// Predefined patterns
private val isoFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss")
private val dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd")
// Using formatter
val formatted = isoFormatter.format(localDateTime)
```
## Handling Optional Format Strings
```scala
// Option for custom format
formatStr match {
case Some(pattern) => DateTimeFormatter.ofPattern(pattern).format(value)
case None => defaultFormatter.format(value)
}
// Or with getOrElse
val formatter = formatStr
.map(DateTimeFormatter.ofPattern)
.getOrElse(isoFormatter)
formatter.format(value)
```
## Type Matching for Date/Time
```scala
value match {
case dt: LocalDateTime => isoFormatter.format(dt)
case d: LocalDate => dateFormatter.format(d)
case _ => value.toString
}
```
## ISO 8601 Standards
- DateTime: `yyyy-MM-dd'T'HH:mm:ss`
- Date: `yyyy-MM-dd`
- Time: `HH:mm:ss`
## Common Patterns
```scala
// Store formatter as val for reuse (thread-safe)
private val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd")
// Format with fallback
def formatDate(date: LocalDate): String = {
try {
formatter.format(date)
} catch {
case _: Exception => date.toString
}
}
```More General & Other skills
find-skills
vercel-labs/skills
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
grill-me
mattpocock/skills
A relentless interview to sharpen a plan or design.
grill-with-docs
mattpocock/skills
A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.

