chore: add agentic tooling, cleanup

This commit is contained in:
Flo
2026-03-30 12:59:23 +02:00
parent 7645402347
commit ebb42dbad7
40 changed files with 2066 additions and 2 deletions

45
.crosslink/rules/scala.md Normal file
View File

@@ -0,0 +1,45 @@
### Scala Best Practices
#### Code Style
- Follow Scala Style Guide
- Prefer immutability (`val` over `var`)
- Use case classes for data
- Leverage pattern matching
```scala
// GOOD: Idiomatic Scala
case class User(id: String, name: String)
class UserService(repository: UserRepository) {
def findUser(id: String): Option[User] =
repository.find(id)
def processUser(id: String): Either[Error, Result] =
findUser(id) match {
case Some(user) => Right(process(user))
case None => Left(UserNotFound(id))
}
}
```
#### Error Handling
- Use `Option` for missing values
- Use `Either` or `Try` for operations that can fail
- Avoid throwing exceptions in pure code
```scala
// GOOD: Using Either for errors
def parseConfig(json: String): Either[ParseError, Config] =
decode[Config](json).left.map(e => ParseError(e.getMessage))
// Pattern match on result
parseConfig(input) match {
case Right(config) => useConfig(config)
case Left(error) => logger.error(s"Parse failed: $error")
}
```
#### Security
- Use prepared statements for database queries
- Validate input with refined types when possible
- Never interpolate user input into queries