python-scala-oop

Convert Python object-oriented code into idiomatic Scala.

4|Updated Feb 22, 2026
One-click install
npx skills add https://github.com/GeneralReasoning/env-skillsbench --skill python-scala-oop-generalreasoning
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-scala-oop
Source: https://github.com/GeneralReasoning/env-skillsbench/tree/main/python-scala-translation/environment/skills/python-scala-oop
Command: npx skills add https://github.com/GeneralReasoning/env-skillsbench --skill python-scala-oop-generalreasoning

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Translating Python object-oriented code into idiomatic Scala to preserve behavior while leveraging Scala's type system and patterns.

Core Features & Use Cases

  • Basic Classes: Python classes translated to Scala class definitions with constructors and methods.
  • Data Classes → Case Classes: Python dataclasses mapped to Scala case classes for immutability and auto-generated methods.
  • Properties & Accessors: Python properties mapped to Scala getters/setters or idiomatic Scala property access.
  • Inheritance & Abstract Classes: Python inheritance translated to Scala traits, abstract classes, and concrete implementations.
  • Enums & Singleton: Python enums and singleton patterns shown with Scala enum equivalents and companion objects.
  • Factory Patterns: Patterns for creating instances in a type-safe Scala way.
  • Design Patterns: Guidance for translating common patterns like the builder, factory, and strategy.

Quick Start

Convert a given Python class into an idiomatic Scala counterpart.

Frequently Asked Questions about python-scala-oop

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I translate Python dataclasses to Scala?

Map Python dataclasses to Scala case classes to achieve immutability and auto-generated methods like equals and hashCode. This translation preserves the original data structure while leveraging Scala's native type safety and functional patterns.

What is the best way to convert Python inheritance to Scala?

Translate Python inheritance to Scala by mapping abstract base classes to Scala traits or abstract classes, then implementing concrete classes that extend them. This preserves polymorphic behavior and hierarchical relationships while utilizing Scala's type system.

How do Python properties map to Scala accessors?

Map Python properties to Scala getters and setters or idiomatic property access patterns. This ensures controlled field access while maintaining the original encapsulation behavior and property validation logic.

Can I translate Python singleton patterns and enums to Scala?

Translate Python singleton patterns and enums to Scala using companion objects and Scala enum equivalents. This preserves single-instance behavior and enumerated value constraints while adhering to Scala's object-oriented and functional design patterns.

How do you handle factory and builder design patterns when moving from Python to Scala?

Translate Python factory and builder design patterns to Scala using type-safe instance creation patterns. This preserves original creational logic and encapsulation while leveraging Scala's type system to ensure compile-time safety and idiomatic implementation.