scala-development
Senior Scala developer using functional programming and Typelevel ecosystem. Use when writing Scala code, implementing Scala features, or working with sbt/bloop projects. Used as a part of the XP skill.
When & Why to Use This Skill
This Claude skill provides expert-level Scala development assistance, specializing in pure functional programming and the Typelevel ecosystem. It streamlines the creation of type-safe, robust applications by leveraging industry-standard libraries like Cats, Cats-effect, and FS2, while providing deep integration with sbt and bloop build systems.
Use Cases
- Case 1: Developing high-concurrency backend services using Cats-effect and FS2 for efficient, non-blocking asynchronous operations.
- Case 2: Refactoring legacy Scala codebases to follow functional programming principles, such as replacing exceptions with type-safe error handling using Either and EitherT.
- Case 3: Designing complex domain models using Algebraic Data Types (ADTs) to ensure business logic is validated at compile-time.
- Case 4: Automating and optimizing the development lifecycle through integrated sbt/bloop compilation commands and MUnit testing suites.
| name | Scala Development |
|---|---|
| description | Senior Scala developer using functional programming and Typelevel ecosystem. Use when writing Scala code, implementing Scala features, or working with sbt/bloop projects. Used as a part of the XP skill. |
Scala Development
Principles
- Functional programming techniques
- Avoid
Any,null,throw, and unsafe patterns - Prefer Typelevel ecosystem (cats, cats-effect, fs2)
- Use ADTs for domain modelling
- Errors as values (Either, EitherT, MonadError)
Compilation Priority
- Check for
.bloopdirectory first (ls -la)
If .bloop exists — use bloop:
bloop compile <module-name>
bloop test <module-name>
bloop test <module-name> -o "*<filename>*"
Module name is root for non-modular projects.
If no .bloop — use sbt:
sbt compile
sbt test
sbt "testOnly *SpecName*"
- ALWAYS run
sbt commitCheckafter completing code changes.
Testing (MUnit)
class FeatureSpec extends munit.FunSuite:
test("describes expected behaviour") {
// Arrange
val input = createTestData()
// Act
val result = functionUnderTest(input)
// Assert
assertEquals(result, expected)
}
Effectful tests (cats-effect):
class FeatureSpec extends munit.CatsEffectSuite:
test("async operation succeeds") {
for
result <- asyncOperation()
yield assertEquals(result, expected)
}
Assertions:
assertEquals(obtained, expected)assertNotEquals(obtained, unexpected)assert(condition)interceptMessage[ExceptionType]("message") { code }
Error Handling Patterns
// Prefer Either over exceptions
def parse(input: String): Either[ParseError, Value] = ???
// Use EitherT for effectful errors
def fetchAndParse(id: Id): EitherT[IO, AppError, Value] = ???
// MonadError for generic error handling
def process[F[_]: MonadError[*[_], Throwable]](input: Input): F[Output] = ???