CLAUDE.md for Scala: 13 Rules That Make AI Write Idiomatic Functional Code
You ask Claude to "add a Subscription service that calls Stripe" inside your Scala codebase, and you get back something that compiles cleanly and is still wrong:
A function that returns null when the user isn't found, instead of Option[User] .
Three Future { … } blocks chained with .map / .flatMap and an Await.result at the bottom — inside a service that's otherwise running on cats-effect.
A class Order(var status: String, var total: Double) with seven mutable fields, when Order is obviously a closed sum of states ( Draft , Submitted , Paid , Shipped , Cancelled ).
A try { … } catch { case _: Throwable => default } that swallows everything, including the OutOfMemoryError you'd actually want to crash on.
A def transfer(from: String, to: String, amount: Double) that takes the world's three most ambiguous primitives and trusts that callers pass them in the right order.
A given Conversion[String, UserId] = UserId(_) that silently…