β All skills
Scala Developer
Use when building Scala applications with functional programming, Akka actors, Play Framework, and Cats Effect.
About this skill
Use when building Scala applications with functional programming, Akka actors, Play Framework, and Cats Effect.
SKILL.md
scala-developer.SKILL.mdPlace it in your Syntic skills folder. For Syntic Code, install in your local skills directory, review the contents and run it in a controlled environment first.
--- name: Scala Developer description: Use when building Scala applications with functional programming, Akka actors, Play Framework, and Cats Effect. category: Languages version: 1.0.0 tools: [] --- # Scala Functional Development Write expressive, type-safe, and concurrent applications using Scala's type system and functional programming paradigms. ## Functional Programming Principles - Prefer immutable data structures; use `case class` for domain models and `val` for bindings - Model side effects explicitly with effect types: `IO` from Cats Effect or `ZIO`; pure functions return effect descriptions - Use algebraic data types (sealed trait hierarchies, Scala 3 enums) to make illegal states unrepresentable - Compose behavior with higher-order functions, not inheritance; prefer `map`, `flatMap`, `fold` over pattern matching - Use type classes (Functor, Monad, Show, Eq) from Cats for generic, reusable abstractions ## Akka Actor Model - Design actors around domain boundaries; each owns state, communicates exclusively through messages - Use typed actors (`Behavior[T]`) over untyped; compiler catches message type mismatches - Keep handlers non-blocking; delegate blocking I/O to separate dispatcher with `Behaviors.receive` and `context.pipeToSelf` - Use `ask` pattern with timeouts for request-response; prefer `tell` (fire-and-forget) when no response needed - Implement supervision strategies: restart transient failures, stop permanent failures - Use Akka Cluster Sharding for distributing actors across nodes by entity ID ## Play Framework Web Applications - Structure controllers as thin orchestration layers; business logic in service classes via Guice or compile-time DI - Use `Action.async` for all endpoints; return `Future[Result]` to avoid blocking - Define routes in `conf/routes` with typed path parameters; use custom `PathBindable` and `QueryStringBindable` for domain types - Implement JSON serialization with Play JSON's `Reads`, `Writes`, `Format` type classes - Use Play's built-in CSRF protection, security headers, CORS filters; configure allowed origins explicitly ## Concurrency Patterns - Use `Future` with dedicated `ExecutionContext` for I/O-bound work - Use Cats Effect `IO` or ZIO for structured concurrency with resource safety, cancellation, error handling - Use `Resource[IO, A]` for managing connections, file handles, and resources requiring cleanup - Use `fs2.Stream` for streaming data processing; compose with `through`, `evalMap`, `merge` - Implement retry logic with `cats-retry` or ZIO Schedule; configure exponential backoff with jitter ## Type System Leverage - Use opaque types (Scala 3) or value classes to wrap primitives with domain meaning: `UserId`, `Email`, `Amount` - Use refined types from `iron` or `refined` to enforce invariants: `NonEmpty`, `Positive`, `MatchesRegex` - Use union types and intersection types (Scala 3) for flexible composition without class hierarchies - Use given/using (Scala 3) or implicits (Scala 2) for type class instances and contextual parameters ## Build & Tooling - Use sbt with `sbt-revolver` for hot reload; `sbt-assembly` for fat JARs - Configure scalafmt for formatting; use scalafix for refactoring and linting - Cross-compile for Scala 2.13 and Scala 3 when publishing libraries - Use `sbt-dependency-graph` for visualizing and auditing transitive dependencies ## Before Completing - Run `sbt compile` with `-Xfatal-warnings` to ensure zero compiler warnings - Run `sbt test` to verify all tests pass, including property-based ScalaCheck tests - Run `sbt scalafmtCheckAll` to verify formatting compliance - Check for unused imports and dead code with scalafix rules
Install
Syntic App
- 1Create a dedicated folder for this skill in your local skills library.
- 2Place SKILL.md into that folder.
- 3Restart Syntic and invoke this skill on matching tasks.
Syntic Code (CLI)
- 1Save SKILL.md in your local Syntic Code skills directory.
- 2Keep related files in the same skill folder.
- 3Run in a safe environment and validate outputs.