lang-scala
Skill0 starsChanged 7 days agoMITView on GitHub
Use when writing, reviewing, testing or setting up Scala backend code in a loops run (the scala language pack) - toolchain, layout, race policy, coverage, idioms and footguns.
In this repository35 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- skills/work/platforms/claude.mdCLAUDE.md
- llms.txtllms.txt
- clarifySkill
- consistencySkill
- debuggingSkill
- documentationSkill
- featureSkill
- hexagonalSkill
- initSkill
- jobs-and-state-machinesSkill
- lang-clojureSkill
- lang-cppSkill
- lang-csharpSkill
- lang-elixirSkill
- lang-erlangSkill
- lang-goSkill
- lang-javaSkill
- lang-kotlinSkill
- lang-phpSkill
- lang-pythonSkill
- lang-rubySkill
- lang-rustSkill
- lang-swiftSkill
- lang-typescriptSkill
- memorySkill
- parallel-workSkill
- performanceSkill
- qualitySkill
- reportSkill
- review-integrationSkill
- statusSkill
- testingSkill
- workSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 38
Do not weaken it: no testOnly shortcut in place of the gate, no retries to hide flakiness, no Test / parallelExecution := false.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Scala backend (the scala pack)
Rule book: specs/languages/scala/RULES.md (IDs SCALA-<SEC>-NN). Gate data: specs/languages/scala/pack.json. Layering, design limits and the race rule are neutral: specs/ARCHITECTURE.md, specs/SOLID.md, WORKFLOW §6. This skill only maps them onto Scala.
When it applies
loops lang detect reports scala (a build.sbt, or a build.mill for the mill variant). loops lang show scala prints the effective pack, with the variant applied.
Project rules first
Follow the project's own config over the defaults here: build.sbt, project/plugins.sbt, .scalafmt.conf, .scalafix.conf, .editorconfig, project/build.properties, the chosen effect style (cats-effect, ZIO, Play, Pekko) and framework conventions (SCALA-FW-01/02). When you follow a project rule over a loops rule, log it: loops run override --rule "<loops rule>" --project "<project rule, file:line>" --note "<what you did>". Never mix effect systems or build tools to match this skill.
Toolchain the gate runs
Agents run loops gate, or one check's command while iterating. The base build tool is sbt; commands below are sbt 1.x (the verified line; sbt 2 moves target/, see Coverage).
| Check | Command | Notes |
compile (required) | sbt -batch Test/compile | warnings fail only if the project sets -Werror (SCALA-TOOL-05) |
scalafmt (required when .scalafmt.conf exists) | sbt -batch scalafmtCheckAll scalafmtSbtCheck | check only; fix with sbt scalafmtAll scalafmtSbt |
scalafix (optional, needs .scalafix.conf) | sbt -batch "scalafixAll --check" | one quoted argv element |
arch | loops arch | regex scanner, package-dir resolver |
test (required, repeated 3x) | sbt -batch clean coverage test coverageReport | race substitute and coverage in one |
coverage (required) | internal | parses Cobertura, new code at least 70% |
dependency-check, osv | sbt -batch dependencyCheck, osv-scanner scan source -r . | opt in (--vuln) |
Iteration loop, which is not the gate: sbt ~testQuick, sbt "testOnly com.acme.OrderSpec", sbtn or sbt --client to keep the server warm (SCALA-TEST-10). Never run bare sbt interactively: always -batch in scripts. Missing plugin: an optional check skips with its install hint, a required one fails (D12). Post-edit hook: none for Scala (sbt has no single-file formatter), so run scalafmtCheckAll before reporting.
Mill variant (build.mill): mill __.test.compile, mill __.test, formatter mill mill.scalalib.scalafmt.ScalafmtModule/checkFormatAll __.sources. It has not been spot-run, so confirm with the project's own Mill setup. scala-cli (project.scala) is not gated: single-module scripts and spikes only.
Race policy (WORKFLOW §6)
race.mode is none: the JVM has no general data-race detector, and ThreadSanitizer does not apply. The substitute is a required gate check, never skipped silently:
- The
testcheck carriesrepeat: 3, so the gate runs the whole test argv three times. - Suites run in parallel:
Test / parallelExecutionis true by default. If the build setsTest / fork := true, it must also setTest / testForkedParallel := true, or forked tests run sequentially and the substitute proves nothing. This is a wave 0 prerequisite (below). - Any
Ref,STM,AtomicCellor fiber code gets a concurrent test (parTraverseorZIO.foreachPar, at least 100 iterations) and virtual time, neverThread.sleep(SCALA-CONC-04,SCALA-TEST-09). - Do not weaken it: no
testOnlyshortcut in place of the gate, no retries to hide flakiness, noTest / parallelExecution := false. jcstress or Lincheck for lock-free code are review items, not gate checks. Details:concurrency.md.
Coverage recipe
sbt-scoverage; always clean first, since stale instrumentation is the top failure (SCALA-TEST-06). The Cobertura file is target/scala-<full ver>/coverage-report/cobertura.xml (glob **/target/scala-*/coverage-report/cobertura.xml, so every sbt subproject is found: verified on a domain + adapters build); scoverage-report/ holds only scoverage.xml and HTML. Cobertura <class filename> is relative to a <sources> entry, and <sources> can hold a bogus --source entry that is not a directory. Multi-project builds: each subproject writes its own report and the gate merges every match; coverageAggregate is not needed. sbt 2 moves target/ to target/out/...: re-verify the glob (show coverageDataDir) and log an override if the project is on sbt 2.
Project prerequisites the architect or scala-engineer adds in wave 0 (D13, logged as an override), with the exact snippet if the gate preflight fails:
project/plugins.sbt:sbt-scoverage,sbt-scalafmt, and optionallysbt-scalafix,sbt-tpolecat,sbt-dependency-check, each pinned..scalafmt.confwithversion = ...andrunner.dialect, committed (this is what makesscalafmtrequired).build.sbt:Test / testForkedParallel := truewhenTest / fork := true;-Werrorin CI mode;coverageFailOnMinimum := truewithcoverageMinimumStmtTotal := 70;coverageExcludedPackagesfor generated code.project/build.properties(sbt.version=), JDK pin (.sdkmanrcor.tool-versions),.gitignoreperSCALA-REPO-12.
Run-scoped environment (D15)
Download caches stay shared: COURSIER_CACHE and the sbt boot directory (shared_env); relocating them re-fetches the world. Only temp is scoped: JAVA_TOOL_OPTIONS=-Djava.io.tmpdir={tmp}. target/, project/target/, .bsp/, .bloop/, .metals/ cannot be redirected cheaply in sbt 1, so cleanup removes them when they did not exist at the baseline.
Layers on Scala
domain/ sbt project, no dependsOn case classes, enum ADTs, opaque types; no IO, no effect system
application/ dependsOn domain use cases + consumer-owned port traits (F[_] or ZLayer)
adapters-http/ dependsOn application http4s/Tapir/ZIO HTTP routes, codecs, DTOs
adapters-db/ dependsOn application doobie/skunk repos, Flyway migrations
app/ dependsOn all composition root: Resource or ZLayer wiring, config
it/ dependsOn app % "test->test" Testcontainers integration testsThe sbt dependsOn graph is the first enforcement (the compiler rejects a wrong-direction import); loops arch adds purity (no cats.effect, zio, java.io, Instant.now, Await.result in domain) and catches package cycles inside one project (SCALA-ARCH-02/07/08/09).
Footguns
- Blocking the compute pool (
IO(jdbc()),Await.result): useIO.blocking,ZIO.attemptBlocking. - Dropped effects (a statement returning
IO):-Wnonunit-statementand-Wvalue-discardas errors. ref.get.flatMap(v => ref.set(v + 1)): useupdateormodify.- Fire-and-forget
.startorfork: useSupervisor,background,Scope. Option.get,null,asInstanceOf: match orfold; WartRemover in domain.%instead of%%: the Scala binary suffix is missing.- Eager
Futureat class init: use lazy, cancelableIOorZIO. sbt coverage testwithoutclean: stale instrumentation.io.circe.generic.auto._on a big module:derives Codec.AsObjectorsemiauto.- Akka for a new project (BSL licence): use Apache Pekko.
Load on demand
repo.md: layout, sbt multi-project, pins,.gitignore, CI, releases.architecture.md: layers as sbt projects, effect style, DI,loops archmapping.idioms.md: totality, immutability, Scala 3 features, errors, resources, compiler flags.testing.md: frameworks, TDD loop, coverage, doubles, Testcontainers, flakiness.concurrency.md: fiber models, shared state, the race substitute, async pitfalls.security.md: SQL, deserialisation, web, secrets, supply chain, SAST.data-api.md: DATA, API, OBS and OPS digests.frameworks.md: http4s/Tapir, ZIO, Play, Pekko, Akka licence.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

