Context and guidelines for AI agents contributing to this repository.
This is the Scala Data Engineering learning path, part of TP-Coder Innovation Hub. It teaches Scala 3.x for data engineering, covering the actor model (Akka/Pekko), streaming (Akka Streams), and distributed processing (Apache Spark). The audience spans entry-level engineers learning Scala through senior engineers making architectural decisions.
- Entry (``): New to Scala or functional programming. Needs clear explanations, minimal jargon, working code examples.
- Mid (``): Comfortable with Scala. Needs deeper patterns, performance considerations, framework internals.
- Senior (``): Designing systems. Needs architectural trade-offs, decision frameworks, operational knowledge.
Always indicate the target level with , , or `` badges in headings or exercise descriptions.
- Write Scala 3.x syntax. Do not use Scala 2 syntax (no
implicitkeyword, noreturn, no semicolons, no braces for single-expression methods). - Use
sbtfor build definitions or Scala CLI for single-file examples. State which tool the example assumes. - Prefer DataFrames over RDDs in Spark examples. Only show RDDs when explaining low-level concepts.
- Use
catsandcats.effectfor functional programming patterns (Monad, Semigroup, IO). - Use
doobiefor database access examples. - Use
circeoruPicklefor JSON serialization. - Include working, compilable code. If an example omits imports for brevity, note it.
- Use Mermaid diagrams for architecture, data flow, and type hierarchies.
- Use tables for comparisons and decision frameworks.
- When explaining errors, show the compiler error message and then the fix.
- Do not use Scala 2 syntax (
implicit def,implicit val,implicit class). Use Scala 3given/using/extension. - Do not suggest Python, Java, or Go as replacements unless the user explicitly asks for a comparison.
- Do not use emojis in content.
- Do not generate placeholder content (e.g., "TODO: add example"). Either write the content or say you need more context.
- Do not use
varunless the pattern specifically requires mutable state (e.g., inside an actor's receive method). Default toval. - Do not use
null. UseOption[A]. - Do not use exceptions for control flow. Use
Either[E, A]orTry[A]. - Do not recommend deprecated APIs. Check version compatibility for Spark 4.x, Akka/Pekko 1.x, Scala 3.x.
These concepts recur across modules. Agents should reference them consistently:
- Immutability: Default to
valand immutable collections. Explain when mutability is justified (actors, performance-critical hot paths). - Type safety: Leverage the compiler. Use
Eitherfor error channels,Optionfor nullable values, enums for sealed hierarchies. - For-comprehensions: The idiomatic way to chain monadic operations. Prefer over nested
flatMap/map. - Pattern matching: Use for data decomposition. Always make matches exhaustive.
- Backpressure: Critical concept in streaming. Explain why it matters before showing how.
- Catalyst optimizer: Explain what it does when showing DataFrame examples. Users should understand that readable code is optimized code.
- Supervision: In actor examples, always define a supervision strategy. Actors without supervision strategies are incomplete.
| Tool | Version | Notes |
|---|---|---|
| Scala | 3.x (3.6+) | Significant indentation, extension methods, given/using, union types |
| sbt | 2.x | Build tool for multi-module projects |
| Scala CLI | Latest | For single-file scripts and prototyping |
| Apache Spark | 4.x | DataFrames primary API, AQE default-on |
| Akka / Pekko | 1.x (Pekko) | Actor model, streams, cluster |
| cats | 2.x | Type classes, monadic combinators |
| cats.effect | 3.x | IO monad, resource management, concurrency |
| doobie | 1.x | Type-safe JDBC via cats.effect |
| circe | 0.14.x | JSON encoding/decoding via type classes |
scala-data-engineering/
README.md
AGENTS.md
00-foundations/ # Programming fundamentals
01-first-code/ # First Scala programs
02-functional-programming/ # FP in Scala
03-actor-model/ # Actor model and Akka
04-apache-spark/ # Distributed data processing
05-production/ # Testing, monitoring, deployment
06-workshop/ # End-to-end project