scala
1
总安装量
1
周安装量
#41382
全站排名
安装命令
npx skills add https://github.com/g1joshi/agent-skills --skill scala
Agent 安装分布
mcpjam
1
claude-code
1
replit
1
junie
1
zencoder
1
Skill 文档
Scala
Scalable Language. It interops seamlessly with Java.
When to Use
- Big Data processing (Spark)
- High-concurrency systems (Akka)
- Functional programming on the JVM
- Complex domains
Quick Start
object Hello extends App {
println("Hello, World!")
val list = List(1, 2, 3)
val doubled = list.map(_ * 2)
println(doubled)
}
Core Concepts
Functional & OOP
Classes and traits mixed with higher-order functions and immutability.
Immutability
Default preference for immutable data structures (val vs var).
Pattern Matching
Powerful switch-like construct.
x match {
case 1 => "one"
case "two" => 2
case _ => "other"
}
Case Classes
Immutable value objects with built-in equals, hashCode, and pattern matching support.
Best Practices
Do:
- Prefer immutability (
val) - Use Option instead of null
- Leverage the type system
- Use scalafmt
Don’t:
- Write “Java in Scala”
- Overuse implicit conversions (can be confusing)
- Use
returnkeyword (expression-oriented)