/direct-style-scala:direct-style-scalafrom direct-style-scala
Guides Scala coding style, tooling, and functional programming with direct-style Scala, Ox structured concurrency, and synchronous Tapir. Includes sbt 2 commands, braceless syntax, and performance rules.
Ships in direct-style-scala. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
sbt connects to a background server by default; don't add --client. The
server keeps the environment of its first start; sbt shutdown to reset it.sbt "clean ; compile ; test"test only runs failed, new or affected tests; testFull runs allsbt run starts the app in a separate JVM; killing sbt doesn't stop it, kill
that JVM. unknown event: sbt/clientJob means the sbt runner is too old.build.sbt is Scala 3: no postfix calls, slash syntax only (Test / compile).
Bare settings apply to all subprojects (no ThisBuild /). Tasks are cached:
wrap side-effecting custom tasks in Def.uncached.target/out/jvm/scala-<version>/<project>/https://repo1.maven.org/maven2/<group-with-slashes>/<artifact>/maven-metadata.xml,
including the suffix (com/softwaremill/ox/core_3; sbt plugins:
_sbt2_3). Take the latest stable <version>; <release> may be a prerelease
(RC, M<n>, SNAP, alpha, beta, NIGHTLY). NEVER use
search.maven.org/solrsearch (stale by months). Find unknown coordinates via
https://index.scala-lang.org/api/autocomplete?q=<name>.sbt scalafmtAllbuild.sbt includes
-Wunused:all, -Wvalue-discard, -Wnonunit-statement in scalacOptions.
Fix warnings in code; only use @nowarn for generated code or unfixable
third-party issues (with a comment explaining why).{}.scala file, decide its package, filename, and
each top-level declaration's visibility (narrowest the call sites allow).
Read Code Organization and Visibility when
adding packages/modules or widening visibility..pipe/.tap (import ox.*) to drop single-use vals that only
feed the next line; keep a named val when the name documents intent.Flow or page.computeIntensive or cede() — see CPU-intensive
work..handle / .handleSecurity / .handleSuccess —
NEVER .serverLogic* (it needs an effect wrapper).supervised per request/job; return the fork's result, never an object
owning running forks. Read Scope
propagation before
taking (using Ox) / (using ResourceScope) or forking from a factory.java.io stream is NOT ended by scope cancellation — shutdown deadlocks.
BEFORE driving a subprocess or reading a blocking external stream (socket,
SSE), read Subprocesses and External
Streams.Worked examples: Domain Modeling.
var declarations MUST be inside methods (e.g. processing loops), never
as class fields. Class-level vars break reasoning and testability. The sole
exception is mutable state encapsulated by an Ox Actor, which serialises every
invocation onto a single thread — the actor is what makes the field safe to hold
(see Concurrency and Inter-Thread Communication).
Use only immutable collections (Map, Set, List) — never mutable.Map,
mutable.Set, mutable.Buffer (mutable collections are fine in test fakes).state => state functions; confine the var to the smallest scope.Clock, Random, and UUID generation explicitly
(parameter or constructor) — never call them inside methods.Option for absence (never
null), smart constructors returning Either (not require)String, Int, Long, and Boolean domain values in opaque types or
enums — NEVER use raw primitives for domain concepts (identifiers,
quantities, configuration values).Boolean parameters and return values with two-case enums.Either[E, T] — never throw, require, or bare
try/catch. Exceptions only for unrecoverable errors that end the current
request/message.BEFORE writing code that uses Tapir, Ox, or sttp, or touches a topic listed
below, read the relevant chapter(s) in full. Follow every API and > Required /
> Important callout exactly — do NOT substitute another approach. Read the
chapter file from this skill's directory, or with a raw HTTP GET from the base
URL below — never via a tool that summarises the page (summaries drop callouts
and exact API calls).
https://raw.githubusercontent.com/virtuslab/scala-skill/refs/heads/master/direct-style-scala/skills/direct-style-scala/
build.sbt, scalacOptions, OxApp.Simple, adopt-tapirClock, UUID), opaque types, smart constructors, enums vs BooleanuseInScope, useCloseableInScope, resourceScope, ResourceScope, release orderOxApp, forkDiscard/forkUserDiscard, forever/sleep loops, orderly shutdownderives ConfigReader, env overrides, Sensitive, load-time validationautowire, autowireMembersOf, wireListmapPar/merge/mapStateful, par, channels, Actor, AtomicReference, computeIntensive/cede, (using Ox) scope propagationabandonOnInterruptReads, pipe back-pressureFail ADT, either/.ok(), transactEither, .catching, nesting rulesFail → status code mapping, failOutput, defaultHandlersDefaultDecodeFailureHandler, onDecodeFailureNextEndpoint, custom messages, hideEndpointsWithAuthsecureEndpoint[T], AuthTokenOps[T], Auth[T], handleSecurityIdentity effect, security headers, CORS, SPA static files, request cancellation, NettySyncServersbt-buildinfo, BuildInfo git hash endpointEndpointsForDocs, @main generator, sbt taskSOAPAction routing, SOAP faultswithDiscriminatorFieldName(None), opaque types in DTOsPlainCodecs, opaque-type ids, Codec.derivedEnumeration@Table, DbCodec, Repo/TableInfo, sql interpolation, Flyway, HikariCPEmailScheduler, SMTP/Mailgun/dummy senders, templates, batch sendingKafkaFlow.subscribe, mapPar, KafkaDrain, offset commits, transactional produce-and-commit, graceful shutdownTapirSyncStubInterpreter, SttpClientInterpreter, public and secured endpoints in-processPropagatingVirtualThreadFactory, MDC correlation100-resource-management.md (opens in a new tab)110-background-processes.md (opens in a new tab)120-type-safe-configuration.md (opens in a new tab)130-compile-time-dependency-injection.md (opens in a new tab)140-new-project-setup.md (opens in a new tab)150-shared-state-across-threads.md (opens in a new tab)160-code-organization.md (opens in a new tab)170-subprocesses-and-external-streams.md (opens in a new tab)180-domain-modeling.md (opens in a new tab)200-error-handling.md (opens in a new tab)210-error-output-customisation.md (opens in a new tab)220-decode-failure-handling.md (opens in a new tab)300-authentication.md (opens in a new tab)310-http-server-configuration.md (opens in a new tab)320-version-api.md (opens in a new tab)330-compile-time-openapi-generation.md (opens in a new tab)340-soap-with-scalaxb.md (opens in a new tab)350-json-bodies.md (opens in a new tab)360-endpoint-inputs.md (opens in a new tab)400-sql-persistence.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub virtuslab/scala-skill --plugin direct-style-scalaOther plugins' skills for the same job