agentsclimarketplace

Python scala oop

Skill cxcscmu/SkillLearnBench/skills/b1-one-shot-gemini-3-flash-preview/python-scala-translation/python-scala-oop

Translating Python classes, inheritance, and generic variance to Scala equivalents.From its SKILL.md

Install
npx -y skills add cxcscmu/SkillLearnBench --skill python-scala-oop

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

1.5 KB, 394 tokens by cl100k_base, as published. Nobody here has run it

Python to Scala OOP and Generics

This skill covers the translation of object-oriented concepts from Python to Scala.

Classes and Inheritance

Data Classes

  • Python: @dataclass(frozen=True)
  • Scala: case class (immutable by default, comes with copy and structural equality).

Abstract Base Classes

  • Python: ABC and @abstractmethod
  • Scala: abstract class or trait. Use trait when multiple inheritance is needed.

Methods

  • Python: def my_method(self, arg):
  • Scala: def myMethod(arg: Type): ReturnType = { ... }

Enums

  • Python: class Color(Enum):
  • Scala: object Color extends Enumeration { val Red, Green, Blue = Value } or (better) sealed trait Color.

Generics and Variance

PythonScalaNotes
Generic[T][T]Invariant
Generic[T_co][+T]Covariant (can return subtypes)
Generic[T_contra][-T]Contravariant (can accept supertypes)

Covariance (+T)

Useful for read-only containers (e.g., List[+A]).

class Container[+T](val item: T)

Contravariance (-T)

Useful for consumers or sinks.

trait Sink[-T] { def consume(item: T): Unit }

Structural Typing (Protocols)

  • Python: @runtime_checkable class Protocol:
  • Scala: trait or structural types type MyType = { def method(): Unit }. Usually, explicit traits are preferred.

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.